# How to outputs 'C\C++'

I just try output C\C++ in LaTeX as following below:

\textit{C\backslashC\+\+}

But im getting this issue:

! Undefined control sequence.
<argument> C\backslashC
\+\+
l.141 ... \textit{C\backslashC\+\+}
• Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Sean Allred Nov 26 '13 at 4:40

\documentclass[preview,border=12pt]{standalone}% change it back to your own document class

\begin{document}
I love \texttt{C/C++} but not \texttt{C\char\\ C++}.
\end{document}

• style of backslash is different from that of forward slash. in \texttt, use this: \char\\ (and better yet, put an open quote before the double backslash, but that's real hard to show as a literal in this markdown environment). – barbara beeton Nov 26 '13 at 3:18
• \char\\ (backtick backtick slash char backtick slash slash backtick backtick) is possible as a markdown. – kiss my armpit Nov 26 '13 at 3:32
• thanks. i'm trying to do this on an ipad, and it doesn't like to do what I tell it at the best of times. anyhow, your example looks much better now. – barbara beeton Nov 26 '13 at 3:33
• It may be helpful to explain why the OP's code did not work, or (perhaps more reasonable) point to a resource that does. – Sean Allred Nov 26 '13 at 4:40

The error message says that \backslashC is undefined. You need to put something between the command and the C so LateX can see you want \backslash followed by a C. You can use a space (ignored after a command name) or a brace group: \backslash{}C. Once that error is past, you will get several more errors: \backslash is a mathmode command, and \+ is undefined. What you want is something like \textit{C$\backslash$C++}, but the spacing is all wrong. Also, one usually uses a forward slash in combinations like this. Here are two possibilities, one using a backslash (with the spacing improved) and one with a forward slash:

\textit{C$\,\backslash\!$C++}
\textit{C/C++}

Combining Donut E. Knot's answer with Prettiest way to typeset “C++” (cplusplus)? gives the following answer:

\documentclass[preview,border=12pt]{standalone}% change it back to your own document class

\newcommand{\CC}{C\nolinebreak\hspace{-.05em}\raisebox{.4ex}{\tiny\bf +}\nolinebreak\hspace{-.10em}\raisebox{.4ex}{\tiny\bf +}}

\begin{document}
I love \texttt{C/\CC} but not \texttt{C\char`\\ \CC}.
\end{document}

Via The Endevor

I have no idea why the original posters code does not work.

• Because \backslashC is undefined control sequence as the error message aptly says :) – Khaled Hosny Nov 26 '13 at 5:52