Seem that, by default, my LaTeX installation turns <<
into « and, similarly, >>
into ». How can I prevent this so that two less-than/greater-than signs are kept?
For the record, I'm using xetex.
If you want to completely disable the ligatures <<
and >>
, you can use microtype
\documentclass{article}
\usepackage[T1]{fontenc}
%\usepackage[T2A]{fontenc}
\usepackage{microtype}
\DisableLigatures[<,>]{encoding=*}
\begin{document}
<<>>
\end{document}
For a one off case, type in <\/<
.
For XeLaTeX the thing is a bit more complicated.
Find on your system the file tex-text.map
. Copy it in a working directory as noguillemets.map
. Open it and comment out (with semicolons as indicated below) the last two lines.
; TECkit mapping for TeX input conventions <-> Unicode characters
LHSName "noguillemets" ; was TeX-text
RHSName "UNICODE"
pass(Unicode)
; ligatures from Knuth's original CMR fonts
U+002D U+002D <> U+2013 ; -- -> en dash
U+002D U+002D U+002D <> U+2014 ; --- -> em dash
U+0027 <> U+2019 ; ' -> right single quote
U+0027 U+0027 <> U+201D ; '' -> right double quote
U+0022 > U+201D ; " -> right double quote
U+0060 <> U+2018 ; ` -> left single quote
U+0060 U+0060 <> U+201C ; `` -> left double quote
U+0021 U+0060 <> U+00A1 ; !` -> inverted exclam
U+003F U+0060 <> U+00BF ; ?` -> inverted question
; additions supported in T1 encoding
U+002C U+002C <> U+201E ; ,, -> DOUBLE LOW-9 QUOTATION MARK
;U+003C U+003C <> U+00AB ; << -> LEFT POINTING GUILLEMET
;U+003E U+003E <> U+00BB ; >> -> RIGHT POINTING GUILLEMET
Now run from a shell
teckit_compile noguillemets
which will produce a file noguillemets.tec
.
Now load your fonts as follows
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Latin Modern Roman}[Mapping=noguillemets]
\begin{document}
<<>>
\end{document}
and the output will be the same as before.
Place noguillemets.tec
in some place where XeTeX will find it; on a TeX Live system it should be
/usr/local/texlive/texmf-local/fonts/misc/xetex/fontmapping/
(create the necessary directories). Run mktexlsr
.
If you use plain XeTeX, use noguillemets
where you would use tex-text
.
! Package microtype Error: Disabling ligatures of a font is only possible with pdftex version 1.30 or newer.
. I'm using xetex.
Commented
Sep 30, 2021 at 17:25
<<
in text I can't say, but my feeling is that you don't really want it.
You can use "much less than" and "much greater than".
MWE
\documentclass{article}
\usepackage{graphicx}
\newcommand\mapsfrom{\reflectbox{$\mapsto$}\ }
\usepackage{fontspec}
\setmainfont{Noto Serif}[Ligatures=TeX]
\usepackage{pst-uml}
\newcommand\acmd[1]{\textbackslash \texttt{#1}}
\begin{document}
xyz
<<xyz>> \mapsfrom ligatures on
<\/<xyz>\/> \mapsfrom ligatures blocked
\umlStereoType{xyz} \mapsfrom uses \acmd{umlStereoType} command from \verb|pst-uml| package, defined as:
\begin{verbatim}
\newcommand{\umlStereoType}[1]{%
{\footnotesize\ensuremath{\ll}}\textsf{#1{\footnotesize\ensuremath{\gg}}%
}
\end{verbatim}
$\ll$xyz$\gg$ \mapsfrom uses mathmode \acmd{ll} and \acmd{gg}
\end{document}
<<
in text?>\/>
should work