How can I stop LaTeX from converting two hyphens to a single hyphen when loading package fontenc?
--
is a so-called TeX-Ligature which is converted into the n-dash. -{}-
breaks this combination.
\documentclass[letterpaper]{article}
\usepackage[T1]{fontenc}
\begin{document}
A hyphen: \texttt{-}
Two hyphens: \texttt{-{}-}
Three hyphens: \texttt{-{}-{}-}
\end{document}
or define own macros for this
This approach didn't work for me in the bibliography, if you have the same problem simply insert one of the phantom commands:
@article{Foo,
title = {Hello -\phantom{}- World},
}
This will work as desired.
For me, -{}-
is not working for breaking the ligature in --
. The trick -\phantom{}-
works, but it is a bit wordy. I found that the command for the italic correction could be the best choice in this particular case: this -\/-
works for me in every case.
Please see difference between {} and / for breaking ligatures for further details.