Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Following Outlined characters, you can make selectable outlined text using the contour package. For example, the following writes "Text text text contour text", with "contour" in green with a red outline. It compiles and displays as expected (using pdflatex and lualatex):

\documentclass[12pt]{article}
\usepackage[outline]{contour}
\begin{document}
Text text text \contour{red}{\textcolor{green}{contour}} text.
\end{document}

However, when I try to do the same in a Beamer presentation—

\documentclass{beamer}
\usepackage[outline]{contour}
\begin{document}
\begin{frame}{Example}
Text text text \contour{red}{\textcolor{green}{contour}} text.
\end{frame}
\end{document}

—it fails to compile, with the error

! Use of \\@contour doesn't match its definition.
\beamer@ifnextcharospec #1#2->\def \reserved@a {
                                                #1}\def \reserved@b {#2}\fut...
l.14 \end{frame}

? 

How can I use the outline effect in a Beamer presentation?

share|improve this question

1 Answer 1

up vote 6 down vote accepted

Prolog

Apparently, beamer redefines \textcolor in a way that makes it fragile.

If you \usepackage{beamerarticle} in your article MWE, you experience the same problems as with beamer.

Long answer

What is the difference between Fragile and Robust commands?

Short answer

Use

  • \contour{<color>}{\protect\textcolor{<color>}{<text>}} or
  • \textcolor{<color>}{\contour{<color>}{<text>}}.

Code

\documentclass{beamer}
\usepackage[outline]{contour}
\begin{document}
\begin{frame}{Example}
Text text text \contour{red}{\protect\textcolor{green}{contour}} text. \\
Text text text \textcolor{green}{\contour{red}{contour}} text.
\end{frame}
\end{document}

Output

Output

share|improve this answer
    
That does work. Any idea why the error occurs though, and why only with Beamer? –  Mechanical snail Oct 20 '12 at 1:28
    
@Mechanicalsnail I've updated my answer which now, hopefully, gives more insight. –  Qrrbrbirlbel Oct 20 '12 at 1:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.