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

Bug in pgf ...

98 views
Skip to first unread message

GL

unread,
Jan 28, 2011, 3:39:19 PM1/28/11
to
Hello,

The following example does not compile. \rotatebox (graphics.sty)
seems not to be allowed in the preamble, due to pgf package.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[a4paper,french]{article}
\usepackage[T1]{fontenc}
\usepackage{pgf,graphics}

\newsavebox \mybox
\setbox\mybox = \hbox{\rotatebox{90}{Hello}}

\begin{document}

\setbox0=\hbox{\rotatebox{90}{Hello}}

\copy0 %% OK

\copy\mybox %% Fail

\end{document}\endinput
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-----------------------------------------------------------
> \box0=
\hbox(22.4945+0.0)x6.8872
.\hbox(22.4945+0.0)x6.8872
..\kern 6.8872
..\hbox(6.8872+0.0)x0.0
...\pdfsave
...\pdfsetmatrix{0 1 -1 0} <----------------------------
...\hbox(6.8872+0.0)x0.0
....\T1/cmr/m/n/10 H
....\T1/cmr/m/n/10 e
....\T1/cmr/m/n/10 l
....\T1/cmr/m/n/10 l
....\T1/cmr/m/n/10 o
...\pdfrestore
-----------------------------------------------------------
logbox: \mybox
> \box33=
\hbox(22.4945+0.0)x6.8872
.\hbox(22.4945+0.0)x6.8872
..\kern 6.8872
..\hbox(6.8872+0.0)x0.0
...\pdfsave
...\pdfsetmatrix{\cos(90) \sin(90) -\sin(90) \cos(90) } < ??????????
...\hbox(6.8872+0.0)x0.0
....\T1/cmr/m/n/10 H
....\T1/cmr/m/n/10 e
....\T1/cmr/m/n/10 l
....\T1/cmr/m/n/10 l
....\T1/cmr/m/n/10 o
...\pdfrestore
-----------------------------------------------------------

zappathustra

unread,
Jan 28, 2011, 4:10:13 PM1/28/11
to
Le 28/01/2011 21:39, GL a écrit :
> Hello,
>
> The following example does not compile. \rotatebox (graphics.sty)
> seems not to be allowed in the preamble, due to pgf package.
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> \documentclass[a4paper,french]{article}
> \usepackage[T1]{fontenc}
> \usepackage{pgf,graphics}
>
> \newsavebox \mybox
> \setbox\mybox = \hbox{\rotatebox{90}{Hello}}
>
> \begin{document}
>
> \setbox0=\hbox{\rotatebox{90}{Hello}}
>
> \copy0 %% OK
>
> \copy\mybox %% Fail
>
> \end{document}\endinput

[snip]

> ...\pdfsetmatrix{\cos(90) \sin(90) -\sin(90) \cos(90) } < ??????????

This is the normal way to express transformations in PDF (with
trigonometric functions). And it obviously mean the same thing as "0 1
-1 0".
I guess the culprit is \newsavebox. Why do you use it for the first box
and not the second?

Paul

Alain Matthes

unread,
Jan 28, 2011, 4:54:41 PM1/28/11
to
On 2011-01-28 21:39:19 +0100, GL said:

> Hello,
>
> The following example does not compile. \rotatebox (graphics.sty)
> seems not to be allowed in the preamble, due to pgf package.
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> \documentclass[a4paper,french]{article}
> \usepackage[T1]{fontenc}
> \usepackage{pgf,graphics}
>
> \newsavebox \mybox
> \setbox\mybox = \hbox{\rotatebox{90}{Hello}}
>
> \begin{document}
>
> \setbox0=\hbox{\rotatebox{90}{Hello}}
>
> \copy0 %% OK
>
> \copy\mybox %% Fail
>
> \end{document}\endinput
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Hi

Why a problem with pgf ? you don't use pgf in the code and

\documentclass[a4paper,french]{article}
\usepackage[T1]{fontenc}

\usepackage{graphics,pgf}

\newsavebox \mybox
\setbox\mybox = \hbox{\rotatebox{90}{Hello}}

\begin{document}

\setbox0=\hbox{\rotatebox{90}{Hello}}

\copy0 %% OK

\copy\mybox %% Fail

\end{document}\endinput

gives the same error

I don't know why but

\documentclass[a4paper]{article}
\usepackage{graphicx}
\newsavebox \mybox
\begin{document}


\setbox\mybox = \hbox{\rotatebox{90}{Hello}}

\copy\mybox
\end{document}\endinput

is correct

but

\documentclass[a4paper]{article}
\usepackage{graphicx,pgf}
\newbox \mybox


\setbox\mybox = \hbox{\rotatebox{90}{Hello}}
\begin{document}

\copy\mybox

\end{document}\endinput

fails
rotatebox is not allowed in the preamble and without pgf !

Alain

Alain Matthes

unread,
Jan 28, 2011, 4:57:49 PM1/28/11
to
On 2011-01-28 21:39:19 +0100, GL said:

> Hello,
>
> The following example does not compile. \rotatebox (graphics.sty)
> seems not to be allowed in the preamble, due to pgf package.
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> \documentclass[a4paper,french]{article}
> \usepackage[T1]{fontenc}
> \usepackage{pgf,graphics}
>
> \newsavebox \mybox
> \setbox\mybox = \hbox{\rotatebox{90}{Hello}}
>
> \begin{document}
>
> \setbox0=\hbox{\rotatebox{90}{Hello}}
>
> \copy0 %% OK
>
> \copy\mybox %% Fail
>
> \end{document}\endinput

> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Hi

The first message was unclear

Why a problem with pgf ? you don't use pgf in the code and

\documentclass[a4paper,french]{article}
\usepackage[T1]{fontenc}
\usepackage{graphics,pgf}

\newsavebox \mybox
\setbox\mybox = \hbox{\rotatebox{90}{Hello}}

\begin{document}

\setbox0=\hbox{\rotatebox{90}{Hello}}

\copy0 %% OK

\copy\mybox %% Fail

\end{document}\endinput

gives the same error

I don't know why but

\documentclass[a4paper]{article}
\usepackage{graphicx}
\newsavebox \mybox
\begin{document}

\setbox\mybox = \hbox{\rotatebox{90}{Hello}}

\copy\mybox
\end{document}\endinput

is correct

but

\documentclass[a4paper]{article}
\usepackage{graphicx,pgf}

\newbox \mybox


\setbox\mybox = \hbox{\rotatebox{90}{Hello}}
\begin{document}

\copy\mybox

Dan Luecking

unread,
Jan 28, 2011, 4:59:46 PM1/28/11
to
On Fri, 28 Jan 2011 21:39:19 +0100, GL <goua...@gmail.com> wrote:

>Hello,
>
>The following example does not compile. \rotatebox (graphics.sty)
>seems not to be allowed in the preamble, due to pgf package.
>
>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>\documentclass[a4paper,french]{article}
>\usepackage[T1]{fontenc}
>\usepackage{pgf,graphics}
>
>\newsavebox \mybox
> \setbox\mybox = \hbox{\rotatebox{90}{Hello}}

Much of pdftex support of graphics is loaded at
\begin{document}. Put this \setbox command after it.

(By the way, this is unrelated to pgf, fontenc,
A4paper, or the french option, so those don't belong
in a minimal example.)

>
>\begin{document}
>
> \setbox0=\hbox{\rotatebox{90}{Hello}}
>
> \copy0 %% OK

\setbox\mybox = \hbox{\rotatebox{90}{Hello}}% put here

>
> \copy\mybox %% Fail
>
>\end{document}\endinput


Dan
To reply by email, change LookInSig to luecking

Paul Gaborit

unread,
Jan 28, 2011, 5:11:26 PM1/28/11
to

� (at) Fri, 28 Jan 2011 21:39:19 +0100,
GL <goua...@gmail.com> �crivait (wrote):

> The following example does not compile. \rotatebox (graphics.sty)
> seems not to be allowed in the preamble,

Yes.

> due to pgf package.

??? without pgf, pdlfatex produces the same error:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{article}
\usepackage{graphics}


\newsavebox \mybox
\setbox\mybox = \hbox{\rotatebox{90}{Hello}}
\begin{document}
\setbox0=\hbox{\rotatebox{90}{Hello}}
\copy0 %% OK
\copy\mybox %% Fail
\end{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

--
Paul Gaborit - <http://perso.mines-albi.fr/~gaborit/>

GL

unread,
Jan 28, 2011, 5:48:38 PM1/28/11
to
Le 28/01/2011 22:57, Alain Matthes a écrit :
> On 2011-01-28 21:39:19 +0100, GL said:
>
>> Hello,
>>
>> The following example does not compile. \rotatebox (graphics.sty)
>> seems not to be allowed in the preamble, due to pgf package.
>>
>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>> \documentclass[a4paper,french]{article}
>> \usepackage[T1]{fontenc}
>> \usepackage{pgf,graphics}
>>
>> \newsavebox \mybox
>> \setbox\mybox = \hbox{\rotatebox{90}{Hello}}
>>
>> \begin{document}
>>
>> \setbox0=\hbox{\rotatebox{90}{Hello}}
>>
>> \copy0 %% OK
>>
>> \copy\mybox %% Fail
>>
>> \end{document}\endinput
>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> Hi
>
> The first message was unclear

Sorry but I gave the ouput of \showbox to show where the problem
came from... so i can't imagine it was "unclear" !

> Why a problem with pgf ? you don't use pgf in the code and

i use : \usepackage{pgf} this means that i use pgf in the code,
for pgf expands some commands even if i don't use one of them
explicitly.

But you're (almost) always right, and the culprit is not pgf,
but the "basic" graphics package (not graphicx) with pdftex.def

But trig.sty defines:

graphics (DPC) defines \sin(90)=\@ne (not expandable)
and pdftex.def turn it into \number\@ne = 1

But don't understand why pdftex.def does this \AtBeginDocument ??

If i remove \AtBeginDocument, this works fine... May be H. Oberdiek as
an answer, or a clue ;-)

Thanks.

Heiko Oberdiek

unread,
Jan 28, 2011, 7:03:52 PM1/28/11
to
Dan Luecking <Look...@uark.edu> wrote:

> On Fri, 28 Jan 2011 21:39:19 +0100, GL <goua...@gmail.com> wrote:
>
> >Hello,
> >
> >The following example does not compile. \rotatebox (graphics.sty)
> >seems not to be allowed in the preamble, due to pgf package.
> >
> >%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> >\documentclass[a4paper,french]{article}
> >\usepackage[T1]{fontenc}
> >\usepackage{pgf,graphics}
> >
> >\newsavebox \mybox
> > \setbox\mybox = \hbox{\rotatebox{90}{Hello}}
>
> Much of pdftex support of graphics is loaded at
> \begin{document}. Put this \setbox command after it.

The problem is trig.sty, some of the cos and sin values aren't
expandandable anymore. pdftex.def fixes this at \begin{document}:

| % undo the trig.sty `optimization' so that these 0 1 and -1 values
| % get written out as digits, not unexpandable TeX primitives.
| % 0.04q: space added to remain consistent with trig.sty.
| \AtBeginDocument{%
| \def\GPT@temp#1(#2)=#3 {%
| \expandafter\def\csname #1(#2)\endcsname{#3 }%
| }%
| \GPT@temp sin(0)=0 %
| \GPT@temp cos(0)=1 %
| \GPT@temp sin(90)=1 %
| \GPT@temp cos(90)=0 %
| \GPT@temp sin(-90)=-1 %
| \GPT@temp cos(-90)=0 %
| \GPT@temp sin(180)=0 %
| \GPT@temp cos(180)=-1 %
| % added in 0.04q
| \GPT@temp sin(270)=-1 %
| \GPT@temp cos(270)=0 %
| \GPT@temp sin(360)=0 %
| \GPT@temp cos(360)=1 %
| \GPT@temp sin(-180)=0 %
| \GPT@temp cos(-180)=-1 %
| \GPT@temp sin(-270)=1 %
| \GPT@temp cos(-270)=0 %
| \GPT@temp sin(-360)=0 %
| \GPT@temp cos(-360)=1 %
| }

In 0.05d I have improved the patching, update is on its way to CTAN.
With 0.05d load trig.sty before pdftex.def (e.g. graphics before
color) or use memoir, scrlfile or filehook.

--
Heiko Oberdiek

Heiko Oberdiek

unread,
Jan 28, 2011, 7:06:01 PM1/28/11
to
GL <goua...@gmail.com> wrote:

> But you're (almost) always right, and the culprit is not pgf,
> but the "basic" graphics package (not graphicx) with pdftex.def
>
> But trig.sty defines:
>
> graphics (DPC) defines \sin(90)=\@ne (not expandable)
> and pdftex.def turn it into \number\@ne = 1
>
> But don't understand why pdftex.def does this \AtBeginDocument ??
>
> If i remove \AtBeginDocument, this works fine... May be H. Oberdiek as
> an answer, or a clue ;-)

\usepackage{color}% then trig.sty isn't loaded.

See pdftex.def 0.05d (berlios, CTAN update is on its way).

--
Heiko Oberdiek

GL

unread,
Jan 28, 2011, 8:18:49 PM1/28/11
to
What d'you mean ? i got the pdftex.def 0.05c and the following code
does not produce a pdf:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{minimal}
\usepackage{color}
\usepackage{graphics}

\newsavebox\mybox
\setbox\mybox=\hbox{\rotatebox{90}{Hello}}

\begin{document}

\copy\mybox
\end{document}\endinput
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Same error:
! pdfTeX error (\pdfsetmatrix): Unrecognized format..
<to be read again>

And listfiles says:
*File List*
minimal.cls 2001/05/25 Standard LaTeX minimal class
color.sty 2005/11/14 v1.0j Standard LaTeX Color (DPC)
color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
pdftex.def 2010/11/26 v0.05c Graphics/color for pdfTeX
graphics.sty 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
trig.sty 1999/03/16 v1.09 sin cos tan (DPC) <---------------
graphics.cfg 2007/01/18 v1.5 graphics configuration of teTeX/TeXLive
supp-pdf.mkii

???????????????????????????? so what ?

Good night.

Heiko Oberdiek

unread,
Jan 29, 2011, 7:03:08 AM1/29/11
to
GL <goua...@gmail.com> wrote:

> Le 29/01/2011 01:06, Heiko Oberdiek a écrit :
> > GL<goua...@gmail.com> wrote:
> >
> >> But you're (almost) always right, and the culprit is not pgf,
> >> but the "basic" graphics package (not graphicx) with pdftex.def
> >>
> >> But trig.sty defines:
> >>
> >> graphics (DPC) defines \sin(90)=\@ne (not expandable)
> >> and pdftex.def turn it into \number\@ne = 1
> >>
> >> But don't understand why pdftex.def does this \AtBeginDocument ??
> >>
> >> If i remove \AtBeginDocument, this works fine... May be H. Oberdiek as
> >> an answer, or a clue ;-)
> >
> > \usepackage{color}% then trig.sty isn't loaded.
> >
> > See pdftex.def 0.05d (berlios, CTAN update is on its way).
> >
> What d'you mean ? i got the pdftex.def 0.05c

Version 0.05d with

> pdftex.def 2010/11/26 v0.05c Graphics/color for pdfTeX

date 2011/01/28 (!)

--
Heiko Oberdiek

GL

unread,
Jan 29, 2011, 8:32:34 AM1/29/11
to
Le 29/01/2011 13:03, Heiko Oberdiek a écrit :
>>>
>> What d'you mean ? i got the pdftex.def 0.05c
>
> Version 0.05d with
>
>> pdftex.def 2010/11/26 v0.05c Graphics/color for pdfTeX
>
> date 2011/01/28 (!)

Ok cheers ! No later than yesterday ;-)

BY the way, if you have a few minutes, what do'you think
of my (pure TeX) implementation of trimallspaces (cf my
post at 2:10 am in answer to 'A. Musing')

As long as the process only use \@tempa, it's possible
to removing the grouping, as a (last) optimisation...

Younrs sincerely.

Heiko Oberdiek

unread,
Jan 30, 2011, 8:58:14 AM1/30/11
to
GL <goua...@gmail.com> wrote:

> BY the way, if you have a few minutes, what do'you think
> of my (pure TeX) implementation of trimallspaces (cf my
> post at 2:10 am in answer to 'A. Musing')

No, discussion about methods was last year (also with Ahmed Musa).
I should rather work on the documentation.

--
Heiko Oberdiek

GL

unread,
Jan 30, 2011, 10:38:50 AM1/30/11
to
Le 30/01/2011 14:58, Heiko Oberdiek a �crit :

It's exactly the same method as the one proposed by A. Musa (with
\ifx instead of \pdfstrcmp) and implemented in trimspace.sty.

But I looked carefully at the method (the .log) and optimized it,
trimming the first space before the last one, in order not to
read the whole string argument twice, but only once...

Yours sincerely.


0 new messages