The alltt package provides a beefed up verbatim environment where \ and {} are not treated literally. A literal backslash can be inserted with \textbackslash, however, it does not have the same teletype font as the rest of the verbatim text. I tried some variataions such as \texttt{\textbackslash} but these don't seem to help. Any ideas how to insert a backslash (or curly braces) in teletype font when using alltt?
|
|
|||
|
|
|
This has nothing to do with alltt. You need T1-encoding. Without it \textbackslash is taken from the symbol font. Check the difference:
|
|||||||||||
|
|
In addition, you don't have to use You can use
to get
After all, it is a good manner to use |
|||
|
|
|
while the suggestions to use a different encoding are good, this technique should work anywhere to get a monospace symbol if it's in the font being used. preface the input character by
so that a backslash, open and close brace would be input as
this is built into TeX itself, not defined by any particular "flavor" such as LaTeX or ConTeXt. EDIT: the |
|||||||||||||
|