在每个单独的 HTML 页面中使用 htlatex 拆分 LaTeX 文档时,如何添加单独的目录?

在每个单独的 HTML 页面中使用 htlatex 拆分 LaTeX 文档时,如何添加单独的目录?

相关问题tex4ht:限制目录

我放弃尝试了。这太难了。

我有这个文件

\section A
\section B
  \subsection B.1
  \subsection B.2
\section C

我想要一个主目录,但也希望每个部分都有目录,包括其子部分。我可以使用 htlatex 将文档分为 2 个级别。因此,主级别将包含此目录

section A
section B
 subsection B.1
 subsection B.2
section C

然后,当单击 B 部分链接时,它会按预期打开一个新页面,现在所有 B.1 和 B.2 部分都按预期位于该 html 页面中。但我希望此页面中也包含另一个目录,因为它有许多子部分。所以我需要像这样的目录

section B
 subsection B.1
 subsection B.2

在其自己的 HTML 页面上。但现在那里没有这样的目录。第一个 HTML 页面上只有一个主要的全局目录。

这是我使用的命令

 htlatex foo.tex "htm,2"

我也尝试了其中的配置文件 \ConfigureToc{chapter}{section}{}{}{}。但我只得到一个目录。

 foo.tex:
 \documentclass[]{article}%
 \begin{document}
 \tableofcontents
    \section{A}
    \section{B}
      \subsection{B1}
      \subsection{B2}
      \subsection{B3}
    \section{C}
 \end{document}

 foo.cfg:        
 \Preamble{xhtml,mathml,NoFonts,ext=htm,charset="utf-8"}
    \ConfigureToc{chapter}{section}{}{}{} %?
  \begin{document}
  %\TocAt{chapter,section} ?
  \EndPreamble

 command:
 htlatex foo.tex "nma.cfg,htm,2" " -cunihtf" 

也尝试过

 htlatex foo.tex "nma.cfg,htm,3" " -cunihtf" 

您知道如何在每个单独的 HTML 页面中创建目录吗?

答案1

尝试这个foo.cfg

\Preamble{xhtml,mathml,NoFonts,ext=htm,charset="utf-8"}
  \begin{document}
  \TocAt{section,subsection}
  \EndPreamble

第一个参数\TocAt需要配置部分级别,然后是需要打印的部分级别列表

编辑

htlatex foo "foo, 2, info"如果你在文件中运行,则会有一些信息foo.log

Tables of Contents
------------------

Created from the entries collected in the previous compilation within
a jobname.4tc file.

\ConfigureToc{unit-name} ......................4

   #1 before unit number
   #2 before content
   #3 before page number
   #4 at end

   * Empty arguments request the omission of the corresponding field.

   * \TocCount  Specifies the entry count withing the jobname.4tc file.

   * \TitleCount Count of entries submitted to the toc file

   * An alternative to \ConfigureToc{unit-name}:

      \def\toc<unit-name>#1#2#3{<before unit number>#1<before content>#2%
                             <before page number>#3<at end>}


   Example:

        \ConfigureToc{section}
           {}
           {\Picture[*]{pic.jpg width="13"  height="13"}~}
           {}
           {\HCode{<br />}}


\Configure{TocLink}..................4

   Configures the link offered in the third arguments of \ConfigureToc

   Example:   \Configure{TocLink}{\Link{#2}{#3}#4\EndLink}

\TocAt{#1,#2,#3,...}

    #1           section type for which local tables of contents
                 \Toc#1 are requested
    #2,#3,...    sectioning types to be included in the tables of
                 contents

    The non-leading arguments may be preceded by slashes '/', in
    which cases the arguments specify end points for the tables.

    The default setting requests automatic insertion of the local
    tables immediately after the sectioning heads.

    A star `*' character may be introduced, between the  \TocAt and
    the left brace, to request the appearances of the tables of
    contents at the end of the units' prefaces.

    A hyphen `-' character, on the other hand, disables the automatic
    insertions of the local tables.

    In case of a single argument, the command removes the
    existing definition of \Toc#1.

    Example:
      \TocAt{mychapter,mysection,mysubsection,/myappendix,/mypart}
      \TocAt-{mysection,mysubsection,/mylikesection}
      \section{...}...\Tocmysection

    The definition  of the local table of contents can be redefined
    within \csname Toc#1\endcsname.

    Example:

       \TocAt{section}
       \def\Tocsection{\TableOfContents[section]}

       \Css{div.sectionTOCS {
                           width : 30\%;
                           float : right;
                      text-align : left;
                  vertical-align : top;
                     margin-left : 1em;
                       font-size : 85\%;
                background-color : \#DDDDDD;
           }}

    Example: Table of content before the section title.

       \Configure{section}{}{}
          {\Tocsection \let\saveTocsection=\Tocsection
           \def\Tocsection{\let\Tocsection=\saveTocsection}%
           \ifvmode \IgnorePar\fi \EndP\IgnorePar
           \HCode{<h3 class="sectionHead">}\TitleMark\space\HtmlParOff}
          {\HCode{</h3>}\HtmlParOn\ShowPar \IgnoreIndent \par}


\Configure{TocAt}......................2
\Configure{TocAt*}.....................2

   #1 before the tables of contents
   #2 after the tables of contents

相关内容