XeTeXUneven line spacing

Information and discussion about XeTeX, an alternative for pdfTeX based on e-Tex
Post Reply
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Uneven line spacing

Post by meho_r »

Recently I've had this problem. I got uneven line spacing in arabic text. It seems that the basis for the spacing isn't baseline (in fact, I have no idea what is the basis in this case), which produce pretty ugly result with different spacing between some lines (especially prone to this is the last line; look at the sample .jpg file at the bottom). First I thought that the problem here may be vocals, but without them the difference between lines is even more obvious :(

Is there a command that explicitely set baseline (or any other fixed point) as the basis for spacing even if as a result some overlapping occurs? Or can the spacing be fixed, not variable as it seems to be here?

Although this doc is produced with XeLaTeX, LaTeX gives similar results so the question is in general.
Attachments
LineSpace.jpg
LineSpace.jpg (51.78 KiB) Viewed 7154 times
MWE.tex
(3.92 KiB) Downloaded 538 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Uneven line spacing

Post by Juanjo »

Try the following code and look at the second paragraph:

Code: Select all

Code, edit and compile here:
\documentclass{article}
\begin{document}
Foo text foo text foo text foo text foo text foo text foo text foo text foo text
foo text foo text foo text foo text foo text foo text foo text foo text foo text
{\Huge foo text} foo text foo text foo text foo text foo text foo text foo text
foo text foo text foo text foo text foo text foo text foo text foo text foo text
foo text foo text foo text foo text {\Huge foo text} foo text foo text foo text
\bigskip
\begingroup
\setlength{\lineskiplimit}{-\maxdimen}
Foo text foo text foo text foo text foo text foo text foo text foo text foo text
foo text foo text foo text foo text foo text foo text foo text foo text foo text
{\Huge foo text} foo text foo text foo text foo text foo text foo text foo text
foo text foo text foo text foo text foo text foo text foo text foo text foo text
foo text foo text foo text foo text {\Huge foo text} foo text foo text foo text\par
\endgroup
\bigskip
Foo text foo text foo text foo text foo text foo text foo text foo text foo text
foo text foo text foo text foo text foo text foo text foo text foo text foo text
{\Huge foo text} foo text foo text foo text foo text foo text foo text foo text
foo text foo text foo text foo text foo text foo text foo text foo text foo text
foo text foo text foo text foo text {\Huge foo text} foo text foo text foo text
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
\maxdimen is a predefined length in Plain TeX, equal to 16383.99998pt.
You will find a complete explanation in chapter 15 of TeX by Topic, by Victor Eijkhout.
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Re: Uneven line spacing

Post by meho_r »

So, the point is in negative value of \lineskiplimit. I've been experimenting a little and in the end, satisfying solution is that I've declared a negative \lineskiplimit for the whole doc (because I have many arabic terms inline with latin text and want those lines too with equal spacing) and then have corrected too tight spacing using package setspace (\setstretch{1.08} gives pretty good result). "Side effect" ;) of all this is that I've learned that \setstretch can be applied inside of a particular environment, independently of the value set for the main doc, which is fantastic since although 1.08 stretch is good for the main text, it is not very useful for some paragraphs with arabic text only (especially if using larger text sizes and vocals). So I've created a new environment for that very purpose and set \setstretch{1.6} which produces similar result as in the picture I've posted, but this time with correct spacing.

Thank you very, very much for your help, Juanjo and for the link.
Post Reply