Share

pgfplots

Tracker: Bugs

5 Command \pgfmathprintnumber cannot be used inside a caption - ID: 2892167
Last Update: Settings changed ( ludewich )

This code produces error:

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{pgfplots}
\begin {document}
\begin{figure}
Figure Content
\caption{Try $x=\pgfmathprintnumber{1e+7}$ in caption}
\end{figure}
\end {document}

Compilation log is attached.


Dmitry Kirzhanov ( kirzhanov ) - 2009-11-04 20:32

5

Closed

None

Nobody/Anonymous

None

None

Public


Comment ( 1 )

Date: 2009-11-05 18:17
Sender: ludewichProject Admin

Hello Dmitry,

thank you for your bug report! It is right, many commands which execute
something can't be used inside of captions - and the print number thing is
one of them. However, there is simple, quite general solution for this
problem: simply type

\protect\pgfmathprintnumber

and it will work! I fear I can't do this automatically for every
executable command, so I hope this solution suffices. The \protect command
will also work for other "fragile" commands, for example to include TikZ
pictures inside of captions etc.

Best regards

Christian


Attached File ( 1 )

Filename Description Download
pgferror.log Download

Changes ( 4 )

Field Old Value Date By
close_date - 2009-11-05 18:17 ludewich
allow_comments 1 2009-11-05 18:17 ludewich
status_id Open 2009-11-05 18:17 ludewich
File Added 349562: pgferror.log 2009-11-04 20:32 kirzhanov