[OS X TeX] Coloring a line in listings environment

David Arnold dwarnold45 at suddenlink.net
Thu Nov 11 06:23:28 CET 2010


All,

I have:

\documentclass{beamer}
%\documentclass[handout]{beamer}
\usetheme{CambridgeUS}
\usepackage{tikz}
\usepackage{listings}
\usepackage{amsmath,amssymb}

%\usepackage{pgfpages}
%\pgfpagesuselayout{4 on 1}[letterpaper,landscape]


\title{Using TIKZ}
\author{David Arnold}
\institute[CR]{
  College of the Redwoods \\
  Department of Mathematics
}
\date{November 20, 2010}

\begin{document}

\begin{frame}
\titlepage
\end{frame}

\lstset{language=[LaTeX]TeX,
	keywordstyle=\color{blue},
	commentstyle=\color{red},
	frame=single}

\lstset{classoffset=0,
	morekeywords={subject, maketitle},
	keywordstyle=\color{blue}}


\begin{frame}[fragile]
\frametitle{Using Tikz}
Create a new file and save it as \verb+workshop4.tex+. Enter the following lines.
\medbreak

\begin{lstlisting}[escapeinside=!~]
\documentclass{article}
\usepackage[nosolutions,pointsonleft]{eqexam}
\usepackage{amsmath}
\usepackage{tikz}
\title{Exam \#2A}
\subject{Math 120}
\author{David Arnold}
\date{November 20, 2010}

\begin{document}
\maketitle
\end{document}\end{lstlisting}

\medbreak

\noindent Compile \verb+workshop4.tex+.

\end{frame}


\end{document}

I'd like to color one line in the code completely in red. I tried this and it worked>

!\color{red}\verb+\usepackage{tikz}+~

But the font changes. Anyone have a suggestion how I could just color this line in red, keeping the same font?

D.


More information about the macostex-archives mailing list