Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How do I print a $ inside \tt?

I tried escaping with a backslash, but didn't work.

\tt{\$}

throws an error.

! Argument of \OT1\^ has an extra }

Update

Sorry, the issue was not with $, but with ^ in the next line.

Used \textasciitilde and everything worked fine.

share|improve this question
2  
Welcome to TeX.SE. I assume that your userid is a Star Trek reference. :-) –  Peter Grill Feb 5 '13 at 8:20
1  
@PeterGrill I never knew there was atoztoa in Star Trek... please enlighten me –  ATOzTOA Feb 5 '13 at 8:24
    
It thought that your userid was as reference to "Mr Atoz" from All Our Yesterdays –  Peter Grill Feb 6 '13 at 2:26
    
@PeterGrill nah... I am not a fan... –  ATOzTOA Feb 6 '13 at 4:11
add comment

2 Answers 2

up vote 6 down vote accepted

\tt is a switch, not a commmand with argument. Also it is obsolete. Nevertheless it works fine, and your problem is somewhere else. Make a complete example instead of sending code snippets.

\documentclass{article}
%not necessary but better
\usepackage[T1]{fontenc}
\begin{document}
\ttfamily \$
\tt \$ %obsolete command
\verb+$+
\texttt{\$}
\end{document}
share|improve this answer
    
Thanks a lot... –  ATOzTOA Feb 5 '13 at 8:22
add comment

First of all, I would advise you to use \texttt instead of \tt. See Does it matter if I use \textit or \it, \bfseries or \bf, etc. \texttt is the LaTeX equivalent of the Plain TeX \tt. If in Plain TeX, you write {\tt \$} and it should work. You have to enclose \tt in braces {} to make the typewriter type effect local to the text inside braces. In LaTeX, you write \texttt{\$} instead.

share|improve this answer
    
thanks for the update... I am a little rusty... –  ATOzTOA Feb 5 '13 at 8:23
add comment

Your Answer

 
discard

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.