Sunday, April 28, 2013

Loops in LaTex: from the "High Time" Department

Something I have done a billion times is take a basic list, then repeat it x times, each time coloring one item on the list, followed by slides that expand on the colored item. So it's high time I learned to do this programmatically! This uses the forloop package:

\newcounter{ctr}
\forLoop{1}{3}{ctr}{
\begin{frame}
\begin{itemize}
\item {\ifnum\thectr=1\color{red}\fi Dependency Parsing}
\item {\ifnum\thectr=2\color{red}\fi Situatedness}
\item {\ifnum\thectr=3\color{red}\fi Vision Both Directions}
\end{itemize}
\end{frame}

\ifnum\thectr=1 {
\begin{frame}{Dependency Parsing}
\end{frame}
}
\fi

\ifnum\thectr=2 {
\begin{frame}{Situatedness}
\end{frame}
}
\fi

\ifnum\thectr=3 {
\begin{frame}{Vision Both Directions}
\end{frame}
}
\fi

}
<\code>