更改 epub tex4epub tex4ht 目录中章节和子章节的外观

更改 epub tex4epub tex4ht 目录中章节和子章节的外观

我希望@michal.h21 能帮助我。我尝试了你的解决方案,效果很好,但我没有提到章节和子章节也被修改了。

我用下面的例子概括了这种情况,并在图中暴露了问题 在此处输入图片描述

问题是

  • 垂直对齐与章节和子章节不一致

这是.cfg

\Preamble{xhtml,sections+}

\NewSection\subsubsubsection{\theparagraph}


\Configure{section}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\Tg<section id="section.\thesection">}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\Tg</section>}
{\HCode{<font size="+0">}%
 \NoFonts\HCode{<span class="it">}%
 \TitleMark%
 \HCode{\Hnewline}}%
{\HCode{</span>}\EndNoFonts%
 \HCode{</font>}%
 \HCode{\Hnewline}%
 \par\IgnoreIndent\ShowPar%
}
\ConfigureMark{section}{\thesection~@@@~}

\Configure{subsection}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\Tg<subsection id="subsection.\thesubsection">}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\Tg</subsection>}
{\HCode{<font size="+0">}%
 \NoFonts\HCode{<span class="it">}%
 \TitleMark%
 \HCode{\Hnewline}}%
{\HCode{</span>}\EndNoFonts%
 \HCode{</font>}%
 \HCode{\Hnewline}%
 \par\IgnoreIndent\ShowPar%
}
\ConfigureMark{subsection}{\thesubsection~@@@~}



\Configure{subsubsection}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\Tg<subsubsection id="subsubsection.\thesubsubsection">}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\Tg</subsubsection>}
{\HCode{<font size="+0">}%
 \NoFonts\HCode{<span class="it">}%
 \TitleMark%
 \HCode{\Hnewline}}%
{\HCode{</span>}\EndNoFonts%
 \HCode{</font>}%
 \HCode{\Hnewline}%
 \par\IgnoreIndent\ShowPar%
}
\ConfigureMark{subsubsection}{\thesubsubsection~@@@~}



\Configure{subsubsubsection}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\Tg<subsubsubsection id="subsubsubsection.\theparagraph">}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\Tg</subsubsubsection>}
{\addtocounter{paragraph}{1}
 \HCode{<font size="+0">}%
 \NoFonts\HCode{<span class="it">}%
 \TitleMark%
 \HCode{\Hnewline}}%
{\HCode{</span>}\EndNoFonts%
 \HCode{</font>}%
 \HCode{\Hnewline}%
 \par\IgnoreIndent\ShowPar%
}
\ConfigureMark{subsubsubsection}{\theparagraph~@@@~}
\Configure{toToc}{subsubsubsection}{paragraph}


\Css{span.it{font-style:italic;}}
\ConfigureMark{subsubsubsection}{\theparagraph~@@@~}
\Configure{toToc}{subsubsubsection}{paragraph}


\ConfigureToc{paragraph}
{~~~\HCode{<span class="paragraphToc" >}}{~@@@~}{}{\HCode{</span>}\HCode{<br />\Hnewline}}

% \ConfigureToc{subsubsubsection}
% {~~~\HCode{<span class="subsubsubsectionToc" >}}{~@@@~}{}{\HCode{</span>}\HCode{<br />\Hnewline}}

\def\newncxtox#1#2{%
  \ConfigureToc{#1}%
  {\closelevels{#2}%
  \csname a:NavSection\endcsname\csname Ncx:Mark\endcsname}
  {\csname c:NavSection\endcsname~@@@~}
  {}
  {\csname b:NavSection\endcsname%
    \finishtoclevel{#1}%
  }
}

\begin{document}
\expandafter\def\csname ncx:title\endcsname{%
  \HCode{<docTitle>\Hnewline<text>}\Title\HCode{</text>\Hnewline</docTitle>\Hnewline}
\newncxtox{section}{section}
\newncxtox{subsection}{subsection}
\newncxtox{subsubsection}{subsubsection}
\newncxtox{paragraph}{paragraph}
\newncxtox{subparagraph}{subparagraph}
}
\EndPreamble

这是 tex 文件

    \documentclass{article} 

\makeatletter
\def\subsubsubsection{%
\@startsection{paragraph}{4}{0em}{0.1\parskip}{1em}{}
}
\makeatother


\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}


    \begin{document}
    \tableofcontents
    \section{first seciton}
    \subsection{first subsection}
    \subsubsection{first subSUBsection}
    \subsubsubsection{first subSUBsubsection}

    my subsubsubsection here

    \paragraph{first para}

\subsection{AA subsection}
    \subsubsection{AA subSUBsection}
    \subsubsubsection{AA subSUBsubsection}

    my subsubsubsection here

    \paragraph{AA para}

    werfj


    \section{second seciton}
    \subsection{second subsection}
    \subsubsection{second subSUBsection}
    \subsubsubsection{second subSUBsubsection}

    my subsubsubsection here

    \paragraph{second para}


\subsection{AA subsection}
    \subsubsection{AA subSUBsection}
    \subsubsubsection{AA subSUBsubsection}

    my subsubsubsection here

    \paragraph{AA para}


    werfj

    \end{document}

答案1

的第二个参数newncxtox必须包含配置的节级别的所有子部分。这是在目录中获取正确层次结构所必需的NCX。您的示例中的问题不是间距,而是您的后续节和子节与 打印在同一级别subsubsubsections

您需要按如下方式进行更改:

\newncxtox{section}{section,subsection,subsubsection,paragraph}
\newncxtox{subsection}{subsection,subsubsection,paragraph}    
\newncxtox{subsubsection}{subsubsection} 
\newncxtox{paragraph}{paragraph}    
\newncxtox{subparagraph}{subparagraph} 

在此处输入图片描述

相关内容