# How to write this: “------------------\r\n“

When I try to write the above expression I get an error stating: "Undefined control sequence".

The same when I try to write this: ‘\r\n’.

Any ideas?

• You should add more proper data to what you have done so far.. Jun 2 at 7:59
• Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. For future questions, it might help to explain a bit what you're doing and why. For example, I agree with Fran that it looks like you're trying to typeset code of some sort, in which case there are a few package that make that go much easier. Jun 2 at 12:48

Any character sequence (word or single character) preceded by a backslash (\<whatever>) is a command (=control sequence) in LaTeX, but whereas \r is defined (to type characters as \r{a}), \n has not a predefined function (is "undefined"), so your alternatives to remove the error are type it verbatim (\verb|\n|) or as plain text (\textbackslash n), or
defining it to make something, i.e., make a LaTeX macro:

\newcommand\n{\textbackslash n}
\n


If what you show is part of a code listing, then you should consider use a verbatim environment:

\begin{verbatim}
----------\n\t
\end{verbatim}


Or use some package for powered verbatim typesetting or syntax highlight.

You may use \textbackslash{} to printout the \ character without a problem.

\texttt{--------------\textbackslash{r}\textbackslash{n}}