How to output -- in Latex. When I use it directly, it will only show a -. I added transliterated characters in front, but they all reported errors.

When I put it in a mathematical environment, it becomes lscpu − −extend.



1 Answer 1

% https://tex.stackexchange.com/questions/621751


    \item -- (\texttt{-\,-}) % You do not want that.
    \item -\,- (\texttt{-\textbackslash,-}) % Maybe better.
    \item -\kern 0pt- (\texttt{-\textbackslash kern 0pt-}) % Maybe better.
% See also https://tex.stackexchange.com/questions/74353
% and https://tex.stackexchange.com/questions/53413.


enter image description here

Update: I found a related question: How do I prevent LaTeX from creating en-dash and em-dash?. Especially the answer of Werner seems to be suitable for your situation.

enter image description here

  • It works! Thanks
    – Yujie
    Nov 8, 2021 at 1:37
  • 1
    @Yujie If the answer solved the problem then please accept the answer by clicking the checkmark next to the answer. Then the Q&A format is completed. Nov 8, 2021 at 1:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.