Menu

#93 \heightof broken in texlive 2015

v1.0 (example)
closed-invalid
nobody
None
5
2017-12-18
2015-09-28
Cosmo Huber
No

I just updated to texlive 2015 and found that the \heightof command appears to be broken. The following MWE

\documentclass{minimal}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
  xmin=0.0,xmax=3.14,
  ymin=-2,ymax=2,
  xtick={0,0.79,1.57,2.35,3.14},
  xticklabels={$0$,,$\pi/2$,,$\pi$},
  xticklabel style={text height=\heightof{$\pi/2$}},    
  xlabel=$x$,
  ytick={-2,-1,0,1,2},
  ylabel=$y$]
  \addplot coordinates {(0,-2) (1,0) (3,2)};
\end{axis}
\end{tikzpicture}
\end{document}

leads to the following messsage:

! Undefined control sequence.
\tikz@text@height ->\heightof 
                              {$\pi /2$}
l.71     ]

Commenting out the line with xticklabel avoids the problem. Processing the same MWE with texlive 2014 is successful. I've seen similar messages online, e.g., https://lists.debian.org/debian-tex-maint/2015/08/msg00026.html, but I did not see any similar messages here. If there are and I overlooked them, my apologies for the duplication. (The follow-up message https://lists.debian.org/debian-tex-maint/2015/08/msg00025.html claims that calc.sty is the problem. I did not try processing the MWE with an older version of calc.sty copied into the texlive 2015 distribution.)

Discussion

  • Stefan Pinnow

    Stefan Pinnow - 2015-11-22

    still open in 2015-11-22 Revision 1.12.1-92-ge3c6f9d

     
  • Christian Feuersänger

    This issue is unrelated to pgfplots; it is a pure PGF defect as can be seen by the MWE

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

    \begin{tikzpicture}
    \node[text height=\height{$\pi/2$}] {Text};
    \end{tikzpicture}
    \end{document}

    I'll make an attempt to find the root cause in PGF. If I fail to find it, I will close the issue here.

     
  • Christian Feuersänger

    • status: open --> pending
     
  • Cosmo Huber

    Cosmo Huber - 2016-01-11

    Out of curiosity, is there any news on this? I noticed that the same problem was reported as bug 366 on the PGF and TikZ sourceforge page at https://sourceforge.net/p/pgf/bugs/366/. I updated to TeXLive 2015 because I need to use pgfplots 1.13 to get access to new features, but this breaks many of my plots because they use \heightof. Are there any workarounds? (Copying pgfplots from TeXLive 2015 into the TeXLive 2014 distribution does not work.)

     

    Last edit: Cosmo Huber 2016-01-11
  • Christian Feuersänger

    I am sorry, this must have slipped my attention.

    I fear that this got lost during a modification in the PGF math engine some time ago.

    The new expected solution appears to be

    \documentclass{minimal}
    \usepackage{tikz}
    \begin{document}
    
    \begin{tikzpicture}
    \node[text height=height("$\pi/2$")] {Text};
    \end{tikzpicture}
    \end{document}
    

    in the hope that the double quotes have their original meaning.


    A possible way to restore the old functionality (at least within math expressions) is to use

    \documentclass{minimal}
    \usepackage{tikz}
    \usepackage{german}
    
    \begingroup
    \catcode`\"=12
    \gdef\height#1{%
        height("#1")%
    }%
    \endgroup
    
    \begin{document}
    
    \begin{tikzpicture}
    \node[text height=\height{$\pi/2$}] {Text};
    \end{tikzpicture}
    \end{document}
    

    This also avoids issues with packages like "german" which overwrite the double quotes.

    I am fully aware that this is not a real "fix". If you need a real fix, you will need to file this defect in the PGF bug tracker.

    I am sorry for not looking into this earlier -- I have set it to pending a long time ago, but I still must have overlooked it.

     
  • Christian Feuersänger

    • status: pending --> closed-invalid