General ⇒ Verbatim-like environment
-
- Posts: 47
- Joined: Wed Nov 11, 2009 9:30 pm
Verbatim-like environment
Are there any other things I need to look out for that I can't include in ifthenelse?
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
-
- Posts: 47
- Joined: Wed Nov 11, 2009 9:30 pm
Re: Verbatim-like environment
The basic listings example doesn't work ("Package Listings Warning: Text dropped after begin of listing on input line 19.", compilation stops):
\documentclass[11pt]{article}
\newcounter{thenum}
\setcounter{thenum}{1}
\usepackage{listings}
\usepackage{ifthen}
\begin{document}
\ifthenelse{\arabic{thenum}=1}{
\begin{lstlisting}
for i:=maxint to 0 do
begin
{ do nothing }
end;
Write(’Case insensitive ’);
WritE(’Pascal keywords.’);
\end{lstlisting}
}{}
\end{document}
Verbatim-like environment
Code: Select all
\documentclass[11pt]{article}
\newcounter{thenum}
\setcounter{thenum}{1}
\usepackage{listings}
\usepackage{ifthen}
\begin{document}
\ifnum\value{thenum}=1
\begin{lstlisting}
for i:=maxint to 0 do
begin
{ do nothing }
end;
Write(’Case insensitive ’);
WritE(’Pascal keywords.’);
\end{lstlisting}
\fi
\end{document}