# How do I make frame environment play nice with \textbf?

I am getting a strange error message when I put textbf into a frame environment.

Minimal Example

\documentclass{article}
\listfiles

\begin{document}

\begin{frame}
\textbf{Lemma 1}

\end{frame}

\end{document}


Error Message:

! Missing number, treated as zero.
}
l.8 \textbf
{Lemma 1}


When I comment out the \textbf, the file compiles fine. When I use \textbf normally, the file also compiles fine.

Note: I am using pdflatex on Linux.

-
It appears that it works fine with {\bf Lemma 1} instead, but that does not answer the original question. –  merlin2011 Feb 7 '13 at 5:49

I'm not sure whether you want to use beamer's frame environment, or LaTeX's \frame command (which I haven't even known before:). If the former is the case, you're not loading the beamer class! If the latter: \frame is a command, not an environment. It takes only one argument: in your case, this will be a lone \textbf --- thus the error.

Thus, either:

\documentclass{beamer}


or:

\frame{\textbf{Lemma 1}}


Or, the third framed:

\usepackage{framed}
% ...
\begin{framed}
\textbf{Lemma 1}
\end{framed}

-
I was trying to use the one in package "framed". See my comment on A.Ellet's answer. –  merlin2011 Feb 7 '13 at 6:15
Then the environment is called framed, not frame. –  Sašo Živanović Feb 7 '13 at 6:21
It appears that framed does exactly what I was looking for. I was deceived by the slide. :) –  merlin2011 Feb 7 '13 at 6:27

I'm not famliar with the frame environment. But the error seems to suggest that the frame environment takes some kind of argument and \textbf is getting slurped into that argument sans {Lemma 1}. This is why {\bf Lemma 1} appears to work.

Where did you run across \begin{frame}...\end{frame}?

\documentclass{article}
\listfiles
\usepackage{mdframed}
\pagestyle{empty}
\begin{document}

\begin{frame}{}
\textbf{Lemma 1}

\end{frame}

vs.

\begin{frame}{The}
\textbf{Lemma 1}

\end{frame}

\framebox{\textbf{Lemma 1}}

\end{document}


-
Slide 6 of this slide deck said to replace "shaded" with "frame" slideshare.net/linjaaho/how-to-make-boxed-text-with-latex –  merlin2011 Feb 7 '13 at 6:12
Then this is a question about beamer and you want to use \documentclass{beamer} and not \documentclass{article} –  A.Ellett Feb 7 '13 at 6:14
Changing the class as I suggested will circumvent your original error. –  A.Ellett Feb 7 '13 at 6:14
Sorry, I totally missed the slide that said this presentation is about Beamer. I'm trying to write boxed text in a document, not a slideshow. –  merlin2011 Feb 7 '13 at 6:28
I upvote this answer because it provides a lot of useful information, but accepted the other one because it answered my intended question. –  merlin2011 Feb 7 '13 at 6:29