From lyx-users Wed Oct 22 12:12:26 2008 From: Charles de Miramon Date: Wed, 22 Oct 2008 12:12:26 +0000 To: lyx-users Subject: Re: Automagically reduce the spacing between "++" in the word "C++" Message-Id: X-MARC-Message: https://marc.info/?l=lyx-users&m=122467759200334 Daniel Lohmann wrote: > Hi, > > I am currently in the process of polishing the typesetting of my > thesis. One of the things I would like to achieve is to reduce the > spacing between "++" in the words C++ and AspectC++, as this looks > somewhat "strange" with the font I am using. > > This question is somewhat related to the thread > > http://www.mail-archive.com/lyx-users@lists.lyx.org/msg66864.html > > where the original poster asked for a way to reduce the space between > the two slashes in hyperlinks. However, the original solution does not > work in my case, as C++ and AspectC++ are not typeset by any kind of > (La)TeX command, but are just ordinary words. Replacing all > occurrences with some ERT box is not an option, as this would cause > too much hassle and would not work in external material, such as > bibliographic entries. I am looking for a more elegant solution. > The easiest way would be to process your latex and bib files through a sed script to replace C++ to \C++ and define a \C++ macro with the correct space between C and + > I think that I remember to have read about so-called catcodes (or > whatever?) in TeX, which apparently make it possible to declare > certain characters as "active" so that further processing is possible > whenever the TeX scanner reads such character. I wonder if it is > possible this way to declare in the preamble that > "C" followed by "+", followed by "+" > is "active" and should be inherently substituted with something like > "\mbox{C+\hspace{-.5ex}+}}" It is possible to redefine in TeX the letter C catcode and then test if it is followed by two +. But it is a lot of work (TeX macros are not very easy) and maybe it is like using a hammer to kill a fly. Cheers, C. -- http://www.kde-france.org