This question already has an answer here:

I have the following code:




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

\author{Daniel Rui}





% \section{Part 1}

% \begin{frame}

% \frametitle{Outline}

% \tableofcontents

% \end{frame}



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.

\begin{tikzpicture} [
circ/.style={circle, draw, solid, fill=white, inner sep=0.75pt,
             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$];



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


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.

marked as duplicate by Mico, Troy, Phelype Oleinik, Alenanno tikz-pgf Jul 24 '18 at 18:52

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 4
    In the second frame, you need \begin{frame}[fragile] instead of \begin{frame}. – user121799 Jul 24 '18 at 17:16
  • @marmot Can you explain the difference please? Why does LaTeX distinguish the two? – D.R Jul 24 '18 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 '18 at 18:15

Browse other questions tagged or ask your own question.