LaTeX tufte-book 如何环绕章节、节、小节标题

LaTeX tufte-book 如何环绕章节、节、小节标题

我正在使用软件包编写一本书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应该具有这种格式。

相关内容