tags:

views:

151

answers:

2

In latex, you can type \verb|{| and get a real brace in a typewriter font. But if you type {\tt \{ }, you get a sans-serif replacement. In code:

\verb|{|    % nice, real brace.
{\tt \{ }   % hideous fake brace.

LaTeX Font Warning: Font shape `OMS/lmtt/m/n' undefined
(Font)              using `OMS/cmsy/m/n' instead
(Font)              for symbol `textbraceleft' on input line 3.

How do you get the real, monospaced brace in a tt environment? (I can't just nest verb, because I need to change its color as well.)

+1  A: 

You can try {\tt {\char '173}}:

\newcommand{\lcb}{{\tt {\char '173}}}

See this. Seems to work for me.

Alok
perfect, thank you so much.
Peter
@Peter: am deleting my answer since the other answer is definitely better.
Alok
+2  A: 

Use the T1 font encoding with

\usepackage[T1]{fontenc}
Cirno de Bergerac
Nice. I like your answer better. +1.
Alok
@Alok, this might be cleaner, but your answer is a helpful alternative too, esp. if there are any incompatibilities with the `fontenc` package etc. I'd recommend returning it...
Peter