Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

beamer and tikz

781 views
Skip to first unread message

Zarko F. Cucej

unread,
Jun 10, 2010, 7:42:40 PM6/10/10
to
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

Petter Gustad

unread,
Jun 11, 2010, 2:30:05 AM6/11/10
to
"Zarko F. Cucej" <zarko...@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.

Zarko F. Cucej

unread,
Jun 11, 2010, 3:44:42 AM6/11/10
to
On 11.6.2010 8:30, Petter Gustad wrote:
> "Zarko F. Cucej"<zarko...@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

Petter Gustad

unread,
Jun 11, 2010, 4:04:40 AM6/11/10
to
"Zarko F. Cucej" <zarko...@google.com> writes:

> On 11.6.2010 8:30, Petter Gustad wrote:
>> "Zarko F. Cucej"<zarko...@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.

Alain Matthes

unread,
Jun 11, 2010, 4:53:54 AM6/11/10
to
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


Zarko F. Cucej

unread,
Jun 11, 2010, 1:50:09 PM6/11/10
to

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

Ulrike Fischer

unread,
Jun 15, 2010, 9:30:33 AM6/15/10
to

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

Alain Matthes

unread,
Jun 15, 2010, 12:52:25 PM6/15/10
to
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

Petter Gustad

unread,
Jun 16, 2010, 1:03:46 PM6/16/10
to
Ulrike Fischer <ne...@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.

0 new messages