[XeTeX] Controlling spacing around macros

Bogdan Butnaru bogdanb at gmail.com
Sun Mar 6 12:15:51 CET 2011


I’m typesetting a CS thesis; it contains of course lots of code
snippets—class names and such—sprinkled among the text. I typeset them
in a different, fixed-width font. But there’s something else I want
and I couldn’t figure out if it’s possible in XeLaTeX:

I’d like the word-spacing around the snippets to be slightly
increased. For instance, in a line like “a \c{List<Item>} is the
result” the spaces around “List<Item>” should be slightly larger
(similar to the inter-sentence space in non-French spacing). But I
can’t do this with a couple of simple “hspace” calls in “\c”, because
it would also separate any punctuation adjacent to the code snippet,
which I don’t want.

Is this possible in XeLatex?

-- Bogdan Butnaru

PS. I don’t mind if the extra space goes over adjacent punctuation,
e.g. if the two spaces in “variable \c{foo}, and” are both long, as
long as its symmetrical, i.e. if the two spaces in “variable (\c{foo})
and” are the same length. Something like [long
space][code][punctuation][normal space] is no problem, because the
punctuation mark will separate the code snippet enough at the right,
but it won’t bother me either I think.

More information about the XeTeX mailing list