While writing in LaTeX, I happened to type something like “$ variable = test” as a text. However, LaTeX said something like: Missing $ ..
I tried putting \ before the $ and other math symbols, but it still messed up the shape of the text.
My question is: how can I instruct LaTeX that this whole paragraph or sentence, is pure text, and no math in it?
Also, away from this, when I try adding the symbol ” | ” it shows it as double underscore ” __ “. How to solve this?
Thanks!
You can use
\textdollar{}to insert a text dollar. (Though\$ought to work too; and I’m not sure why it doesn’t for you.) And you can specify that something should be reproduced verbatim, and typeset in a tt font, by using\verband the same character to surround it, e.g.\verb+|+or\verb=$=.The real issue here seems to be that you’re typesetting some code in LaTeX: for this, use package
listings, or one of the other packages for code listings.