# error using pgfsysdriver with tex4ht, only shows up with texlive 2014, ok with texlive 2013

Update: Thanks to the comments below. Using the link by Michal below, it appears this is a known bug but the fix was not in 2014. Doing the change as pointed out in the link below, seems to have fixed the problem

>diff pgfsys-tex4ht.def pgfsys-tex4ht.def_ORIGINAL
89c89
< \def\pgfsys@svg@newline{{?nl}}
---
> \def\pgfsys@svg@newline{\Hnewline}


The above file is in

/usr/local/texlive/2014/texmf-dist/tex/generic/pgf/systemlayer


I no longer get the error, and I get the same outout as tex4ht on texlive 2013

## Original question

I just installed fresh linux on virtual machine. Installed new texlive 2014.

http://ctan.math.washington.edu/tex-_archive/systems/texlive/tlnet/

install-tl-unx.tar.gz 16-Jun-2014 18:26  3.2M


Then extract

 gunzip install-tl-unx.tar.gz
tar -xvf install-tl-unx.tar


Then move to the folder created from the above and do

 sudo ./install-tl


Tried one of my test files and it failed. Same file works ok on texlive 2013 (different virtual machine, so no interactions between installation).

This file fails to build with tex4ht only. Builds ok with pdflatex. I would have expected it to work out of the box, since tex4ht is part of texlive.

\documentclass{article}
\ifdefined\HCode
\def\pgfsysdriver{pgfsys-tex4ht.def}
\fi
\usepackage{tikz,graphicx}
%
\usetikzlibrary{trees}
\begin{document}
\begin{tikzpicture}
\node {root}
child {node {$\frac{a}{b}$}};
\end{tikzpicture}
\end{document}


Using texlive 2014:

>latex --version
pdfTeX 3.14159265-2.6-1.40.15 (TeX Live 2014)
kpathsea version 6.2.0

htlatex foo.tex


gives

(/usr/local/texlive/2014/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.
tex)
(/usr/local/texlive/2014/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version
-0-65.sty
! Undefined control sequence.
\pgfsys@svg@newline ->\Hnewline

l.190   \pgfusepathqfill}

?


on the texlive 2013 PC

>latex --version
pdfTeX 3.1415926-2.5-1.40.14 (TeX Live 2013)
kpathsea version 6.1.1


The same command runs with no problem and no errors and HTML is generated with image on it ok.

Has something changed with tex4ht and the pgfsys-tex4ht.def in texlive 2014?

• I get the same error with TeX Live 2013, but not with TeX Live 2012. – egreg Jun 17 '14 at 21:35
• With TL 2014, tex4ht.sty isn't loaded completely; it stops at the \fi at line 734, when the \:temp macro defined a couple of lines earlier is expanded. – egreg Jun 17 '14 at 21:50
• Well, I ran into the same issue so I have filed an actual bug report upstream. sourceforge.net/p/pgf/bugs/327 – Fizz Jul 31 '14 at 10:02
• This issue is still there in TL 2016! – Nasser Jun 16 '16 at 20:00
• In MikTeX 2.9.6670 (Mai 2018) it's also still there... – Mik May 4 '18 at 15:01

This question still doesn't have an answer, although it was answered in comments and in the question itself. I will post the answer here, because duplicate question was posted today and it can't be closed as duplicate as long as this question doesn't have accepted or upvoted answer.

This issue was reported on PGF issue tracker, even with proposed patch, but it was still not accepted and therefore the bug still persists. Until the issue is fixed, you may need to manually fix the file pgfsys-tex4ht.def. I don't recommend to edit directly the file distributed with the TeX installation, I would rather copy it to the directory with the document and make change on the copy. You can easily make a copy with:

cp kpsewhich pgfsys-tex4ht.def .


on UNIX like systems. Now find the wrong line:

 \def\pgfsys@svg@newline{\Hnewline}


\Hnewline command can be used only inside of \HCode{}, but if we change it to

 \def\pgfsys@svg@newline{\HCode{\Hnewline}}


new error messages appear, so it seems that we should use something different. Correct solution is to use:

 \def\pgfsys@svg@newline{^^J}


this will insert the newline character.

• With the latest MikTeX, using \def\pgfsys@svg@newline{{?nl}} leads to many repeated {?nl} in the output. Do you have an idea how to avoid this. Unfortunately \def\pgfsys@svg@newline{\HCode{\Hnewline}} leads to errors and the final document is not generated. – maetra Mar 27 '15 at 13:07
• @maetra I don't see this: can you check your log for file locations and versions: my system is 'up to date'. – Joseph Wright Mar 27 '15 at 19:15
• @maetra thanks, you are right, these {?nl} doesn't show, but they are in the output. it should be fixed now – michal.h21 Mar 27 '15 at 19:42
• Thanks, michal.h21. This solves my problem! @JosephWright do you still need the logfile? The nl did show up from a file of mine, not the MWE, which I should have mentioned before, sorry for that. – maetra Mar 28 '15 at 20:44
• @maetra No, I think we've got it now – Joseph Wright Mar 28 '15 at 20:45