我怎样才能在一行(换行)内列出目录中某一章节下的所有部分(没有页码也可以)?谢谢。
预期的,:
Chapter 1 .................................................... 10
section 1 -- section 2 -- section3 -- section 4 - secti-
on5 -- section6 -- section 7
Chapter 2 .....................................................15
section 1 -- section 2 -- section3 -- section 4 - secti-
on5 -- section6
答案1
这LaTeX 伴侣 2ed包含此类请求的一些示例,例如 2-3-12.ltx、2-3-13.ltx,可在 CTAN 上找到
以下是其中之一:
\begin{filecontents}{partial.toc}
\contentsline {chapter}{\numberline {2}The Structure of a \LaTeX {} Document}{15}
\contentsline {section}{\numberline {2.1}The structure of a source file}{15}
\contentsline {subsection}{\numberline {2.1.1}Processing of options and packages}{17}
\contentsline {subsection}{\numberline {2.1.2}Splitting the source file into parts}{18}
\contentsline {subsection}{\numberline {2.1.3}Combining several files}{20}
\contentsline {subsection}{\numberline {2.1.4}\texttt {optional}---Providing variants in the document source}{21}
\contentsline {section}{\numberline {2.2}Sectioning commands}{22}
\contentsline {subsection}{\numberline {2.2.1}Numbering headings}{24}
\contentsline {subsection}{\numberline {2.2.2}Formatting headings}{27}
\contentsline {subsection}{\numberline {2.2.3}Changing fixed heading texts}{34}
\contentsline {subsection}{\numberline {2.2.4}\texttt {fncychap}---Predefined chapter heading layouts}{34}
\contentsline {subsection}{\numberline {2.2.5}\texttt {quotchap}---Mottos on chapters}{35}
\contentsline {subsection}{\numberline {2.2.6}\texttt {titlesec}---A different approach to headings}{36}
\contentsline {subsubsection}{The basic interface}{37}
\contentsline {subsubsection}{The extended interface}{38}
\contentsline {subsubsection}{Conditional heading layouts}{43}
\contentsline {subsubsection}{Changing the heading hierarchy}{44}
\contentsline {section}{\numberline {2.3}Table of contents structures}{45}
\contentsline {subsection}{\numberline {2.3.1}Entering information into the contents files}{46}
\contentsline {subsection}{\numberline {2.3.2}Typesetting a contents list}{49}
\contentsline {subsection}{\numberline {2.3.3}Combining contents lists}{52}
\contentsline {subsection}{\numberline {2.3.4}Providing additional contents files}{54}
\contentsline {subsection}{\numberline {2.3.5}\texttt {shorttoc}---Summary table of contents}{55}
\contentsline {subsection}{\numberline {2.3.6}\texttt {minitoc}---Multiple tables of contents}{56}
\contentsline {subsection}{\numberline {2.3.7}\texttt {titletoc}---A different approach to contents lists}{58}
\contentsline {subsubsection}{Contents entries combined in a paragraph}{62}
\contentsline {subsubsection}{Generating partial table of contents lists}{64}
\contentsline {section}{\numberline {2.4}Managing references}{66}
\contentsline {subsection}{\numberline {2.4.1}\texttt {showkeys}---Displaying the reference keys}{68}
\contentsline {subsection}{\numberline {2.4.2}\texttt {varioref}---More flexible cross-references}{68}
\contentsline {subsection}{\numberline {2.4.3}\texttt {prettyref}---Adding frills to references}{75}
\contentsline {subsection}{\numberline {2.4.4}\texttt {titleref}---Non-numerical references}{76}
\contentsline {subsection}{\numberline {2.4.5}\texttt {hyperref}---Active references}{78}
\contentsline {subsection}{\numberline {2.4.6}\texttt {xr}---References to external documents}{78}
\contentsline {chapter}{\numberline {3}Basic Formatting Tools}{79}
\contentsline {section}{\numberline {3.1}Phrases and paragraphs}{80}
\contentsline {subsection}{\numberline {3.1.1}\texttt {xspace}---Gentle spacing after a macro}{80}
\contentsline {subsection}{\numberline {3.1.2}\texttt {ellipsis}, \texttt {lips}---Marks of omission}{81}
\contentsline {subsection}{\numberline {3.1.3}\texttt {amsmath}---Nonbreaking dashes}{83}
\contentsline {subsection}{\numberline {3.1.4}\texttt {relsize}---Relative changes to the font size}{83}
\contentsline {subsection}{\numberline {3.1.5}\texttt {textcase}---Change case of text intelligently}{85}
\contentsline {subsection}{\numberline {3.1.6}\texttt {ulem}---Emphasize via underline}{87}
\contentsline {subsection}{\numberline {3.1.7}\texttt {soul}---Letterspacing or stealing sheep}{88}
\contentsline {subsection}{\numberline {3.1.8}\texttt {url}---Typesetting \MakeUppercase {url}{}s, path names, and the like}{93}
\contentsline {subsection}{\numberline {3.1.9}\texttt {euro}---Converting and typesetting currencies}{96}
\contentsline {subsection}{\numberline {3.1.10}\texttt {lettrine}---Dropping your capital}{99}
\contentsline {subsection}{\numberline {3.1.11}Paragraph justification in \LaTeX}{102}
\contentsline {subsubsection}{Unjustified text}{103}
\contentsline {subsection}{\numberline {3.1.12}\texttt {ragged2e}---Enhancing justification}{105}
\contentsline {subsection}{\numberline {3.1.13}\texttt {setspace}---Changing interline spacing}{106}
\contentsline {subsection}{\numberline {3.1.14}\texttt {picinpar}---Making rectangular holes}{108}
\contentsline {section}{\numberline {3.2}Footnotes, endnotes, and marginals}{109}
\contentsline {subsection}{\numberline {3.2.1}Using standard footnotes}{110}
\contentsline {subsection}{\numberline {3.2.2}Customizing standard footnotes}{112}
\contentsline {subsection}{\numberline {3.2.3}\texttt {ftnright}---Right footnotes in a two-column environment}{114}
\contentsline {subsection}{\numberline {3.2.4}\texttt {footmisc}---Various footnotes styles}{114}
\contentsline {subsection}{\numberline {3.2.5}\texttt {perpage}---Resetting counters on a ``per page'' basis}{120}
\contentsline {subsection}{\numberline {3.2.6}\texttt {manyfoot}---Independent footnotes}{122}
\contentsline {subsection}{\numberline {3.2.7}\texttt {endnotes}---An alternative to footnotes}{125}
\contentsline {subsection}{\numberline {3.2.8}Marginal notes}{126}
\contentsline {section}{\numberline {3.3}List structures}{128}
\contentsline {subsection}{\numberline {3.3.1}Modifying the standard lists}{128}
\contentsline {subsubsection}{Customizing the \texttt {itemize} list environment}{128}
\contentsline {subsubsection}{Customizing the \texttt {enumerate} list environment}{129}
\contentsline {subsubsection}{Customizing the \texttt {description} list environment}{131}
\contentsline {subsection}{\numberline {3.3.2}\texttt {paralist}---Extended list environments}{132}
\contentsline {subsubsection}{Enumerations}{132}
\contentsline {subsubsection}{Itemizations}{135}
\contentsline {subsubsection}{Descriptions}{136}
\contentsline {subsubsection}{Adjusting defaults}{136}
\contentsline {subsection}{\numberline {3.3.3}\texttt {amsthm}---Providing headed lists}{138}
\contentsline {subsubsection}{Defining the style of headed lists}{140}
\contentsline {subsubsection}{Advanced customization}{141}
\contentsline {subsubsection}{Proofs and the QED symbol}{143}
\contentsline {subsection}{\numberline {3.3.4}Making your own lists}{144}
\contentsline {section}{\numberline {3.4}Simulating typed text}{151}
\contentsline {subsection}{\numberline {3.4.1}Simple verbatim extensions}{152}
\contentsline {subsection}{\numberline {3.4.2}\texttt {upquote}---Computer program style quoting}{153}
\contentsline {subsection}{\numberline {3.4.3}\texttt {fancyvrb}---Highly customizable verbatim environments}{155}
\contentsline {subsubsection}{Customization keywords for typesetting}{155}
\contentsline {subsubsection}{Limiting the displayed data}{162}
\contentsline {subsubsection}{Variant environments and commands}{164}
\contentsline {subsubsection}{Defining your own variants}{164}
\contentsline {subsubsection}{Miscellaneous features}{165}
\contentsline {subsection}{\numberline {3.4.4}\texttt {listings}---Pretty-printing program code}{168}
\end{filecontents}
\documentclass{report}
\setlength\textwidth{231.0pt}
\usepackage{titletoc}
\contentsmargin{0pt}
\titlecontents{chapter}[0pt]
{\addvspace{1.4pc}\bfseries}
{{\Huge\thecontentspage\quad}}{}{}
\newcommand\xquad
{\hspace{1em plus.4em minus.4em}}
\titlecontents*{section}[0pt]
{\filright\small}{}{}
{,~\thecontentspage}
[\xquad\textbullet\xquad][.]
\setcounter{tocdepth}{1}
\begin{document}
\input{partial.toc}\contentsfinish
\end{document}
结果如下:
书籍示例使用特殊.toc
文件来始终在不同示例中显示相同的结构,但是,当然,\tableofcontents
如果文档有章节和节,则不会简单地使用作品。在上面的示例中,章节条目具有反转的标题和页码,但显然可以通过删除或更改\titlecontents
“章节”的声明来轻松更改。