Text Formattingmathematical symbols in verbatim

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
dikarus
Posts: 1
Joined: Wed Mar 04, 2009 12:04 am

mathematical symbols in verbatim

Post by dikarus »

Is it possible to make a mathematical symbol being displayed inside a verbatim environment without affecting the other "verbatim" symbols?

For instance if I use:

\begin{Verbatim}[commandchars=\\\{\},
codes={\catcode`$=3\catcode`^=7}]

param rate {PROD, STAGE} > 0;
#rate[p,s] $\equiv r\sb{ps}^i$

\end{Verbatim}

the mathematical symbol is displayed correctly but
{PROD, STAGE} is displayed without the {}!

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

mathematical symbols in verbatim

Post by gmedina »

Hi,

you can use

Code: Select all

\{PROD, STAGE\}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply