[tex4ht] tex4ht with pgfplots and external legends
Johannes Wilm
mail at johanneswilm.org
Wed Jul 20 20:15:47 CEST 2011
Hi,
the below example of a latex file gives the following error upon the 2nd run
of latex. The first run works fine. This happens both when running
dvilualatex and just latex, both from TexLive 2011.
The error:
...
(/usr/local/texlive/2011/texmf-dist/tex/generic/tex4ht/color.4ht)
(/usr/local/texlive/2011/texmf-dist/tex/generic/tex4ht/html4.4ht)
(/usr/local/texlive/2011/texmf-dist/tex/generic/tex4ht/html4-math.4ht))
(./epub.aux)
! Missing \endcsname inserted.
<to be read again>
\protect
l.30 \ref{govconsumptionlegend}
?
- - - - - - - - - - - - - - - -
\makeatletter
\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\def\Link#1.a.b.c.{\g at addto@macro\@documentclasshook{\RequirePackage[#1,html]{tex4ht}}\let\HCode\documentstyle\def\documentstyle{\let\documentstyle\HCode\expandafter\def\csname
tex4ht\endcsname{#1,html}\def\HCode####1{\documentstyle[tex4ht,}\@ifnextchar[{\HCode}{\documentstyle[tex4ht]}}}
\makeatother
\HCode "xhtml,png,charset=utf-8".a.b.c.
\documentclass[11pt,a4paper]{book}
\usepackage{pgfplots}
\pgfplotsset{width=\textwidth,compat=1.3,every axis/.append
style={font=\footnotesize},cycle list name=black white}
\begin{document}
\begin{tikzpicture}
\begin{axis}[ylabel=\%,x tick label style={ /pgf/number format/1000
sep=},ymin=0,xmin=1950,xmax=2009,legend to
name=govconsumptionlegend,title=Government Consumption Share of PPP
Converted GDP Per Capita at 2005 constant prices]
\addplot[smooth,solid] coordinates {
(1950,12.98732304) (1951,11.18937899) (1952,10.63447043) (1953,11.25741618)
(1954,11.35201741) (1955,10.98310036) (1956,11.27808626) (1957,11.06275337)
(1958,11.21626046) (1959,11.18458192) (1960,11.02716074) (1961,10.97486816)
(1962,10.19712891) (1963,8.50170024) (1964,8.220444391) (1965,8.181873469)
(1966,7.859215042) (1967,8.269806768) (1968,8.023789126) (1969,7.867343418)
(1970,8.469691612) (1971,8.352726749) (1972,9.263915297) (1973,7.560088984)
(1974,7.436700475) (1975,9.207375031) (1976,9.725811776) (1977,9.495010597)
(1978,13.74144043) (1979,22.99348928) (1980,23.05639171) (1981,24.02424559)
(1982,28.25010594) (1983,35.38307779) (1984,40.11885923) (1985,43.3304334)
(1986,44.7847218) (1987,46.7237337) (1988,35.62924609) (1989,30.65659214)
(1990,39.89428582) (1991,27.48910619) (1992,24.75024034) (1993,24.68286164)
(1994,23.26013887) (1995,23.69594547) (1996,22.53334681) (1997,21.35901868)
(1998,21.53873871) (1999,22.22968487) (2000,21.95238646) (2001,21.3231532)
(2002,21.29835897) (2003,21.6183452) (2004,21.30177929) (2005,21.51748623)
(2006,20.88675316) (2007,20.32549306) (2008,21.13794484) (2009,21.75075984)
};
\addlegendentry{Country 1}
\addplot[smooth,dotted] coordinates {
(1950,8.90574995) (1951,9.181850378) (1952,9.4040808) (1953,9.790597533)
(1954,9.766571438) (1955,9.721345475) (1956,9.898347958) (1957,9.986947451)
(1958,10.13725015) (1959,10.11995062) (1960,9.9669931) (1961,9.781482565)
(1962,9.968596797) (1963,10.33417822) (1964,10.07453069) (1965,10.17668623)
(1966,10.4859246) (1967,10.6188237) (1968,10.93369976) (1969,11.01396095)
(1970,11.25808879) (1971,11.43128231) (1972,11.45138898) (1973,11.36045323)
(1974,11.33276575) (1975,11.50069671) (1976,11.72466305) (1977,12.25394557)
(1978,12.52158998) (1979,12.61603185) (1980,12.68712893) (1981,13.01282874)
(1982,12.97669774) (1983,12.92432378) (1984,12.72145426) (1985,12.63447969)
(1986,12.49591698) (1987,12.22704263) (1988,12.05291461) (1989,12.07675903)
(1990,12.25254614) (1991,12.74485006) (1992,13.14305947) (1993,13.41082617)
(1994,12.89670369) (1995,12.41585298) (1996,12.34588672) (1997,12.01926401)
(1998,12.00221677) (1999,11.69852271) (2000,11.11468531) (2001,11.08248726)
(2002,11.05693806) (2003,10.89817902) (2004,10.44900187) (2005,10.05582475)
(2006,9.829361577) (2007,9.567882534) (2008,9.714898563) (2009,10.42225882)
};
\addlegendentry{Country 2}
\end{axis}\end{tikzpicture}
\ref{govconsumptionlegend}
\end{document}
--
Johannes Wilm
http://www.johanneswilm.org
tel: +1 (520) 399 8880
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/tex4ht/attachments/20110720/971da537/attachment.html>
More information about the tex4ht
mailing list