Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have just recently upgraded my TeXLive from version 2010 to 2011 (OS versions Ubuntu 10.10/Maverick 32-bit and Windows 7/64 bit).

This is pdfTeX, Version 3.1415926-2.3-1.40.12 (Web2C 2011)
(format=pdflatex 2011.8.10) 15 AUG 2011 09:34

To test the new version I thought it would be a good idea to try to compile some of my older documents. It all went flawlessly until I got to a paper that had some TikZ graphics, which produced errors. After some investigation I had found that the problem was caused by some positioning elements of TikZ. Here is a MWE:

\documentclass{report}

\usepackage{tikz}
\usetikzlibrary{shapes.callouts}

\begin{document}
\begin{figure}[tb]
\begin{center}
\begin{tikzpicture}[remember picture, note/.style={rectangle callout, fill=#1}]
\draw [help lines] grid(3,2);
\node [note=red!50, callout relative pointer={(0,2)}] at (0,0) {Good};
\node [note=blue!50, callout relative pointer={(0,2)}] at (2,0) {Good};
%\node [note=blue!50, callout absolute pointer={(0,2)}] at (2,0) {Error};
\end{tikzpicture}
\end{center}
\end{figure}
\end{document}

The above code is a slightly modified version of the sample found in the TikZ & PGF Manual Version 2.10, page 454 (2nd sample). The error is caused by the commented line. Whenever absolute positioning is used, an error is generated like the one below:

! Undefined control sequence.
\pgf@sh@bg@rectangle callout ...f@sh@np@\pgf@test 
                                              \noexpand \endcsname }\ede...
l.24 ...lute pointer={(0,1)}] at (1,0) {Absolute};

I would appreciate any pointers. Cheers.

share|improve this question
    
There is now a fuller answer to this question at tex.stackexchange.com/q/31921/86 –  Andrew Stacey Oct 18 '11 at 16:49
add comment

1 Answer

up vote 5 down vote accepted

Update: See Daniel's answer at callout and beamer for a fuller patch.


This appears to be a bug in PGF. Looking at the relevant line in pgflibraryshapes.callouts.code.tex, I see the following code:

%
% \pgf@test = the shape name (from \pgfmultipartnode)
%
\ifx\pgf@test\pgfutil@empty%
\else%
    %
    % Now hack an extra saved anchor \calloutpointeranchor,
    % with the new anchor for the callout pointer.
    %
    \edef\pgf@sh@@temp{\noexpand\expandafter\noexpand\pgfutil@g@addto@macro\noexpand\csname pgf@sh@np@\pgf@test\noexpand\endcsname}%
    \edef\pgf@sh@@@temp{%
        \noexpand\def\noexpand\calloutpointeranchor{%
            \noexpand\pgf@x\the\pgf@x%
            \noexpand\pgf@y\the\pgf@y%
        }%
    }%
    \expandafter\pgf@sh@@temp\expandafter{\pgf@sh@@@temp}%
\fi%

But when I looked at the definition of \pgfmultipartnode I couldn't find a place where \pgf@test is assigned to the shape name. Instead, I found \def\shape@name{#1}% CJ. And when I replaced \pgf@test by \shape@name in pgflibraryshapes.callouts.code.tex then I get what appears to be the right behaviour. (This might not be the only fix needed: \pgf@test is used a couple more times in that library; the others aren't documented and aren't needed to fix this code.)

Long-term fix: report this on the PGF bug tracker.

Short-term fix: copy the file pgflibraryshapes.callouts.code.tex somewhere where it will be read first (personal texmf directory, for example) and modify it in line with the above (ie replace \pgf@test by \shape@name).

share|improve this answer
    
Thank you, Andrew. It solves the problem temporarily. I'll try to report this to the PGF maintainers. –  Heisenb0rg Aug 15 '11 at 10:09
    
@Heisenb0rg The code compiles fine with pgf 2.1 CVS ! –  Alain Matthes Aug 15 '11 at 11:42
    
@Altermundus: Thanks for the info. My version is 2.10, not from CVS though. –  Heisenb0rg Aug 15 '11 at 13:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.