Jak uniknąć ligatur podwójnie mniej równego znaku w lateksie
Nov 23 2020
W moim artykule mam wiele fragmentów kodu C ++. Po prostu zobacz poniższą zawartość tekstową, a zrozumiesz, o co mi chodzi.
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{xspace}
\NewDocumentCommand{\code}{m}{\texttt{{#1}}}
\begin{document}
My code is \code{cout << hello << world;}\\
But I wish it looks like \verb|cout << hello << world;|
\end{document}
Innym jest «
i <<
.
Jak mogę uniknąć ligatur w moim \code
makrze.

Odpowiedzi
3 Rmano Nov 23 2020 at 15:58
Możesz użyć, microtype
jak pokazano w Jak wyłączyć ligatury? :
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{xparse}% not needed in recent kernels
\usepackage{xspace}
\usepackage{microtype}
\DisableLigatures{encoding=T1, family=tt*}
\NewDocumentCommand{\code}{m}{\texttt{{#1}}}
\begin{document}
My code is \code{cout << hello << world;}
But I wish it looks like \verb|cout << hello << world;|
Normal ff and ffi ligatures still here.
\end{document}
