Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get real braces in ttfont, in latex

Tags:

latex

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

like image 756
Peter Avatar asked Feb 26 '10 05:02

Peter


2 Answers

Use the T1 font encoding with

\usepackage[T1]{fontenc}
like image 136
Nietzche-jou Avatar answered Nov 01 '22 16:11

Nietzche-jou


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

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

See this. Seems to work for me.

like image 35
Alok Singhal Avatar answered Nov 01 '22 16:11

Alok Singhal