1

I want to mention a Perl variable name within a TeX file for PDF-ing (via pdflatex). Masking the dollar sign malfunctions with:

   log-file:
   ! Missing $ inserted.
   <inserted text> 
                $
   l.7    \item \textit{\$fmt_line_req}
                                    , d.i. eine den User-W\"unschen angepa\s...
   I've inserted a begin-math/end-math symbol since I think
   you left one out. Proceed, with fingers crossed.

The MWE:

  \documentclass[a4paper,10pt]{article}
  \usepackage[utf8]{inputenc}

\begin{document}

%\begin{enumerate} % \item \textit{$fmt_line_req}, d.i. eine den User-W&quot;unschen angepa\ss{}te Formatzeile % \item \textit{$head_line_req}, d.i. die Spaltenk&quot;opfe wunschgem&quot;a\ss{} % \item \textit{$content_req}, d.i. die Tabellenzeilen mit w.o. gew&quot;unschter Spaltenpositionierung %\end{enumerate}

\begin{enumerate} \item \textit{[%spaltenformatierung%]}, d.i. eine den User-W&quot;unschen angepa\ss{}te Formatzeile \item \textit{[%spaltenueberschriften%]}, d.i. die Spaltenk&quot;opfe wunschgem&quot;a\ss{} \item \textit{[%content%]}, d.i. die Tabellenzeilen mit w.o. gew&quot;unschter Spaltenpositionierung \end{enumerate}

\end{document}

The masking of % is ok! So, is there a solution to get the dollar sign in this environment?

The following output is only possible if dollar sign lines are commented. The \textit format is what I want. But I need itemize/enumerate lines with the dollar sign in same manner.

  1. [%spaltenformatierung%], d.i. eine den User-Wunschen angepate Formatzeile

  2. [%spaltenueberschriften%], d.i. die Spaltenkopfe wunschgema

  3. [%content%], d.i. die Tabellenzeilen mit w.o. gewunschter Spaltenpositionierung

gizeh
  • 491

1 Answers1

1

The characters $ & % # _ { and } are special in LaTeX and can be printed by preceeding them with a \ . Here is a version of your MWE that works.

% dollarprob.tex SE 517582 dollar sign
  \documentclass[a4paper,10pt]{article}
  \usepackage[utf8]{inputenc}
  \begin{document}

  \begin{enumerate}
     \item \textit{\$fmt\_line\_req}, d.i. eine den User-W\"unschen angepa\ss{}te Formatzeile
     \item \textit{\$head\_line\_req}, d.i. die Spaltenk\"opfe wunschgem\"a\ss{}
     \item \textit{\$content\_req}, d.i. die Tabellenzeilen mit w.o. gew\"unschter Spaltenpositionierung
  \end{enumerate}

  \begin{enumerate}
     \item \textit{[\%spaltenformatierung\%]}, d.i. eine den User-W\"unschen angepa\ss{}te Formatzeile
     \item \textit{[\%spaltenueberschriften\%]}, d.i. die Spaltenk\"opfe wunschgem\"a\ss{}
     \item \textit{[\%content\%]}, d.i. die Tabellenzeilen mit w.o. gew\"unschter Spaltenpositionierung
  \end{enumerate}

  \end{document}

There are three other special characters (^ ~ ) that can be printed using \verb.

Peter Wilson
  • 28,066