TransWikia.com

How can I print three greater-than symbols after each other (>>>)?

TeX - LaTeX Asked by User12547645 on March 17, 2021

I am using texttt to write my code snippets in Courier font including texttt{>>>}. If I compile, this is substituted to ». How can I prevent that from happening?

  • I am unable to escape with texttt{>>>}.

  • I do not want to use ggg of the amssymb package since that looks slightly different.

  • If possible I would also like to avoid using verb||.

2 Answers

This happens when you use the T1 encoding.

You can disable the ligature that maps >> to » with microtype. I also removed the ligature from << to « for symmetry. The first line shows that the ligatures are not suppressed altogether, but only when using the monospaced font.

documentclass{article}
usepackage[T1]{fontenc}
usepackage{courier}
usepackage{microtype}

DisableLigatures[<,>]{encoding=T1,family=tt*}

begin{document}

<<This is quoted>>

texttt{>>>}

texttt{<<<}

end{document}

enter image description here

Correct answer by egreg on March 17, 2021

The addition of a group around the central > will prevent each from seeing the others, and therefore should prevent (for lack of a better word) the ligature from forming.

Note: See comments to this answer, which are very illuminating, which explains why this technique will work in pdflatex but not lualatex!

documentclass{article}
usepackage[T1]{fontenc}
usepackage[french]{babel}
begin{document}
texttt{>{>}> versus >>>}
end{document}

enter image description here

Answered by Steven B. Segletes on March 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP