On Wed, Oct 22, 2008 at 01:51:34PM +0200, 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/[email protected]/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.
>
> 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}+}}"
>
> Any TeX gurus on this list who might help me?
Quick shot:
\makeatletter
\def\plus{+}
\def\smallplusplus{\raisebox{0.6ex}{\tiny+\hspace{-0.3ex}+}}
\catcode`\+=13
\long\def+#1{\ifx#1+\smallplusplus\else\plus#1\fi}
\makeatother
\documentclass{article}
\begin{document}
Single C
CPlus C+
CPlusPlus C++ D C++A
CPlusStar C+* D C+*A
\end{document}
Andre'