Is there any package with predefined macros for common programming languages' names? I mean, macros that help writing things like C++, C#, F# etc. in a nice way, the same way as for example \TeX? I have already written some of my own macros to do that but surely someone else has already thought about that and have prepared such useful macros in a package.
EDIT:
Here are macros that I use myself. Might be useful for someone else.
\newcommand{\CPP}{C\nolinebreak[4]\hspace{-.05em}\raisebox{.3ex}{\small++}\xspace}
\newcommand{\CS}{C\nolinebreak[4]\hspace{-.05em}\raisebox{.2ex}{\small\#}\xspace}
\newcommand{\FS}{F\nolinebreak[4]\hspace{-.05em}\raisebox{.2ex}{\small\#}\xspace}
Best Answer
As the answers to Prettiest way to typeset "C++" (cplusplus)? show, there is no general consensus on how to typeset those fancy names. There's no package for them either.
Thus you're better using your definitions, probably written in a more context independent way; for instance your
will give wrong results if used in a section title that's typeset at a larger size, because
\small
is hard coded:You can do better with the
relsize
package or, as the scaling you require is not very big, with\scalebox
:As you can see in the following image, the font size is respected.
Using
\kern-.05em
instead of\hspace{-.05em}
ensures that no break point is inserted between the C and the two plus signs. Alternativelywill do the same.
You can do similarly for
\CS
and\FS