TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I get mathematical symbols in verbatim mode? If I use them, for example \equiv, it is just reproduced as is in the pdf.

share|improve this question
It sounds like you don't really want verbatim (which means produce the output, erm, verbatim). What do you really want? – TH. Apr 21 '11 at 5:10
I want to include some code. For that I want to use the verbatim mode so that I dont have to do all the indentation, etc. And in that code, there are some symbols. What can I do? – n1kh1lp Apr 21 '11 at 5:11

You can use alltt, fancyvrb or listings package for this purpose.

For fancyvrb, see manual "4.1.16 Catcode characters". Example:

x=1/sqrt(z**2) ! $\frac{1}{\sqrt{z^2}}$

It is easier to use listings package, see manual "4.14 Escaping to LaTeX". Example:

// calculate $a_{ij}$
$a_{ij} = a_{jj}/a_{ij}$;
share|improve this answer

I think you might try the alltt package.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.