I am currently writing out an introduction to LaTeX file for some coworkers. How would I insert \[ \] as regular text and not starting math mode?
FYI: The reason why I'm asking this is because I plan on surrounding them with \texttt.
I am currently writing out an introduction to LaTeX file for some coworkers. How would I insert \[ \] as regular text and not starting math mode?
FYI: The reason why I'm asking this is because I plan on surrounding them with \texttt.
Figured it out thanks to the comment by Sigur.
\verb#\[# \verb#\]#
or alternatively, thanks to Sigur as well,
\verb+\[ \]+.
I read this question previously, which seemed to suggest to me that I always needed to use texttt, but it looks like I was wrong.
\verb when the content has some special chars (for example, braces, dollar signs, etc...
– Sigur
Jul 25 '14 at 16:49
Since you mention "inline", I will point out that \verb will not break across lines. However, if that is needed, then this approach, using \detokenize could work if you don't have unbalanced braces, and if you don't need to print % or # signs in the string.
\documentclass{article}
\usepackage[T1]{fontenc}
\begin{document}
\texttt{\detokenize{\[ This is a test this is a test this is a test
This is a test this is a test this is a test \]}}
\end{document}

fontenc is not needed in this example, but would be if you wanted to print out the result in anything other than \texttt.
verbatimwill not work. – Clarinetist Jul 25 '14 at 16:40\verb. – Sigur Jul 25 '14 at 16:40