[XeTeX] How to prevent typesetting hyphen

Zdenek Wagner zdenek.wagner at gmail.com
Sun Jun 29 21:58:42 CEST 2014

2014-06-29 16:55 GMT+02:00 Naveen kumar C.M. <naveenkumarcm at gmail.com>:

> Hi Sasi Kumar,
> this might help you fix your problem:
> http://www.tex.ac.uk/cgi-bin/texfaq2html?label=hyphoff

This is a good point but not the solution of a problem. It is true that a
hyphen is not hard-wired, it is just a default. Once a font is loaded you
can change it by setting its slot number to \hyphenchar\font. If you set
-1, hyphenation in the font will be disabled. The trick is to set a slot
number of an invisible zero-width character. A good candidate is IMHO
zero-width-non-joiner which should be present in any Indic font. Delving
deep into plain TeX macros and TeX primitives (these are good friends even
for LaTeX users) reveals that even the default hyphenation character is not
hard-wired but when the font is loaded, the value of \defaulthyphenchar is
used. If you need only Malayalam in your document, set \defaulthyphenchar
before loading your fonts.

Similarly, \sloppy is too sloppy. There is a big difference between
\tolerance 10000 (TeX's infinity) and 9999. First set \tolerance=9999 and
run the document. If you get overful boxes, you have problems that you have
to fix somehow. If you have underfull boxes only, find the one with the
largest badness (look it up in the log file). Assume it is 2547. Now change
do setting this way:

\advance\hbadness by -1

After reprocessing the document you should have just one underful box. Now
you can try to decrease \tolerance by 1 (ie to 2546). Sometimes you will
still have just one underful box and no overful box. If you get an overful
box, increase \tolerance again. If the tolerance is low enough, remove
"\advance\hbadness by -1" and you are finished. If not, set the \tolerance
to the allowable value and you have to fix overful lines. For instance, you
can put to the end of such a paragraph the following code:

{\emergencystretch 1em \par}

The braces make the chane local just for that paragraph. Of course, you can
change \tolerance locally using the same way.

I learned this many years ago from a lecture given by Phil Taylor.

> Best
> -Naveen
> <http://www.pictocular.com/>
> ****************************************************************************************************
> I contend that we both are atheists. I just believe in one fewer god than
> you do.
> When you understand why you dismiss all other possible gods,
> you will understand why I dismiss yours.
>                                   -  Stephen Henry Roberts
> ****************************************************************************************************
> On 29 June 2014 01:01, Sasi Kumar <sasi.fsf at gmail.com> wrote:
>> Hello texnicians,
>> I am typesetting a document in Malayalam. In this language, we
>> normally do not put a hyphen mark when a word braks at the end of a
>> line, but just continue writing. Is there a way in xelatex to do that?
>> That is, the word just continues on the next line without a hyphen at
>> the end of the line.
>>  I also find that the right margin is not strictly maintained, with
>> some characters projecting out in some lines. I have been using latex
>> and aleph for a long time and have hardly seen this problem.
>> Any way to approach the problem and solve it would be very helpful.
>> Regards,
>> Sasi
>> --
>> 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
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
>   http://tug.org/mailman/listinfo/xetex

Zdeněk Wagner
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/xetex/attachments/20140629/97d8bf16/attachment-0001.html>

More information about the XeTeX mailing list