7

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.

1

2 Answers 2

5

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).

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

A permanent solution, as pointed out in the comments, is to upgrade TikZ to version 3.0, either from their website or using your tex distribution's packet management tool.

If you can or do not wish to go that route, the simplest solution I found was this non-accepted answer to a related question (referenced in the answer above). The trick is to also include the decorations.text TikZ library, like so:

\usetikzlibrary{shapes.callouts}
\usetikzlibrary{decorations.text}
2
  • Welcome to TeX.SX! After having spent a few time here, you will gain the sufficient reputation to vote up the questions you believe better. Jun 17, 2014 at 12:31
  • This issue is resolved on TikZ version 3.00. So it doesn't need any workarounds.
    – percusse
    Jun 17, 2014 at 13:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .