0

Angle brackets < and > in \texttt render as inverted exclamation mark and inverted question mark (spanish punctuation marks):

\documentclass{article}
\usepackage{beramono}
\begin{document}
\texttt{<>}
\end{document}

The above document renders the < and > characters as:

enter image description here

How do I fix this?

1

2 Answers 2

7

The Bera Mono fonts are not available in OT1 encoding, but only in T1; if you want to use them for typewriter type, you need \usepackage[T1]{fontenc}.

This should be clear from the shown warnings

LaTeX Font Warning: Font shape `OT1/fvm/m/n' undefined
(Font)              using `OT1/cmr/m/n' instead on input line 4.

Correct example

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{beramono}
\begin{document}
\texttt{<>}
\end{document}

enter image description here

2
  • I wanted to avoid T1 font encoding, because I thought it messed up copy-paste from the PDFs. After testing your answer, copy-paste (and the brackets) both seem to work fine, so my former issues must have been caused by something else. Commented Feb 10, 2016 at 17:29
  • FYI: I get this behaviour in an English document (not with beramono) without any warnings. \usepackage{[T1]{fontenc} fixed it.
    – drevicko
    Commented Feb 11, 2020 at 6:59
0

Short answer: You have to also use the package lmodern:

\documentclass{article}
\usepackage{beramono}
\usepackage{lmodern}
\begin{document}
\texttt{<>}
\end{document}

See Why do the less than symbol (<) and the greater than symbol (>) appear wrong as upside down exclamation (¡) or question mark (¿)? and "Greater than" sign shows up as inverted question mark for more details.

1
  • Well, you don't get Bera Mono as the typewriter font.
    – egreg
    Commented Feb 10, 2016 at 16:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .