3

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.

5
  • Do you really want to use << in text?
    – egreg
    Sep 30, 2021 at 16:57
  • @egreg yes I do Sep 30, 2021 at 16:58
  • And what would it mean? I can't think of a reason to. Can you please add an example?
    – egreg
    Sep 30, 2021 at 17:00
  • @egreg I don't understand your question. I quite simply need to write text where to greater-than signs follow one another in non-math mode, like>>this. It works fine on StackOverflow, I want this in a document. Sep 30, 2021 at 17:08
  • 2
    >\/> should work Sep 30, 2021 at 17:09

2 Answers 2

5

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}

enter image description here

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.

7
  • I got: ! Package microtype Error: Disabling ligatures of a font is only possible with pdftex version 1.30 or newer.. I'm using xetex. Sep 30, 2021 at 17:25
  • @DmitriNesteruk That was necessary information.
    – egreg
    Sep 30, 2021 at 17:27
  • Added to the description. Was not aware it would make a difference. Sep 30, 2021 at 17:30
  • @DmitriNesteruk I added the complicated way to cope with this. But I still think it's a wrong approach.
    – egreg
    Sep 30, 2021 at 17:36
  • 1
    @DmitriNesteruk Without seeing any “real world” case in which you may want to use << in text I can't say, but my feeling is that you don't really want it.
    – egreg
    Sep 30, 2021 at 20:11
1

You can use "much less than" and "much greater than".

example usage

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}

You must log in to answer this question.

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