How to get real braces in ttfont, in latex

In latex, you can type \verb|{| and get the real bracket in the typewriter font. But if you type {\tt \{ } , you will 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 a real, monospaced figure in tt environment? (I can't just nest verb because I need to change its color as well.)

+6
latex
source share
2 answers

Use T1 font encoding with

  \ usepackage [T1] {fontenc} 
+6
source share

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

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

Watch this . Seems to work for me.

+5
source share

All Articles