Hello Bogdan,

Sent from my iPad

On 06/03/2011, at 10:15 PM, Bogdan Butnaru <[email protected]> wrote:

> 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

Please don't use single-letter names for your own macros. These are very likely 
to clash with macros that are already in use in other contexts.
For instance \c produces a cedilla accent, used extensively in French. In 
particular, you may have great difficulty in your bibliography, should this 
accent be needed for someone's name, or in the title of a paper that you wish 
to cite.

> 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.

If the words are always captured as the argument to a macro, (\csword  say) 
then why not simply include the extra space both before and after the word, 
along with any font-switch?
e.g. 
      \newcommand{\csword}[1]{\,{\tt #1}\index{#1}\,}

where I've included automatic indexing, as this is likely to be desirable in a 
long manuscript.

Such a macro can be built upon to recognise and implement solutions to cases 
that require even more special treatment.

> 
> 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.

My simple macro above will put a small amount of space *before* the comma. But 
this should not look too bad, especially as you do not want the comma being 
mistaken as part of the technical syntax of your keywords. This is common in 
mathematics, where TeX has a \mathsurround  parameter, which results in extra 
space similar to what you want. 


> 
Hope this helps,

    Ross


--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex

Reply via email to