1

I'm trying to list some code using the listings package, however if use ttfamily font, brackets don't render correctly. This is what it looks likeenter image description here

5
  • Welcome to TeX.SE! Please show us a short compilable TeX code resulting in your screenshot ...
    – Mensch
    Nov 5, 2021 at 10:56
  • If you're using pdflatex try adding \usepackage[T1]{fontenc}
    – daleif
    Nov 5, 2021 at 11:07
  • Thanks @daleif, that fixed it! Nov 5, 2021 at 11:14
  • @user5753059 I've added it as an answer
    – daleif
    Nov 5, 2021 at 11:21
  • I cannot reproduce the issue. You must have some strange setting. Please, add a minimal example of code that produces the issue.
    – egreg
    Nov 5, 2021 at 15:03

1 Answer 1

1

First of please always post a full minimal example others can copy and test as is.

It is a known fact that <> used in text gives ¡ and ¿ if running under pdflatex and without \usepackage[T1]{fontenc} as the default font encoding OT1 performs many loops.

Thus for pdflatex the solution is to add

\usepackage[T1]{fontenc}

to your preamble.

1
  • Sorry about that, however I tried looking for this specific issue but nothing came up (perhaps I wasn't searching with the right words) Nov 5, 2021 at 13:17

You must log in to answer this question.

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