Text FormattingDash Formatting in verbatim Text

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Jaraqui
Posts: 26
Joined: Wed Feb 08, 2012 3:54 am

Dash Formatting in verbatim Text

Post by Jaraqui »

Hi,
I need to write a decrement "i--" in the middle of a text.
I can´t simply type "i--", because the "--" becomes a medium dash.

I tried to use this:

Code: Select all

 i\verb'--' 
The results were:
  1. a pdf was generated, but an error message too:
    Missing } inserted
  2. it showed i--' (I don´t want this ' char).
What´s wrong? Which solution is more appropriate?


Regards
Jaraqui

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Dash Formatting in verbatim Text

Post by Stefan Kottwitz »

Hi Jaraqui,

simply type:

Code: Select all

i-{}-
Also

Code: Select all

i{-}-
and similar versions would work, using braces to prevent the ligature. The \verb version would work, but would change the font.

Stefan
LaTeX.org admin
Jaraqui
Posts: 26
Joined: Wed Feb 08, 2012 3:54 am

Re: Dash Formatting in verbatim Text

Post by Jaraqui »

Fine!

Thanks aagain!
Jaraqui
Post Reply