我想缩进章节标题的标题栏。下面的代码几乎完全符合我想要的章节标题显示方式,只是章节标题的第二行及以后的部分与章节编号对齐。我该怎么做?
\documentclass{report}
\usepackage{titlesec}
\titleformat{\chapter}[display]
{\normalfont\Huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Large \thechapter\ \quad}
\begin{document}
\tableofcontents
\chapter{Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction }
\section{Motivation}
\end{document}
答案1
用这个包很简单linegoal
:
\documentclass{report}
\usepackage{titlesec}
\usepackage{linegoal}
\titleformat{\chapter}[display]
{\normalfont\Huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Large \thechapter\ \quad\parbox[t]{\linegoal}}
\begin{document}
\tableofcontents
\chapter{Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction }
\section{Motivation}
\end{document}
答案2
Leandriis 的评论是相关的。然而,在有人建议使用 minipages 后,我采用了不同的方法:
\documentclass{report}
\usepackage{titlesec}
\titleformat{\chapter}[display]
{\normalfont\Huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Large \thechapter\ \quad}
\titleformat{\chapter}[display]
{\bfseries\huge}% note that \bfseries has no effect with the default fonts
{\filright\chaptertitlename~\thechapter}
{0ex}
{\vspace{1ex}%
\Large \begin{minipage}[t]{0.05\textwidth}\thechapter\end{minipage} \hspace{0.05\linewidth} \begin{minipage}[t]{.9\textwidth}}
[\end{minipage}]
\begin{document}
\tableofcontents
\chapter{Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction Introduction }
\section{Motivation}
\end{document}