beamer and tikz

  • Follow


Hi!
Consider the following minimal example:

\documentclass{beamer}
\usepackage{tikz}
     \begin{document}

     \begin{frame}
\begin{tikzpicture}[
Node/.style = {rectangle, text width=#1, align=flush center}
                  ]\tiny
\node[Node=5ex] {FFT};
     \end{tikzpicture}
     \end{frame}

     \end{document}

It generate the following error:

! Illegal parameter number in definition of \test.
<to be read again>
                    1
l.11     \end{tikzpicture}


The same example with other documentclass work without above error (as 
it is described in manual for TikZ. Do I miss something or this some 
bug? I use beamer 3.07.

regards,	Zarko



0
Reply Zarko 6/10/2010 11:42:40 PM

"Zarko F. Cucej" <zarko.cucej@google.com> writes:

>     \begin{frame}

Try to replace this with:

      \begin{frame}[fragile]

and make sure your tikzpicture works in an article class or similar
before incorporating it into beamer.

Petter

-- 
..sig removed by request. 
0
Reply Petter 6/11/2010 6:30:05 AM


On 11.6.2010 8:30, Petter Gustad wrote:
> "Zarko F. Cucej"<zarko.cucej@google.com>  writes:
>
>>      \begin{frame}
>
> Try to replace this with:
>
>        \begin{frame}[fragile]
>
> and make sure your tikzpicture works in an article class or similar
> before incorporating it into beamer.
>
> Petter
>

unfortunately, this doesn't help. I receive the same error in beamar.

Any way thank you for your concern.

regards,	Zarko
0
Reply Zarko 6/11/2010 7:44:42 AM

"Zarko F. Cucej" <zarko.cucej@google.com> writes:

> On 11.6.2010 8:30, Petter Gustad wrote:
>> "Zarko F. Cucej"<zarko.cucej@google.com>  writes:
>>
>>>      \begin{frame}
>>
>> Try to replace this with:
>>
>>        \begin{frame}[fragile]
>>
>> and make sure your tikzpicture works in an article class or similar
>> before incorporating it into beamer.
>>
>> Petter
>>
>
> unfortunately, this doesn't help. I receive the same error in beamar.

I don't get the same error. Using your code I get:
                   1
l.10   \end{tikzpicture}

After adding [fragile] to the frame I get:
                                                  
l.4     \node[Node=5ex]
                        {FFT};

Which is a problem with your tikz code. 

Petter
-- 
..sig removed by request. 
0
Reply Petter 6/11/2010 8:04:40 AM

On 2010-06-11 10:04:40 +0200, Petter Gustad said:
> 
> I don't get the same error. Using your code I get:
>                    1
> l.10   \end{tikzpicture}
> 
> After adding [fragile] to the frame I get:
> 
> l.4     \node[Node=5ex]
>                         {FFT};
> 
> Which is a problem with your tikz code.
> 
> Petter

Hi

I don't know why but you need to define style
outside the frame environment
align=flush center ?? I don't know this style

rectangle ? I think that a text node is a minipage or a parbox
 so it's a rectangle

\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\tikzset{Node/.style = { text width=#1, text centered}}
\begin{frame}

\begin{tikzpicture}
\node[Node=5ex] {FFT FTF TTT DGDF};
\end{tikzpicture}
     \end{frame}

\end{document}

Alain Matthes


0
Reply Alain 6/11/2010 8:53:54 AM

On 11.6.2010 10:53, Alain Matthes wrote:
> On 2010-06-11 10:04:40 +0200, Petter Gustad said:
>>
>> I don't get the same error. Using your code I get:
>> 1
>> l.10 \end{tikzpicture}
>>
>> After adding [fragile] to the frame I get:
>>
>> l.4 \node[Node=5ex]
>> {FFT};
>>
>> Which is a problem with your tikz code.
>>
>> Petter
>
> Hi
>
> I don't know why but you need to define style
> outside the frame environment
> align=flush center ?? I don't know this style
>
> rectangle ? I think that a text node is a minipage or a parbox
> so it's a rectangle
>
> \documentclass{beamer}
> \usepackage{tikz}
> \begin{document}
> \tikzset{Node/.style = { text width=#1, text centered}}
> \begin{frame}
>
> \begin{tikzpicture}
> \node[Node=5ex] {FFT FTF TTT DGDF};
> \end{tikzpicture}
> \end{frame}
>
> \end{document}
>
> Alain Matthes
>
>

Dear Alain Matthes,
Thank you for information. This approach is in case of many different 
images with different need for parameters quite inconvenient to me. So, 
temporary I will stay at direct writing variable parameters in node 
options and use styles only for common features.

regards,	Zarko
0
Reply Zarko 6/11/2010 5:50:09 PM

Am Fri, 11 Jun 2010 01:42:40 +0200 schrieb Zarko F. Cucej:

> Hi!
> Consider the following minimal example:
> 
> \documentclass{beamer}
> \usepackage{tikz}
>      \begin{document}
> 
>      \begin{frame}
> \begin{tikzpicture}[
> Node/.style = {rectangle, text width=#1, align=flush center}
>                   ]\tiny
> \node[Node=5ex] {FFT};
>      \end{tikzpicture}
>      \end{frame}
> 
>      \end{document}
> 
> It generate the following error:
> 
> ! Illegal parameter number in definition of \test.
> <to be read again>
>                     1
> l.11     \end{tikzpicture}
> 
> 
> The same example with other documentclass work without above error (as 
> it is described in manual for TikZ. Do I miss something or this some 
> bug? I use beamer 3.07.

Yuo get this error if you try to use a parameter number inside the
definition of a command which doesn't have an argument:

\documentclass{article}
\begin{document}
\def\test{\def\abc#1{#1}}
\end{document}

The solution is to double the parameter:

\documentclass{article}
\begin{document}
\def\test{\def\abc##1{blub##1}}

\test \abc{cde} 
\end{document}


In the case of beamer doubling is not enough, as the content of a
frame is stored twice: After doubling you get the same error but now
for the command \beamer@doifinframe instead of \test. 

So the solution is to redouble the parameter sign:

\documentclass{beamer}
\usepackage{tikz}
\begin{document}



\begin{frame}
  \begin{tikzpicture}[
    Node/.style = {rectangle, text width=####1}
                  ]\tiny
    \node[Node=5ex] {FFT};
   \end{tikzpicture}
\end{frame}
\end{document}

-- 
Ulrike Fischer 
0
Reply Ulrike 6/15/2010 1:30:33 PM

On 2010-06-15 15:30:33 +0200, Ulrike Fischer said:
> 
> In the case of beamer doubling is not enough, as the content of a
> frame is stored twice: After doubling you get the same error but now
> for the command \beamer@doifinframe instead of \test.
> 
> So the solution is to redouble the parameter sign:
> 
> \documentclass{beamer}
> \usepackage{tikz}
> \begin{document}
> 
> 
> 
> \begin{frame}
>   \begin{tikzpicture}[
>     Node/.style = {rectangle, text width=####1}
>                   ]\tiny
>     \node[Node=5ex] {FFT};
>    \end{tikzpicture}
> \end{frame}
> \end{document}

Waouu !

You fell into a marmite of Tex when you were a little girl !!! (chess notation)

Alain

0
Reply Alain 6/15/2010 4:52:25 PM

Ulrike Fischer <news3@nililand.de> writes:

> Yuo get this error if you try to use a parameter number inside the
> definition of a command which doesn't have an argument:

Impressive LaTeX knowledge! Thank you for clearing this up.

Petter
-- 
..sig removed by request. 
0
Reply Petter 6/16/2010 5:03:46 PM

8 Replies
849 Views

(page loaded in 0.099 seconds)

Similiar Articles:








7/22/2012 10:31:12 AM


Reply: