TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
@tohecz thanks, though I knew about that discussion. In fact, the question came to my mind when I read that. – AlefSin Jan 6 '13 at 22:23
Instead of using \nolinebreak, put the whole code in \hbox{...} – yo' Jan 6 '13 at 22:35
for TeX Logos there's hologo or metalogo – bloodworks Jan 6 '13 at 22:40
@tohecz Better \mbox, as \hbox doesn't start a paragraph if found in vertical mode. – egreg Jan 8 '13 at 8:43
up vote 4 down vote accepted

As the answers to Prettiest way to typeset "C++"? 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:

enter image description here

You can do better with the relsize package or, as the scaling you require is not very big, with \scalebox:

\newcommand{\CPP}{C\kern-.05em \raisebox{.3ex}{\scalebox{.9}{++}}\xspace}


{\Large\texttt{\string\Large} size: \CPP\par}

\texttt{normal} size: \CPP\par

{\small\texttt{\string\small} size: \CPP\par}


As you can see in the following image, the font size is respected.

enter image description here

Using \kern-.05em instead of \hspace{-.05em} ensures that no break point is inserted between the C and the two plus signs. Alternatively


will do the same.

You can do similarly for \CS and \FS

share|improve this answer
Thanks for your answer. Yes, I also realized that there is no standard way to typeset the names for these languages. I liked your solution as mine was definitely broken. – AlefSin Jan 8 '13 at 11:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.