tufte-latex の全幅セクションタイトル

tufte-latex の全幅セクションタイトル

私は tufte-latex を使用しており、次のテキスト ブロックに全幅環境を使用する場合に、セクション タイトルをページの全幅に使用したいと考えています。ただし、この例をコンパイルしようとすると、次のようになります。

\documentclass{tufte-book}
\usepackage{lipsum}

 \begin{document}

\begin{fullwidth}
\section{This is the Title of my Section, Which I Will Make Very Long to Demonstrate the Problem I Have Using Fullwidth}
\lipsum
\end{fullwidth}
\end{document}

次のエラーが発生します:

LaTeX エラー: 何かが間違っています - おそらく \item が欠落しています

ただし、次のようにコードを実行すると、コードは機能しますが、セクション ヘッダーが狭すぎます。

\documentclass{tufte-book}
\usepackage{lipsum}

 \begin{document}

\section{This is the Title of my Section, Which I Will Make Very Long to Demonstrate the Problem I Have Using Fullwidth}
\begin{fullwidth}
\lipsum
\end{fullwidth}

\end{document}

セクションヘッダーが狭すぎる

答え1

読みやすさと一貫性の観点からは良くない考えだと思いますが、どうしてもセクションの見出しをページ全体に広げる必要がある場合は、次のようにするとうまくいくはずです。

\documentclass{tufte-handout}

\titleformat{\section}%
  [display]% shape
  {\relax\ifthenelse{\NOT\boolean{@tufte@symmetric}}{\begin{fullwidth}}{}\normalfont\Large\itshape}% format applied to label+text
  {\thesection}% label
  {1em}% horizontal separation between label and title body
  {}% before the title body
  [\ifthenelse{\NOT\boolean{@tufte@symmetric}}{\end{fullwidth}}{}]% after the title body

\usepackage{lipsum}% provides filler text

\begin{document}

\section{This is a lengthy section heading to demonstrate it sprawls across the entire page width}

\begin{fullwidth}
\lipsum
\end{fullwidth}

\end{document}

また、このfullwidth環境はページ境界を越えて動作するようには設計されていないため、場合によっては動作が中断される可能性があることにも注意してください。(テキスト ブロックはページ上で水平方向にオフセットされます。)

関連情報