2

I'm writing my thesis and stuck here. Below is my preamble and some code. I'm knew to latex and Don't know what is the problem with the code.

\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 is running ok and output is obtained but hlatex showing error while trying to obtain an Html output

    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
         
?
  • Latex code successfully gives a pdf output, however, while trying for an html output with text4ht it produces the error "! Paragraph ended before \doTocEntry was complete.". Not able to understand the issue. – Sajna v.h Nov 20 at 15:19
  • 1
    Welcome to TeX.SX! It would be helpful if you provided a little more context for others to understand what you're trying to do, and what is not working. Also, while your example is helpful, it is probably not enough. It is always more helpful if you provide a complete example that others can just copy-paste and compile themselves, so it should begin with \documentclass{...} and end with \end{document}. You can look here for tips on examples to include in questions on this site. – Vincent Nov 20 at 15:43
  • I don't get any compilation error for your file, there are only some formatting issues, caused by package clashes. Do you use up-to date TeX distribution? – michal.h21 Nov 20 at 19:07
  • I figured out that text4ht shows the error while compiling some figures and tables in it (only some). I checked for any extra '{' and '(' in the caption but everything is ok. Yet the error exists. How can I know what is actually causing the problem? – Sajna v.h Nov 21 at 3:07
  • @Sajnav.h do you get this error for this example? you may just have an older installation, where some bugs aren't fixed yet. – michal.h21 Nov 21 at 8:21
1

I don't get any compilation error for your MWE, but there are some issues: enter image description here

You can see that there are two colons in the figure caption, and the \subparagraph command produces several separate lines. These issues are caused by the caption and titlesec packages. The fixes are already incorporated in the TeX4ht sources, so they should be avalable in TeX Live in few days. In the meantime, you can use the following configuration file that contains the fixes, 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

Compile your file using

make4ht -c myconfig.cfg filename.tex

This is the result:

enter image description here

BTW, please don't use htlatex, it is deprecated. make4ht is the recommended tool to convert your TeX file with TeX4ht.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.