0

I have the following code:

\documentclass[10pt]{beamer}

\usefonttheme{serif}
\usetheme{Warsaw}

\usepackage{tikz}
\usetikzlibrary{arrows}

\title{Newton's Approximation of $\pi$}

\author{Daniel Rui}



\begin{document}



\begin{frame}

\titlepage

\end{frame}



% \section{Part 1}



% \begin{frame}

% \frametitle{Outline}

% \tableofcontents

% \end{frame}



\begin{frame}

\frametitle{Approximation}

\begin{columns}
\column{0.6\textwidth}
Newton begins with a circle centered at $\frac 12$, as shown. He draws a vertical line at $\frac 14$, and uses two different methods to find the area of the shaded region.
\column{0.4\textwidth}
\begin{center}

\begin{tikzpicture} [
circ/.style={circle, draw, solid, fill=white, inner sep=0.75pt,
             label=#1,
             node contents={}
             },
every label/.append style = {inner sep=2pt, font=\footnotesize}
                    ]
% shaded area
\fill[gray!30]  (0,0) arc (180:120:1.5cm) |- cycle;
% axis
\draw[->]   (-0.5,0) -- + (4.0,0) node[below left] {$x$};
\draw[->]   (0,-0.5) -- + (0,3.0) node[below left] {$y$};
% rest of image
\draw (0,0) node[circ=above left:$B$] arc (180:0:1.5) node[circ={}];
%
\draw[densely dashed]   (60:1.5) -- (0:1.5) node[circ=below:$\frac{1}{2}$];
\draw                   (60:1.5) node[circ=$A$] -- (0:0.75) node[circ=below:$D$];
\end{tikzpicture}
\end{center}

\end{columns}
\end{frame}



\end{document}

Using my compiler (it’s an app called TeX), it gives me the following error:

Illegal parameter number in definition of \test

enter image description here

On another compiler, it seems to work, but on this one, it is very consistently telling me that there is an error. Is this a compiler problem, or is there actually a problem in the

label=#1

that seems to cause a lot of trouble? I tinkered with that particular line a lot, and I believe it is the heart of the problem. Thank you for your help.

3
  • 4
    In the second frame, you need \begin{frame}[fragile] instead of \begin{frame}.
    – user121799
    Jul 24, 2018 at 17:16
  • @marmot Can you explain the difference please? Why does LaTeX distinguish the two?
    – D.R
    Jul 24, 2018 at 17:28
  • Did you see the posting “Illegal parameter in \test” in Beamer + TikZ? (It's listed as a "related" posting to the right of your query.)
    – Mico
    Jul 24, 2018 at 18:15

0

Browse other questions tagged .