Skip to content

Include and exclude latex-beamer frames

For my slides i sometimes want to disable parts of the presentation, as example: if the operating system is Linux, i don't need Solaris installation instructions. The \ifthenelse{<condition>}{...true...}{...false...} from the ifthen package works very well for normal frames, but it fails, if there are examples (verbatim environment) in the code.

In such a case \iftrue and \iffalse are much more lazy than \ifthenelse and compiling the examples results no longer in latex parser errors. The downside of this solution: i need to predefine the condition, but in my case i have them in a separate file anyway.

The definition looks like:

\newboolean{usesolaris}
\ifthenelse{\equal{\targetos}{solaris}}{
  \setboolean{usesolaris}{true}
}{
  \setboolean{usesolaris}{false}
}

I have defined the variable \targetos, which contains a string with the currently used platform name for my presentation. If the string matches "solaris", the boolean \usesolaris is set to "true", else to "false". Latex compiles the "\ifusesolaris" definition from the boolean, which i later can use to include or exclude frames:

\ifusesolaris
\begin{frame}[fragile]
  ... frame content
\end{frame
}
\fi

In addition, it is also possible to add code for the case where \usesolaris is false. Just add \else and the code before \fi.

  • Twitter
  • Bookmark Include and exclude latex-beamer frames at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Include and exclude latex-beamer frames
  • Bloglines Include and exclude latex-beamer frames
  • Technorati Include and exclude latex-beamer frames
  • Fark this: Include and exclude latex-beamer frames
  • Bookmark Include and exclude latex-beamer frames at YahooMyWeb
  • Bookmark Include and exclude latex-beamer frames at Furl.net
  • Bookmark Include and exclude latex-beamer frames at reddit.com
  • Bookmark Include and exclude latex-beamer frames at blinklist.com
  • Bookmark Include and exclude latex-beamer frames at Spurl.net
  • Bookmark Include and exclude latex-beamer frames at Simpy.com
  • Bookmark Include and exclude latex-beamer frames at blogmarks
  • Bookmark Include and exclude latex-beamer frames with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

No comments

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
To leave a comment you must approve it via e-mail, which will be sent to your address after submission.
Form options