Avoid automatic replacement of << characters
If you want it globally you can use microtype:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{microtype}
\DisableLigatures[<]{encoding = T1}
\begin{document}
a << b
\end{document}
For locally disabling the ligature you have several methods:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}
a << b
a <{}< b
a {<}< b
a <\/< b
a <\textcompwordmark< b
\end{document}
I'd prefer the one with \/
, because it's engine independent; the same example (but with fontspec
) in LuaTeX
\documentclass{article}
\usepackage{fontspec}
\begin{document}
a << b
a <{}< b
a {<}< b
a <\/< b
a <\textcompwordmark< b
\end{document}
would give
because LuaTeX ignores braces when doing ligatures.
Of course, the best thing is to define a personal command, so you can modify the rendering without chasing the document for <\/<
:
\newcommand\textll{<\/<}
and
a \textll{} b
When somebody will tell you that some negative kerning must be applied between the less than symbols, you'll be happy of having preferred an abstract method.
Side note: this assumes the OT1 encoding is not used; with it the input <<
would not produce a ligature, but ¡¡ (two reverse exclamation marks); the ligature <<
for a left guillemet is only active in the T1 encoding (and possibly LY1) and, with fontspec
and (Xe|Lua)LaTeX, for fonts loaded with the Ligatures=TeX
option.
In the comments it was specified that this is actually bash source code. So LaTeX should know that it is bash source code. This can be done be using, e.g., the listings package:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{listings}
\lstset{basicstyle=\ttfamily}
\begin{document}
As listing:
\begin{lstlisting}[language=bash]
a << b
\end{lstlisting}
Inline:
\lstinline[language=bash]{a << b}
or
\lstinline[language=bash]/a << b/
\end{document}