[texhax] verbatim environment problem

Barbara Beeton bnb at ams.org
Mon Feb 19 19:18:28 CET 2007

from don gingrich:
    > I'm writing an explanatory text about Bourne shell scripting.
    > I need to be able to use a lot of control characters in
    > text I'm writing. I can usually get it to work but this has me
    > stumped. Any suggestions gratefully apreciated.
    > \begin{alltt}
    > 	ls .[^.]*
    > \end{alltt}
    > }}

from justin walker:

    Martin may have the more correct answer (I haven't tried it).

    Note that the 'uparrow' is a math symbol, so (La)TeX expects it to be  
    in a "math environment". Thus, as a simpler change, to avoid the  
    error, there are two approaches (the second being the one you want, I  
    think; but try them both):

    ls .[$^$.]*


    ls .[$\uparrow$.]*

right diagnosis, inadequate solution.

since the ^ indicates a superscript, the first
suggestion will yield a complaint that it's
incomplete.  and the \uparrow isn't the same

here's a (plain tex) trick to get a character
"to print as itself" in a tt mode:

  ls .[\char`\^.]*

just precede the character in question with the
string "\char`\"; it even works with backslashes.
							-- bb

More information about the texhax mailing list