Text FormattingFrame around alltt in listing

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
sladicg
Posts: 7
Joined: Mon Dec 21, 2009 2:42 pm

Frame around alltt in listing

Post by sladicg »

Hi!
Does anyone know how to add frame around alltt section. I need to use alltt because I'm using math expressions.

In the listing without math expressions I use Verbatim like this:

Code: Select all

\usepackage{listing}
...
\begin{listing}
\begin{Verbatim}[resetmargins=true, frame=single]
  Somn text without math
\end{Verbatim}
\caption{Caption 1}
\label{lst:Caption1}
\end{listing}
But in listing with math I use following code, which doesn't create frame around it. ([resetmargins=true, frame=single] won't work with alltt)

Code: Select all

\usepackage{listing}
...
\begin{listing}
\begin{alltt}
  Somn text with math
\end{alltt}
\caption{Caption 1}
\label{lst:Caption1}
\end{listing}
Thanks in advance,
Goran

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Post Reply