I want the following line inside a *.tex file to be printed \"as is\":
while (tmp[0] == \'\\r\' || tmp[0] == \'\\n\') {tmp++;}
When I wrap it i
To print an actual backslash in LaTeX you use the command \backslash
, so for your code:
while (tmp[0] == '\backslash r' || tmp[0] == '\backslash n') {tmp++;}
EDIT: I forgot you need this command in math mode. If you want everything "as is", this is the code you need (for the vertical lines and the curly brackets as well):
while (tmp[0] == `$\backslash$r' $\|$ tmp[0] == `$\backslash$n') $\{$tmp++;$\}$