I am using the make4ht configuration from this answer to extract width as a fraction of textwidth from LaTeX code and add it to the CSS file. The configuration works as expected until I add a TikZ picture anywhere in the document. The MWE from that question compiles correctly, but the following code generates an error (the error is there even if we delete the minipages entirely from the code below, I just left them in there to make sure any solutions proposed keep the minipage widths intact):
\documentclass{article}
\ifdefined\HCode
\def\pgfsysdriver{pgfsys-dvisvgm4ht.def}
\fi
\usepackage{tikz,amsmath,blindtext}
\begin{document}
\noindent Text before.\medskip
\noindent
\begin{minipage}[t]{1.0\textwidth}
\begin{minipage}[t]{0.4\textwidth}
\blindtext
\end{minipage}
\hfill
\begin{minipage}[t]{0.5\textwidth}
\blindtext
\end{minipage}
\end{minipage}
\begin{center}
\usetikzlibrary{arrows,positioning}
\begin{tikzpicture}[>=latex']
\node [draw, text width=1.3cm, text centered] (s) {system $y=u$};
\draw [->] node[coordinate,left=1cm of s](u){} (u) -- node [above, near start] {$u$} (s);
\draw [->] (s) node[coordinate,right=1cm of s](y){} -- node [above, near end] {$y$} (y);
\end{tikzpicture}
\end{center}
\end{document}
The error message is:
[ERROR] htlatex: ? 21 Argument of \striptextwidth has an extra }.
[ERROR] htlatex: ? 21 Paragraph ended before \striptextwidth was complete.
[ERROR] htlatex: ? 21 Missing number, treated as zero.
[ERROR] htlatex: ? 21 Illegal unit of measure (pt inserted).
[ERROR] htlatex: ? 21 Missing ) inserted for expression.
Any ideas on what the conflict is and how to fix it?
UPDATE: If I remove the text width = 1.3cm option from the node above, the error disappears and everything works as expected, but for some figures, I need multi line node text, so I need to restrict the text width.
