2

This is a very strange error, and I am not able to figure it out. Took me long time to narrow it down to this MWE. tex4ht gives this strange error

(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)))
Runaway argument?
\:tempc \choose:begin {\let \choose:begin \@firstoftwo \ifx \EndPicture \ETC.
! Paragraph ended before \:tempc was complete.
<to be read again> 
                   \par

Using this MWE

\documentclass[11pt]{article}%
\usepackage{amsmath,mathtools}
\usepackage{hyperref}
\begin{document}

\begin{align}
a &= b
\end{align}

\begin{equation}
a=b
\end{equation}

\end{document}

The error shows when compiled using

 make4ht   HW1_solution.tex 'htm,0,pic-align'
Output dir:     
Compiler:   latex
Latex options:   -jobname=HW1_solution 
tex4ht.sty :    xhtml,htm,0,pic-align
tex4ht  
build_file  HW1_solution.mk4
Cannot open config file HW1_solution.mk4
setting param correct_exit
setting param correct_exit
setting param correct_exit
setting param ext
Adding:     ext dvi
LaTeX call: latex  -jobname=HW1_solution  '\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@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,htm,0,pic-align.a.b.c.\input HW1_solution'
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016) (preloaded format=latex)
 restricted \write18 enabled.
.
.
.
(/usr/local/texlive/2016/texmf-dist/tex/generic/tex4ht/html4-math.4ht))
(./HW1_solution.aux)
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)))
Runaway argument?
\:tempc \choose:begin {\let \choose:begin \@firstoftwo \ifx \EndPicture \ETC.
! Paragraph ended before \:tempc was complete.
<to be read again> 
                   \par 
l.16 

? 

This error goes away doing any one of the following, one at a time

1) compile using make4ht HW1_solution.tex 'htm,0' i.e. when removing the pic-align option !

2) remove \usepackage{hyperref} !

3) remove the \begin{equation block, i.e. like this

\documentclass[11pt]{article}%
\usepackage{amsmath,mathtools}
\usepackage{hyperref}
\begin{document}

\begin{align}
a &= b
\end{align}

\end{document}

4) remove the \begin{align}, like this

\documentclass[11pt]{article}%
\usepackage{amsmath,mathtools}
\usepackage{hyperref}
\begin{document}

\begin{equation}
a=b
\end{equation}

\end{document}

Any one would know what is the source of this error? Using tex live 2016 and I just updated all, so I have latest and greatest. Any work around?

update:

The error looks like coming from tex4ht-4ht.tex it is full of \tempc: stuff. I can't read the code, too complicated for me. I think only 5 people in the world who can read that code.

1 Answer 1

3

This is caused by recent fix to \autoref provided by hyperref package. Macros with same name are used in this fix and in configuration provided by pic-align option. The easy fix is to rename the offending macro.

You can save the following snippet as nameref.4ht and put it along yout TeX file.

% nameref.4ht (2016-12-18-16:47), generated from tex4ht-4ht.tex
% Copyright 2005-2009 Eitan M. Gurari
% Copyright 2009-2016 TeX Users Group
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3c of this license or (at your option) any
% later version. The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions
% of LaTeX version 2005/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
%
% The Current Maintainer of this work
% is the TeX4ht Project <http://tug.org/tex4ht>.
%
% If you modify this program, changing the
% version identification would be appreciated.
\immediate\write-1{version 2016-12-18-16:47}

   \let\NR:Type\relax
\let\ltx@label\label
\def\prf:label{{\ifx \NR:Title\:UnDef \else \NR:Title\fi}%
               {\ifx \NR:Type\relax \else \NR:Type .1\fi}{}}%
\let\NR:StartSec\:StartSec
\let\NR:no@sect\no@sect
\def\no@sect#1#2#3#4#5#6[#7]#8{\gdef\NR:Title{\a:newlabel{#7}}%
    \gdef\NR:Type{#1}%
    \NR:no@sect{#1}{#2}{#3}{#4}{#5}{#6}[{#7}]{#8}}
\def\:StartSec#1#2#3{%
   \gdef\NR:Title{\a:newlabel{#3}}%
   \gdef\NR:Type{#1}%
   \NR:StartSec{#1}{#2}{#3}%
}

\def\:tempc#1#2#3#4#5#6[#7]#8{%
   \gdef\NR:Title{\a:newlabel{#7}}%
   \gdef\NR:Type{#1}%
   \o:NR@sect:{#1}{#2}{#3}{#4}{#5}{#6}[{#7}]{#8}}
\HLet\NR@sect\:tempc

\def\:tempc#1#2#3#4#5{%
   \gdef\NR:Title{\a:newlabel\ssect:ttl}%
   \gdef\NR:Type{#1}%
   \o:NR@ssect:{#1}{#2}{#3}{#4}{#5}%
}
\HLet\NR@ssect\:tempc

\def\:tempc[#1]#2{%
   \gdef\NR:Title{\a:newlabel{#1}}%
   \gdef\NR:Type{part}%
   \o:no@part:[{#1}]{#2}}
\HLet\no@part\:tempc

\def\:tempc#1{%
   \gdef\NR:Title{\a:newlabel{#1}}%
   \gdef\NR:Type{part}%
   \o:no@spart:{#1}}
\HLet\no@spart\:tempc

\def\:tempc[#1]#2{%
   \gdef\NR:Title{\a:newlabel{#1}}%
   \gdef\NR:Type{chapter}%
   \o:NR@chapter:[{#1}]{#2}}
\HLet\NR@chapter\:tempc

\def\:tempc#1{%
   \gdef\NR:Title{\a:newlabel\sch:ttl}%
   \o:NR@schapter:{#1}%
   \gdef\NR:Type{chapter}%
}
\HLet\NR@schapter\:tempc

\let\o:NR@@caption\@caption
%
%
% Keith Andrews <[email protected]> reported that \@captype as
% \NR:Type threw an undefined control sequence error. I think
% \@currenvir is safe, there is nothing special about \@captype.
%
\long\def\@caption#1[#2]{%
    \gdef\NR:Type{\@currenvir}%
    \gdef\NR:Title{\a:newlabel{#2}}%
   \o:NR@@caption{#1}[{#2}]%
}

\let\o:NRorg@opargbegintheorem\@opargbegintheorem
  \def\@opargbegintheorem#1#2#3{%
    \gdef\NR:Title{\a:newlabel{#3}}%
    \gdef\NR:Type{\@currenvir}%
    \NR@gettitle{#3}%
    \defineautorefname{\@currenvir}{#1}%
    \o:NRorg@opargbegintheorem{#1}{#2}{#3}%
  }%

\let\o:NRorg@begintheorem\@begintheorem
  \def\@begintheorem#1#2{%
    \gdef\NR:Title{\a:newlabel{#1 #2}}%
    \gdef\NR:Type{\@currenvir}%
    \defineautorefname{\@currenvir}{#1}%
    \NR@gettitle{}%
    \o:NRorg@begintheorem{#1}{#2}%
  }%

\AtBeginDocument{%
  \@ifpackageloaded{listings}{%
      \def\:tempc#1{%
         \gdef\NR:Title{\a:newlabel{listing}}%
         \gdef\NR:Type{lstlisting}%
         \o:NROrg@lst@MakeCaption:{#1}%
         \gdef\@currentlabelname{listing}}
      \HLet\NROrg@lst@MakeCaption\:tempc
  }{}%
  % bug [348]
  \@ifpackageloaded{amsmath}{%
     \def\:tempg{%
       \gdef\NR:Title{\a:newlabel{equation}}%
       \gdef\NR:Type{equation}%
       \gdef\@currentlabelname{equation}%
     }
     \Configure{@begin}{align}{\:tempg}
     \Configure{@begin}{multline}{\:tempg}
     \Configure{@begin}{equation}{\:tempg}
     \Configure{@begin}{boxed}{\:tempg}
     \Configure{@begin}{equations}{\:tempg}
     \Configure{@begin}{equation}{\:tempg}
     \Configure{@begin}{gather*}{\:tempg}
     \Configure{@begin}{gather}{\:tempg}
     \Configure{@begin}{genfrac}{\:tempg}
     \Configure{@begin}{measure@}{\:tempg}
     \Configure{@begin}{multline*}{\:tempg}
     \Configure{@begin}{multline}{\:tempg}
     \Configure{@begin}{overset}{\:tempg}
     \Configure{@begin}{smallmatrix}{\:tempg}
     \Configure{@begin}{split}{\:tempg}
     \Configure{@begin}{subarray}{\:tempg}
     \Configure{@begin}{substack}{\:tempg}
     \Configure{@begin}{underset}{\:tempg}
     \Configure{@begin}{xleftarrow}{\:tempg}
     \Configure{@begin}{xrightarrow}{\:tempg}
  }{}

}
\let\T:ref=\::ref
\def\::ref{\protect\T@ref}
\def\T@ref#1{%
  \@safe@activestrue
  \let\::ref \T:ref
  \expandafter\@setref\csname r@#1\endcsname\@firstoffive{#1}%
  \def\::ref{\protect\T@ref}%
  \@safe@activesfalse
}

\gdef\defineautorefname#1#2{%
    \expandafter\gdef\csname #1autorefname\endcsname{#2}}
\defineautorefname{theorem}{Theorem}

\Configure{newlabel}
   {\csname cur:th\endcsname \csname :currentlabel\endcsname}
   {\string\csname\space :autoref\string\endcsname
     {\NR:Type}#1}

\ifx \@currentlabelname\:UnDef
   \let\@currentlabelname\empty
\fi

\pend:defIII\@setref{\edef\RefArg{##3}}
\append:defIII\@setref{\let\:autoref\:gobble}
\let\:autoref\:gobble


\Hinput{nameref}
\endinput

enter image description here

There is one issue, the equation picture contains also the equation number, we should fix that in the future, as it doesn't look nice.

2
  • thanks! I am trying it now and no longer see the errors! rebuilding everything. Will add now a bug entry in tex4ht to keep track of this issue. Thanks again for your help.
    – Nasser
    Dec 26, 2016 at 12:00
  • @Nasser OK. I've just updated the sources, so it should be fixed soon in TL
    – michal.h21
    Dec 26, 2016 at 12:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .