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.

  • Read about verbatim.
    – Sigur
    Jul 25, 2014 at 16:40
  • I need it to be inline, so verbatim will not work. Jul 25, 2014 at 16:40
  • 3
    So read about \verb.
    – Sigur
    Jul 25, 2014 at 16:40

2 Answers 2


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.

\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 \]}}

enter image description here

fontenc is not needed in this example, but would be if you wanted to print out the result in anything other than \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.

  • 1
    You don't need to use it twice: verb+\[ \]+ also works.
    – Sigur
    Jul 25, 2014 at 16:47
  • Use \verb when the content has some special chars (for example, braces, dollar signs, etc...
    – Sigur
    Jul 25, 2014 at 16:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .