2

How can I balance two columns with the multicol package if the lines are very close together? The top and bottom are aligned, but often the lines inbetween aren't.

The actual purpose of this exercise is the Urdu nastaleeq script, with which this makes sense. However, to simplify matters I've used the Latin script in the following code.

\documentclass[14pt]{memoir}
\usepackage{multicol}
\linespread{.4}
\raggedcolumns
\maxsecnumdepth{none}
\setsecheadstyle{\centering\normalsize\bfseries}
\setbeforesecskip{-1\onelineskip}
\setlength\aftersecskip{ 1sp}

\begin{document}
\begin{multicols}{2}
\section{Lorem ipsum}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam congue dolor     nec placerat laoreet. Nullam ut est vel arcu consequat viverra in ut nisi. Pellentesque ac nisl eu sem dapibus congue. Mauris non varius tortor, sit amet molestie lacus. Nulla sagittis eu metus molestie tempor. Proin vitae risus neque. Etiam urna elit, auctor viverra semper a, convallis eu ante. Duis iaculis turpis quis sem vestibulum ultricies eu vel est. Sed congue nunc eu eleifend iaculis. Vestibulum tortor lectus, suscipit et metus sit amet, cursus feugiat arcu.
\section{Section}
Etiam vulputate nibh a lorem consequat euismod. Nam vitae velit pellentesque, viverra purus sed, ultrices dui. Morbi et lorem ac felis suscipit viverra. Sed tempor ligula et dictum suscipit. Sed ac eleifend tortor. Pellentesque non augue nibh. Maecenas hendrerit lectus purus, ac viverra lacus tristique ut. Ut a lorem eros. Nunc ultricies pharetra sapien non convallis. Etiam ullamcorper finibus lectus, non tristique diam hendrerit at. Fusce eleifend lectus eu ex tempus, vitae mollis magna feugiat. Nullam ut odio consectetur, egestas odio in, porta velit.

Maecenas id consequat felis, eget lacinia libero. Proin congue interdum dolor, at rhoncus tortor consequat sit amet. Sed ex ante, consectetur et eros sed, consectetur tempus tellus. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas vel metus eu elit sollicitudin sagittis. Phasellus accumsan, ex a accumsan malesuada, sem augue mollis nisi, ut aliquam lorem magna id neque. Ut sagittis sem vitae elit rutrum, id condimentum augue rutrum. Cras id iaculis leo. Nullam ut vehicula tellus. Sed pulvinar lectus nunc, et pellentesque neque tristique vitae. Nunc maximus odio felis, ut ullamcorper nulla porttitor sed. Fusce et ultrices mauris, non scelerisque dolor. Mauris ac imperdiet arcu.
\section{Section}
Suspendisse potenti. Maecenas ultrices sem non volutpat venenatis. Praesent consequat ante non consectetur porta. Cras elementum, ante id sollicitudin aliquet, mi neque vulputate nunc, vitae fringilla enim nulla sed risus. Vivamus nulla nulla, blandit at arcu sit amet, sollicitudin dictum neque. Praesent nec sodales enim. Integer lobortis eu purus non euismod. Donec nec pretium nulla, eget tempus augue. Nulla facilisi. Donec at tellus orci. Cras eleifend, ex id consectetur accumsan, ipsum lacus elementum nibh, tincidunt cursus elit leo sodales sapien. Etiam faucibus tristique metus eu malesuada. Vestibulum et turpis id sapien varius molestie sit amet eget arcu. Sed auctor nisi nec magna tempus congue.

Morbi turpis tellus, ullamcorper eget magna ac, semper elementum metus. Morbi sit amet tellus a diam condimentum hendrerit. Sed faucibus a dui et tempor.
\end{multicols}
 \end{document}

(Ok, for anybody interested, here is an Urdu example. Please note that due to the more horizontal nature of "normal" arabic fonts, they don't have this problem:)

%run with xelatex
\documentclass[12pt]{memoir}
\usepackage{multicol}
\usepackage{fontspec}
\setmainfont[AutoFakeBold=2.0,Script=Arabic,Scale=1, WordSpace=6]{Jameel Noori Nastaleeq}
\usepackage[RTLdocument,extrafootnotefeatures]{bidi}

\OnehalfSpacing
\raggedcolumns
\setsecnumdepth{none}
\setsecheadstyle{\centering\normalsize\bfseries}
\setbeforesecskip{-1\onelineskip}
\setlength\aftersecskip{1sp}

\begin{document}
\begin{multicols}{2}
. برصغیر پاک و ہند کے اکثر علاقوں میں بولی اور سمجھی جانے والی زبان جس کے لغات میں پراکرت نیز غیر پراکرت، دیسی لفظوں کے ساتھ ساتھ عربی فارسی ترکی اور کچھ یورپی زبانوں کے الفاظ بھی شامل ہیں اور جس کی قواعد میں عہد بہ عہد تصرفات اور مقامی اختلافات کے باوجود آریائی اثر غالب ہے۔ (ابتداءً ہندوی یا ہندی کے نام سے متعارف رہی۔ ابتدا یا آغاز کے بارے میں مختلف نظریات ہیں : بعض لوگ سورسینی یا اب بھرنش کی جدید ترقی یافتہ یا ترمیم شدہ شکل بتاتے ہیں جس نے عہد غزنوی کے لگ بھگ نیا روپ نکالنا شروع کیا اور جو تقریباً چودھویں صدی سے ضبط تحریر میں آئی۔ منظوم اردو کو ریختہ کہتے تھے۔ 

"اردو کی ابتدائی نشوونما میں صوفیا کرام کا کام" (کتاب کا نام)۔،
\section{ایک}
دہلی کے محاورے کے مستند ہونے کی سند قلعہ معلٰی کی زبان ہوئی؛ اس بنا پر زبان اردوئے معلٰی کہلائی جو کثرت استعمال سے اردو ہو گئی۔ بعض مغربی مصنفوں نے اسے مورز کا نام بھی دیا۔ جدید ہندی سے عربی فارسی الفاظ کی فراوانی تدھبو کے رجحان اور عربی رسم الخط کی بنا پر متمیز؛ عربی رسم الخط میں لکھی جاتی ہے جس میں اردو کی مخصوص آوازوں کیلئے کچھ اضافے کر لیے گئے ہیں۔ کئی سو سال کا ادبی اور علمی ذخیرہ اس میں موجود ہے۔ خصوصاً بیسویں صدی میں جدید علوم و فنون کی بکثرت کتابیں اس میں تصنیف و تالیف اور ترجمہ ہوئیں، اور بے شمار علمی اصطلاحات وضع ہوئیں؛ اس طرح یہ اعلٰی تعلیم کے مختلف درجات میں انگریزی کی جگہ برصغیر کے دفتروں میں رائج ہوئی، بیسویں صدی کے آغاز سے کچھ پہلے اردو ہندی کا قضیہ شروع ہوا اور ایک نئی زبان ہندی بنائی گئی، برصغیر پاک و ہند کی سیاسی جدوجہد آزادی میں اردو کا بڑا حصّہ ہے)۔
\section{دو}
دہلی کے محاورے کے مستند ہونے کی سند قلعہ معلٰی کی زبان ہوئی؛ اس بنا پر زبان     اردوئے معلٰی کہلائی جو کثرت استعمال سے اردو ہو گئی۔ بعض مغربی مصنفوں نے اسے مورز کا نام بھی دیا۔ جدید ہندی سے عربی فارسی الفاظ کی فراوانی تدھبو کے رجحان اور عربی رسم الخط کی بنا پر متمیز؛ عربی رسم الخط میں لکھی جاتی ہے جس میں اردو کی مخصوص آوازوں کیلئے کچھ اضافے کر لیے گئے ہیں۔ کئی سو سال کا ادبی اور علمی ذخیرہ اس میں موجود ہے۔ خصوصاً بیسویں صدی میں جدید علوم و فنون کی بکثرت کتابیں اس میں تصنیف و تالیف اور ترجمہ ہوئیں، اور بے شمار علمی اصطلاحات وضع ہوئیں؛ اس طرح یہ اعلٰی تعلیم کے مختلف درجات میں انگریزی کی جگہ برصغیر کے دفتروں میں رائج ہوئی، بیسویں صدی کے آغاز سے کچھ پہلے اردو ہندی کا قضیہ شروع ہوا اور ایک نئی زبان ہندی بنائی گئی، برصغیر پاک و ہند کی سیاسی جدوجہد آزادی میں اردو کا بڑا حصّہ ہے)۔
\end{multicols}
\end{document}

(text taken from Urdu Wiktionary, "Urdu")

I've been dealing with the issue with \columnbreak\vspace* to align belligerent columns and vspace within columns. I would have thought that the section headings would always be adjusted properly due to the preceding space, but that is often not the case. This "solution" of course goes against the grain of latex and is in any case a pain.

8
  • What eactly is this suppose to do: \linespread{.4}????
    – daleif
    Commented Oct 3, 2017 at 7:44
  • I'd probably use some of the memoir stuff to change the line spacing instead of messing with \linespread directly.
    – daleif
    Commented Oct 3, 2017 at 7:45
  • @daleif Actually, with Nastaleeq I am using OneHalfSpacing, and that is already causing the same problem due the the vertical nature of script. In this example I've only used linespread to push the lines close enough together to show what happens when using the Roman script. But the effect is the same. Of course, in English it looks horrible, whereas in my Urdu case the effect is caused although the lines are fairly far apart.
    – dietz
    Commented Oct 3, 2017 at 8:58
  • @daleif I've added an Urdu example now.
    – dietz
    Commented Oct 3, 2017 at 9:27
  • 1
    it seems to me that adjacent lines in the two columns won't always have the same height since some words are bound to be longer than the average, and unless all lines are the same height, i think the problem may be hopeless. you say that the top and bottom lines are aligned, and the "usual" complaint (about european languages, not about urdu!) is that the bottom lines aren't aligned. Commented Oct 3, 2017 at 13:20

1 Answer 1

3
+50

Grid typesetting is not easy with latex. But in your case you get the uneven linespacing as the content of the lines (the letters) is larger than the baselineskip (due to the small \linespread in the case of the latin example and the nature of your script in the other case). TeX tries hard to avoid that two lines overlap and so it pushes the lines apart. You can avoid this by setting \lineskiplimit to a suitable negative length. Then you will get uniform line spacing, but you can also get overlapping lines. Here the output of your latin script example if I add \lineskiplimit=-\maxdimen:

enter image description here

So you will have to try what happens with your real example -- if you get overlapping lines and you want to avoid it you will have to enlarge the line spacing, or live with the uneven look.

Edit

In the case of the urdu script you get uneven spacing for the section as you are using \OnehalfSpacing. This means that lines are not 14.5pt apart (the value of \onelineskip) but nearly 18pt. If you use \baselineskip vor the space before the section, everything aligns fine:

\documentclass[12pt]{memoir}
\usepackage{multicol}
\usepackage{fontspec,tikz}

\setmainfont[AutoFakeBold=2.0,Script=Arabic,Scale=1, WordSpace=6]{Jameel Noori Nastaleeq}
\usepackage[RTLdocument,extrafootnotefeatures]{bidi}


\OnehalfSpacing

\raggedcolumns
\setsecnumdepth{none}
\setsecheadstyle{\centering\normalsize\bfseries}

\setbeforesecskip{-1\baselineskip}
\setlength\aftersecskip{1sp}


\begin{document}\lineskiplimit=-\maxdimen

\begin{multicols}{2}
. برصغیر پاک و ہند کے اکثر علاقوں میں بولی اور سمجھی جانے والی زبان جس کے لغات میں پراکرت نیز غیر پراکرت، دیسی لفظوں کے ساتھ ساتھ عربی فارسی ترکی اور کچھ یورپی زبانوں کے الفاظ بھی شامل ہیں اور جس کی قواعد میں عہد بہ عہد تصرفات اور مقامی اختلافات کے باوجود آریائی اثر غالب ہے۔ (ابتداءً ہندوی یا ہندی کے نام سے متعارف رہی۔ ابتدا یا آغاز کے بارے میں مختلف نظریات ہیں : بعض لوگ سورسینی یا اب بھرنش کی جدید ترقی یافتہ یا ترمیم شدہ شکل بتاتے ہیں جس نے عہد غزنوی کے لگ بھگ نیا روپ نکالنا شروع کیا اور جو تقریباً چودھویں صدی سے ضبط تحریر میں آئی۔ منظوم اردو کو ریختہ کہتے تھے۔

"اردو کی ابتدائی نشوونما میں صوفیا کرام کا کام" (کتاب کا نام)۔،
\section{ایک}
دہلی کے محاورے کے مستند ہونے کی سند قلعہ معل��ی کی زبان ہوئی؛ اس بنا پر زبان اردوئے معلٰی کہلائی جو کثرت استعمال سے اردو ہو گئی۔ بعض مغربی مصنفوں نے اسے مورز کا نام بھی دیا۔ جدید ہندی سے عربی فارسی الفاظ کی فراوانی تدھبو کے رجحان اور عربی رسم الخط کی بنا پر متمیز؛ عربی رسم الخط میں لکھی جاتی ہے جس میں اردو کی مخصوص آوازوں کیلئے کچھ اضافے کر لیے گئے ہیں۔ کئی سو سال کا ادبی اور علمی ذخیرہ اس میں موجود ہے۔ خصوصاً بیسویں صدی میں جدید علوم و فنون کی بکثرت کتابیں اس میں تصنیف و تالیف اور ترجمہ ہوئیں، اور بے شمار علمی اصطلاحات وضع ہوئیں؛ اس طرح یہ اعلٰی تعلیم کے مختلف درجات میں انگریزی کی جگہ برصغیر کے دفتروں میں رائج ہوئی، بیسویں صدی کے آغاز سے کچھ پہلے اردو ہندی کا قضیہ شروع ہوا اور ایک نئی زبان ہندی بنائی گئی، برصغیر پاک و ہند کی سیاسی جدوجہد آزادی میں اردو کا بڑا حصّہ ہے)۔
\section{دو}
دہلی کے محاورے کے مستند ہونے کی سند قلعہ معلٰی کی زبان ہوئی؛ اس بنا پر زبان     اردوئے معلٰی کہلائی جو کثرت استعمال سے اردو ہو گئی۔ بعض مغربی مصنفوں نے اسے مورز کا نام بھی دیا۔ جدید ہندی سے عربی فارسی الفاظ کی فراوانی تدھبو کے رجحان اور عربی رسم الخط کی بنا پر متمیز؛ عربی رسم الخط میں لکھی جاتی ہے جس میں اردو کی مخصوص آوازوں کیلئے کچھ اضافے کر لیے گئے ہیں۔ کئی سو سال کا ادبی اور علمی ذخیرہ اس میں موجود ہے۔ خصوصاً بیسویں صدی میں جدید علوم و فنون کی بکثرت کتابیں اس میں تصنیف و تالیف اور ترجمہ ہوئیں، اور بے شمار علمی اصطلاحات وضع ہوئیں؛ اس طرح یہ اعلٰی تعلیم کے مختلف درجات میں انگریزی کی جگہ برصغیر کے دفتروں میں رائج ہوئی، بیسویں صدی کے آغاز سے کچھ پہلے اردو ہندی کا قضیہ شروع ہوا اور ایک نئی زبان ہندی بنائی گئی، برصغیر پاک و ہند کی سیاسی جدوجہد آزادی میں اردو کا بڑا حصّہ ہے)۔
\end{multicols}

\begin{tikzpicture}[remember picture,overlay]
\foreach\x in {1,2,...,24}
{\draw[red] ([yshift=\dimexpr-3cm -\x\normalbaselineskip]current page.north west) --++(\paperwidth,0);}
\end{tikzpicture}
\end{document}

enter image description here

9
  • This fits the bill for the English example, so I'm happy to give the bounty for this answer. For some reason, it isn't working very well for the Urdu example. This must be due to some other reason. A basic problem seems to be the space before the section heading, which is a bit too small. In fact, if I change \setbeforesecskip{-1\onelineskip} to \setbeforesecskip{-3.35ex}, the space before the section is much closer to a blank line. In addition, the second column tends to begin slightly higher Any idea why that could be?
    – dietz
    Commented Oct 7, 2017 at 11:29
  • I added an edit. Commented Oct 7, 2017 at 13:01
  • This is brilliant! Exactly what I was looking for.
    – dietz
    Commented Oct 7, 2017 at 14:57
  • With this example, it works. However, if you copy/paste the same text again at the end of the text, the second column slightly out of kilter. So I'm guessing that this is due to \OnehalfSpacing? Still, the general result is much better.
    – dietz
    Commented Oct 7, 2017 at 15:25
  • I have now tried the suggested solution on a number of texts, and the spacing of the section headings is now correct in every case. The case of the second column being out of kilter seems to be unrelated. As soon as I adjust the height with \columnbreak\vspace*{...}, all of the lines align properly.
    – dietz
    Commented Oct 7, 2017 at 15:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .