[XeTeX] line spacing
Ross Moore
ross at ics.mq.edu.au
Mon Mar 7 22:59:30 CET 2005
On 08/03/2005, at 4:02 AM, Yves Codet wrote:
> Yes, it would be handy indeed for fonts such as Zapfino.
>
> The following remark is for Ross. Jonathan advised me to write in
> preambles:
>
> \catcode"00A0=\active
> \def^^^^00a0{\char32\relax}
>
> so that "no-break space" appears in the output. Could it be taken care
> of by "xunicode"?
OK, nice idea.
But maybe not so easy to do this "properly & robustly"
There is a problem with just declaring this \catcode change globally.
Not all fonts (used with LaTeX) have a space in the \char32 .
You can do something like:
\def\activatenonbreakspace{\catcode"00A0=\active}
\def\deactivatenonbreakspace{\catcode"00A0=12\relax}
{\activatenonbreakspace\gdef^^^^00a0{\char32\relax}}
... which gives switches:
\activatenonbreakspace
\deactivatenonbreakspace
to switch on/off this feature.
Now you want this turned on for most Apple & Adobe fonts,
but turned off for Computer Modern, any Math fonts, Xy-pic fonts
and other traditional TeX fonts.
You also want it to happen automatically for the "right" fonts,
rather than putting it explicitly in every document.
In a sense this is an encoding issue.
Here's a first (very simple) attempt at getting the logic right:
If the font has 'unicode' encoding (so 'U' at present)
then
use \activatenonbreakspace
otherwise (e.g. `T1', `OT1', `LY1', ... )
use \deactivatenonbreakspace .
I could try to hack at the \fontencoding command to implement
this. But firstly I'd need to know:
What other fonts use `U' encoding ?
What other encodings have the \char32 as a space ?
There is another way to tackle this, which is to keep
\catcode^^^^00a0=\active
always, but expanding into a "robust" macro
\nonbreakingspace , say.
Then alter the expansion of \nonbreakingspace
according to the \fontencoding , as discussed above.
(Essentially to either \char32 when appropriate,
or to ~ when not.)
Indeed, I think it has to be done this way,
else you will not be able to use ^^^^00a0
within section headings where:
a. the document body uses Fancy fonts
or some titles need them; but...
b. the Table-of-Contents uses Computer Modern.
Similarly for any situation where LaTeX writes out
into a .aux, .toc, .idx, .lof, etc. file,
expecting to reuse the character string within a
different context to how it was input.
Alternatively, why not use ~ in your documents,
the way it has always been done traditionally in TeX ?
The expansion of ~ should be linked to the encoding
(in the same way that xunicode does for other characters)
so as to produce the \char32 character as appropriate.
Yes, I think this is the *correct* LaTeX way to proceed:
(i) Examine how ~ currently works in the T1 encoding.
(ii) mimic this for a robust macro \nonbreakingspace .
(iii) extend this action for `U' encoding => \char32
(iv) activate ^^^^00a0
(v) \let ~ \nonbreakingspace (if advantageous)
(vi) \let ^^^00a0\nonbreakingspace
That should result in a fully backwards-compatible
definition of ^^^^00a0 that will do the right thing
for auxiliary files, TofCs, indexes, etc.
(It also will ensure that ~ has this latter property too!)
Comments or improvements requested please,
before I try to implement this scheme.
>
> Thanks to all for your help.
Hope this helps,
Ross
>
> Best wishes,
>
> Yves
>
> _______________________________________________
> XeTeX mailing list
> postmaster at tug.org
> http://tug.org/mailman/listinfo/xetex
>
>
------------------------------------------------------------------------
Ross Moore ross at maths.mq.edu.au
Mathematics Department office: E7A-419
Macquarie University tel: +61 +2 9850 8955
Sydney, Australia fax: +61 +2 9850 8114
------------------------------------------------------------------------
More information about the XeTeX
mailing list