Document Classesbeamer alltt in color

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
basile starynkevitch
Posts: 2
Joined: Sun Oct 11, 2009 12:40 pm

beamer alltt in color

Post by basile starynkevitch »

Hello All

(This is my first post).

I am preparing slides for pdflatex and beamer (on Linux/Ubuntu/Karmic) on my MELT. So I need to show both C code fragments and Lisp-like cod fragments. I am using the alltt package (I don't want to change that to e.g. listings, because I have many examples in an LLNCS paper submission), and I want to show in different colors C code and Lisp code.

So I have code like

Code: Select all

\documentclass[svgnames]{beamer}
\usepackage{alltt}
\newenvironment{mycfrag}{\color{DarkMagenta}\begin{alltt}}{\end{alltt}}
in my preamble, and then later in the slides

Code: Select all

\begin{mycfrag}
\textbf{struct} \{ melt\_t objclass;
  ushort objnum, objlent;
\end{mycfrag}
And my issue is that while the color is indeed set, the alltt does not seems to work anymore: a newline in the source is not translated into a newline in the slides.

Any clues?

Respectful regards.

Basile Starynkevitch

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

basile starynkevitch
Posts: 2
Joined: Sun Oct 11, 2009 12:40 pm

beamer alltt in color

Post by basile starynkevitch »

Solved with

Code: Select all

\begin{frame}[containsverbatim]
Regards.
Post Reply