6

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.)

Peter
  • 127,331
  • 53
  • 180
  • 211

2 Answers2

6

Use the T1 font encoding with

\usepackage[T1]{fontenc}
Nietzche-jou
  • 14,415
  • 4
  • 34
  • 45
  • Nice. I like your answer better. +1. – Alok Singhal Feb 26 '10 at 05:33
  • 1
    @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 Feb 26 '10 at 06:02
5

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

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

See this. Seems to work for me.

Alok Singhal
  • 93,253
  • 21
  • 125
  • 158
  • 2
    For the record, the right curly brace is character 175. So this is the complement: `newcommand{\rcb}{{\tt {\char '175}}}` – drhagen Apr 03 '14 at 14:51