! 段落在 \:tempc 完成之前结束。tex4ht 错误

! 段落在 \:tempc 完成之前结束。tex4ht 错误

这是一个非常奇怪的错误,我无法弄清楚。我花了很长时间才将其缩小到这个 MWE。tex4ht 给出了这个奇怪的错误

(/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

使用此 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}

使用以下方式编译时显示错误

 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 

? 

执行下列任一操作后,此错误将消失(一次一个)

1)使用make4ht HW1_solution.tex 'htm,0' ie 编译时移除选项pic-align

2)删除\usepackage{hyperref}

3)删除\begin{equation块,例如这样

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

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

\end{document}

4)删除\begin{align},像这样

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

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

\end{document}

有人知道这个错误的根源是什么吗?使用 tex live 2016,我刚刚更新了所有内容,所以我拥有最新和最好的版本。有什么解决办法吗?

更新:

错误似乎来自tex4ht-4h.tex里面全是\tempc:东西。我看不懂代码,对我来说太复杂了。我认为世界上只有 5 个人能读懂这段代码。

答案1

这是由于最近\autoref对包提供的修复造成的hyperref。此修复和选项提供的配置中使用了同名的宏pic-align。简单的修复方法是重命名有问题的宏。

您可以将以下代码片段保存为nameref.4ht并将其放在您的 TeX 文件中。

% 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

在此处输入图片描述

有一个问题,方程式图片也包含方程式编号,我们应该在将来修复它,因为它看起来不太好看。

相关内容