我正在使用软件包编写一本书tufte-book
。我的一些章节标题和部分标题太长了。但我不知道如何让它环绕而不是进入页边距并超出页面。代码如下。我怀疑它与命令有关,\begin{fullwidth}
但我不确定。
\titleformat{\chapter}%
[display]% shape
{\relax\ifthenelse{\NOT\boolean{@tufte@symmetric}}{\begin{fullwidth}}{}}% format applied to label+text
{\itshape
\thechapter}% label
{0pt}% horizontal separation between label and title body
{\Large\rmfamily\allcaps}% before the title body
[\ifthenelse{\NOT\boolean{@tufte@symmetric}}{\end{fullwidth}}{}]% after the title body
\titleformat{\section}%
[hang]% shape
{\normalfont\large\itshape}% format applied to label+text
{\thesection}% label
{1em}% horizontal separation between label and title body
{}% before the title body
[]% after the title body
\titleformat{\subsection}%
[hang]% shape
{\normalfont\large\itshape}% format applied to label+text
{\thesubsection}% label
{1em}% horizontal separation between label and title body
{}% before the title body
[]% after the title body
答案1
尝试这个:
\documentclass{tufte-book}
\usepackage{lipsum}
\makeatletter
\titleformat{\chapter}%
[display]% shape
{\begin{minipage}{\linewidth}}% format applied to label+text
{\itshape
\thechapter}% label
{0pt}% horizontal separation between label and title body
{\Large\rmfamily\allcaps}% before the title body
[\end{minipage}]% after the title body
\makeatother
\begin{document}
\tableofcontents
\chapter{A somehow very long title that goes right into the margins}
\lipsum
\end{document}
您需要将fullwidth
环境更改为minipage
如上面的代码所示。AMWE
应该具有这种格式。