!段落在 \doTocEntry 完成之前结束

!段落在 \doTocEntry 完成之前结束

我正在写论文,但卡在这里了。下面是我的序言和一些代码。我熟悉 latex,但不知道代码有什么问题。

\documentclass[twosided,12pt]{book}
\usepackage[authoryear,sort]{natbib}
\setcitestyle{aysep={,}} 
\usepackage{har2nat}
\usepackage{lmodern}
\usepackage[euler]{textgreek}
\usepackage{amssymb}
\usepackage{sectsty}
\usepackage{setspace}
\chapternumberfont{\LARGE}
\usepackage{geometry}
\geometry{
    paper=a4paper,
    inner=23mm,         % Inner margin
    outer=22mm,         % Outer margin
    bindingoffset=10mm, % Binding offset
    top=30mm,           % Top margin
    bottom=30mm        % Bottom margin         
}
\usepackage{wrapfig}
\usepackage[utf8]{inputenc}
\usepackage{graphicx,rotating,booktabs}
\usepackage{realboxes}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{indentfirst}
\usepackage{float}
\usepackage{multicol}
\usepackage{underscore}
\usepackage{layout}
\usepackage{lscape}
\usepackage{longtable}
\usepackage{ltablex}
\usepackage{siunitx} 
\usepackage{booktabs}
\usepackage{hvfloat}
\usepackage{multirow}
\usepackage[normalem]{ulem}
\usepackage{array}
\usepackage{calc}
\usepackage{mwe}
\usepackage{titlesec}
\usepackage{needspace}
\usepackage[export]{adjustbox}
\usepackage{url}
\usepackage{amsmath}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{gensymb}
\usepackage[nottoc,numbib]{tocbibind}
%
\begin{document}
    \frontmatter
    \doublespacing
\begin{doublespace}
    \thispagestyle{empty}
    \tableofcontents
    \listoffigures
    \listoftables
\end{doublespace}
%
\begin{figure}[!htb]
    \centering
    \includegraphics[width=0.75\linewidth,height=0.30\textheight]{xxx}%
\caption[ABC]{abc}
\label{fig:lbl}
\end{figure}%
   \subparagraph{SWS}
    The Diatoms in the ......Table.\ref{tab:xxx}. .....\par
    %
    \begin{table}[!htb]%
        \centering
        \caption[ABC.]{xyz \% IRI for each season. PrM (pre-monsoon), M (monsoon) and pm (post-monsoon); SD - Standard Deviation and CV - Coefficient of Variation.}
        \label{tab:zzz}
    \resizebox{\textwidth}{!}{%
        \begin{tabular}{@{}cccccccccc@{}}
            \toprule
            Species             & PrM    & SD    & CV    & M      & SD    & CV    & pm     & SD    & CV    \\ \midrule
            Diatoms             & 86.119 & 6.141 & 0.071 & 90.482 & 6.684 & 0.074 & 92.551 & 2.124 & 0.023 \\
            Dinoflagellates     & 6.156  & 4.201 & 0.683 & 2.982  & 2.222 & 0.745 & 3.284  & 1.606 & 0.489 \\
            Copepods            & 1.630  & 0.480 & 0.294 & 0.736  & 0.747 & 1.015 & 1.589  & 1.085 & 0.683 \\
            Tintinnids          & 3.903  & 1.584 & 0.406 & 1.639  & 0.597 & 0.364 & 1.204  & 0.989 & 0.822 \\
            Zooplankton         & 0.000  & 0.000 & 0.000 & 0.000  & 0.000 & 0.000 & 0.000  & 0.000 & 0.000 \\
            Cladoceran          & 0.000  & 0.000 & 0.000 & 0.001  & 0.002 & 1.283 & 0.000  & 0.000 & 0.000 \\
            Detritus            & 0.000  & 0.000 & 0.000 & 0.000  & 0.000 & 0.000 & 0.000  & 0.000 & 0.000 \\
            Fish egg            & 0.176  & 0.146 & 0.832 & 0.101  & 0.169 & 1.665 & 0.029  & 0.023 & 0.766 \\
            Foraminifera        & 0.000  & 0.000 & 0.000 & 0.000  & 0.000 & 1.170 & 0.002  & 0.001 & 0.500 \\
            Copepod egg         & 0.249  & 0.291 & 1.164 & 0.177  & 0.354 & 2.000 & 0.000  & 0.000 & 0.500 \\
            Dinoflagellate cyst & 0.000  & 0.000 & 0.000 & 0.000  & 0.000 & 1.170 & 0.002  & 0.001 & 0.500 \\
            Others              & 1.767  & 0.389 & 0.220 & 3.881  & 4.625 & 1.192 & 1.336  & 0.432 & 0.323 \\
            Sand                & 0.000  & 0.000 & 0.000 & 0.000  & 0.000 & 0.004 & 0.004  & 0.003 & 0.907 \\ \bottomrule
        \end{tabular}%
        }
    \end{table}%
This is next paragraph
%
\end{document}

pdflatex运行正常,并获得了输出,但hlatex在尝试获取 Html 输出时显示错误

    Runaway argument?
{\csname a:TocLink\endcsname {1}{x1-18002}{}{\numberline {1}{\ignorespaces \ETC
.
! Paragraph ended before \doTocEntry was complete.
<to be read again> 
                   \par 
l.34 \par
         
?

答案1

我没有收到您的 MWE 的任何编译错误,但是存在一些问题: 在此处输入图片描述

您可以看到图标题中有两个冒号,并且该\subparagraph命令生成了多行单独的代码。这些问题是由captiontitlesec包引起的。修复程序已包含在 TeX4ht 源中,因此它们应该会在几天内出现在 TeX Live 中。与此同时,您可以使用包含修复程序的以下配置文件myconfig.cfg

\Preamble{xhtml}
\catcode`\:=11
\makeatletter

% fix for titlesec
\def\:tempc#1#2#3#4{%
  \begingroup
  \let\everypar\@gobble% we must prevent titlesec from touching of \everypar
  \edef\sc:tp{\ifttl@label\else like\fi #1}%
   \let\ttl@savewrite\empty
   \o:ttl@select:{#1}{#2}{#3}{#4}
   \endgroup
}
\HLet\ttl@select\:tempc

% fix for caption

\long\def\@makecaption#1#2{%
  \caption@make@above%
  \cptA:\caption@@make{\cap:ref{#1}}{\cptC:#2}\cptD:%
  \caption@make@below%
}
\makeatother
\catcode`\:=12
\begin{document}
\EndPreamble

使用以下方式编译文件

make4ht -c myconfig.cfg filename.tex

结果如下:

在此处输入图片描述

顺便说一句,请不要使用htlatex,它已被弃用。make4ht是使用 TeX4ht 转换 TeX 文件的推荐工具。

相关内容