cameronbracken / pgfSweave

Quality graphics and speedy compilation with Sweave
http://r-forge.r-project.org/projects/pgfsweave/
29 stars 6 forks source link

tikz externalization doesn't work with lastpage LaTeX package #33

Closed mlt closed 12 years ago

mlt commented 12 years ago

While it is not truly pgfSweave problem, however I don't use tikz externalization other than this way.

lastpage cannot get write access to aux file during pdf generation and bails out.

I'm not sure what workaround is possible inside of the document.

cameronbracken commented 12 years ago

can you post a minimal example?

mlt commented 12 years ago

Sure.. I was in a hurry yesterday. Name the following as _tikz_lpbug.Rnw.

\documentclass{article}
\usepackage{lastpage}
\usepackage{tikz}
\pgfrealjobname{tikz_lp_bug}

\begin{document}

This is the last page \pageref{LastPage}.

<<fig,fig=TRUE,tikz=TRUE,cache=TRUE,external=TRUE>>=
x=1:10
plot(x,x)
@

\end{document}

I get the following in _tikz_lpbug-fig.log when doing make -B -f tikz_lp_bug.makefile in particular

! Package lastpage Error: No auxiliary file allowed..
cameronbracken commented 12 years ago

Ok, I can confirm this error. Not sure how to do a real fix, you may want to check with the pgf-users list or tex.stackexchange.

I did find one workaround. Disable the lastpage package (comment it). Compile and run the externalization commands, then enable the lastpage package again. This time around, the figures wont be re-generated so there are no errors.

cameronbracken commented 12 years ago

btw, in the newer version of pgfSweave you dont need to include the \pgfrealjobname command, it is added automatically, so you can call you document whatever you want.

mlt commented 12 years ago

The maintainer of lastpage kindly changed the error to warning in the last version. See also this.

cameronbracken commented 12 years ago

nice, thanks for following up.