[XeTeX] Full justification of text

Zdenek Wagner zdenek.wagner at gmail.com
Mon Feb 25 10:53:36 CET 2013


2013/2/25 Sasi Kumar <sasi.fsf at gmail.com>:
> Friends,
>
> I started using xelatex to typeset article class documents in two languages
> using xelatex with help from you all. Earlier I was using Omega exclusively.
> When I switched to xelatex, I find that the text is left justified, or, in
> LaTeX terminology, rqaggedright. Since there doesn't appear to be a command
> for full justification in LaTeX, (possibly since this is the default), I
> have been wondering how to do that in xelatex. I am giving below a sample of
> my document. Hope someone can help me in this matter as you have helped
> earlier.
>
No, the default is not \raggedright and it never was. The problem is
that you use polyglossia, but with English hyphenation patterns. Thus
Malayalam cannot be hyphenated. \tolerance is too small so as to allow
wide interword spaces. The paragraph breaking algorithm thus cannot
find feasible line spaces and gives up with these messages in the log
file:


Overfull \hbox (37.3105pt too wide) in paragraph at lines 31--32
\EU1/Rachana(0)/m/n/12 ആലോചിച്ചിരിക്കും. ഉണ
ടെങ്കില് അവിടെ മനുഷ്യനെപ്��
�ോലുള്ള, ഉയര്ന്ന ബൂദ്ധിശക്തി
യും സാങ്കേതികവിദ്യയുമുള്ള

Overfull \hbox (51.19487pt too wide) in paragraph at lines 31--32
\EU1/Rachana(0)/m/n/12 ലോകങ്ങളുടെ യുദ്ധം (War o
f the Worlds) എഴുതാന് പ്രേരിപ്പിച്ച�
��ു്. ചൊവ്വ ഗ്രഹത്തിലാണു് മനുഷ�
��യനെപ്പോലെയുള്ള

Overfull \hbox (30.45789pt too wide) in paragraph at lines 31--32
\EU1/Rachana(0)/m/n/12 സൌരയൂഥത്തിലെ ഗ്രഹങ്�
��ളിലൊന്നും വികസിതമായ ജന്തുവര
ഗങ്ങളുണ്ടാവാനിടയില്ല എന്ന
 നമുക്കിന്നറിയാം.

Overfull \hbox (14.52274pt too wide) in paragraph at lines 31--32
\EU1/Rachana(0)/m/n/12 എന്നാല് സൂര്യനല്ലാ�
��െയുള്ള മറ്റു് ഏതെങ്കിലും നക��
�ഷത്രത്തിനു് ഇത്തരം ഗ്രഹങ്ങള�
��ണ്ടോ, അവയിലേതെങ്കിലും

If you look carefully, you will see that your sample document is fully
justified but these four lines extend to the right behind the right
margin. Even \lefthyphenmin and \lefthyphenright does not help because
you are still in English. It is either necessary to use \slopyy or set
\tolerance=9999 \emergencystretch=2em. Both look quite ugly,
hyphenation

If \setdefaultlanguage{malayalam} is added below
\usepackage{polyglossia}, it looks much better even with the default
=tolerance. There is just one line where hyphenation cannot be found.
You can then use \- as a hint for the line breaking algorithm.

> \documentclass[a4paper,12pt]{article}
> \usepackage[margin=1in]{geometry}
> \usepackage{polyglossia}
> \usepackage{fontspec}
>
> \setmainfont[Script=Malayalam]{Rachana}
>
> \addfontfeatures{Mapping=tex-text}
>
> \usepackage{url}
> \usepackage{fancyhdr}
>
> \date{}
>
> \begin{document}
> \lefthyphenmin=2
> \righthyphenmin=2
>
> \thispagestyle{empty}
> \pagestyle{fancy}
>
> \begin{center}
> \setmainfont[Script=Malayalam]{Meera}
>     {\Large\textbf{\bf ബുധനെക്കാള്‍ ചെറിയ സൌരയൂഥേതര ഗ്രഹം }}
>
>     \vspace{5mm}{\textbf{ ഡോ.~വി.~ശശി കുമാര്‍}}
> \end{center} \setmainfont[Script=Malayalam]{Rachana}
>
> \setlength{\baselineskip}{1.2\baselineskip}\addtolength{\parskip}{10pt}
>
> ഭൂമി പോലെയുള്ള ഗ്രഹങ്ങള്‍  മറ്റെവിടെയെങ്കിലും ഉണ്ടോ എന്നു് നമ്മില്‍  പലരും
> ഒരിക്കലെങ്കിലും ആലോചിച്ചിരിക്കും. ഉണ്ടെങ്കില്‍  അവിടെ മനുഷ്യനെപ്പോലുള്ള,
> ഉയര്‍ന്ന ബൂദ്ധിശക്തിയും സാങ്കേതികവിദ്യയുമുള്ള ജന്തുക്കളുണ്ടോ? ഇത്തരം ചിന്ത
> തന്നെയാണു് 19-20 നൂറ്റാണ്ടില്‍  ജീവിച്ചിരുന്ന എച്ച്.ജി. വെല്‍സിനെ
> \textit{ലോകങ്ങളുടെ യുദ്ധം} (War of the Worlds)  എഴുതാന്‍  പ്രേരിപ്പിച്ചതു്.
> ചൊവ്വ ഗ്രഹത്തിലാണു് മനുഷ്യനെപ്പോലെയുള്ള ജന്തുക്കളുണ്ടെന്നു് അദ്ദേഹം
> സങ്കല്പിച്ചതും അവ ഭൂമി പിടിച്ചെടുക്കാന്‍ വരുന്നതായി കഥ എഴുതിയതും.
> സൌരയൂഥത്തിലെ ഗ്രഹങ്ങളിലൊന്നും വികസിതമായ ജന്തുവര്‍ഗങ്ങളുണ്ടാവാനിടയില്ല എന്നു്
> നമുക്കിന്നറിയാം. എന്നാല്‍  സൂര്യനല്ലാതെയുള്ള മറ്റു് ഏതെങ്കിലും
> നക്ഷത്രത്തിനു് ഇത്തരം ഗ്രഹങ്ങളുണ്ടോ, അവയിലേതെങ്കിലും ഒന്നില്‍
> ഭൂമിയിലെപ്പോലെയുള്ള ജീവന്‍ നിലനിര്‍ത്താന്‍  സഹായകമായ പരിസ്ഥിതിയുണ്ടോ,
> തുടങ്ങിയ കാര്യങ്ങള്‍ ഇപ്പോഴും നമുക്കറിയില്ല.
>
> \end{document}
>
>
> --
> V. Sasi Kumar
> Free Software Foundation of India
> Please see: http://swatantryam.blogspot.com/
>
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
>   http://tug.org/mailman/listinfo/xetex
>



-- 
Zdeněk Wagner
http://hroch486.icpf.cas.cz/wagner/
http://icebearsoft.euweb.cz



More information about the XeTeX mailing list