How can I print \n, \t, \v and so on in LaTeX document? I mean I want in my output two chars: \n not a new line.
I tried:
\\n\verb!\\n!
With no effects...
Use the first version.
Both the I and II version show other ways which are unnecessary complex (and exploit certain TeXnicalities).
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\newcommand*{\escape}[1]{\texttt{\textbackslash#1}}
\newcommand*{\escapeI}[1]{\texttt{\expandafter\string\csname #1\endcsname}}
\newcommand*{\escapeII}[1]{\texttt{\char`\\#1}}
\begin{document}
We escape \escape{n}, \escape{t} and \escape{v}.
We escape \escapeI{n}, \escapeI{t} and \escapeI{v}.
We escape \escapeII{n}, \escapeII{t} and \escapeII{v}.
We escape \verb!\n!, \verb!\t! and \verb!\v!
\end{document}

\textbackshlash nworks. This can be wrapped inside\texttt{\textbackslash n}.\verb!\n!should also work, but not in a parameter of a macro. (Also\string\nexists.)\\is already reserved for many “new line” purposes. If you often use these things, create a new macro:\newcommand*{\escape}[1]{\texttt{\textbackslash #1}}which you can use then as\escape{n}. – Qrrbrbirlbel Apr 15 '13 at 15:25\verb"\n"rather than\verb!\n!? The former works for me… – MickG Sep 19 '14 at 17:39