我正在编写一本手册。我可以调用目录,它工作正常(可以选择在编号和标题前面写上“章节”),但是一旦我离开\include
输入文件夹,它就会停止换行。我需要如何修改我的代码?
\documentclass[a4paper,12pt]{book}
\setcounter{tocdepth}{1}
\usepackage{setspace}
\usepackage{titletoc}% http://ctan.org/pkg/titletoc
\titlecontents*{chapter}% <section-type>
[0pt]% <left>
{}% <above-code>
{\bfseries\chaptername\ \thecontentslabel\quad}% <numbered-entry-format>
{}% <numberless-entry-format>
{\bfseries\hfill\contentspage}% <filler-page-format>
\setlength{\parindent}{0pt} % never indent first line
\begin{document}
\thispagestyle{empty}
%Table of Content
\doublespacing
\tableofcontents
\onehalfspacing
\thispagestyle{empty}
\newpage
\chapter*{Foreword}
\addcontentsline{toc}{section}{Foreword}
\chapter{Introduction}
\section{Why join?}
\include{input/test}
\chapter{Breaks here}
\end{document}
“测试” 简单来说
\chapter{Doesn't break without section}
dsfds
%\section{See}
答案1
\include
与问题无关。请使用\titlecontents
,而不是titlecontents*
。后者是为了避免条目之间出现换行符。
\documentclass[a4paper,12pt]{book}
\usepackage{titletoc}% http://ctan.org/pkg/titletoc
\titlecontents{chapter}% <section-type>
[0pt]% <left>
{}% <above-code>
{\bfseries\chaptername\ \thecontentslabel\quad}% <numbered-entry-format>
{\bfseries}% <numberless-entry-format>
{\bfseries\hfill\contentspage}% <filler-page-format>
\setcounter{tocdepth}{1}
\begin{document}
\tableofcontents
\chapter*{Foreword}
\addcontentsline{toc}{chapter}{Foreword}
\chapter{Introduction}
\chapter{Breaks here}
\end{document}