我正在使用 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
環境並未設計為跨頁面邊界的兩次工作,並且在某些情況下可能會中斷。 (文字區塊將在頁面上水平偏移。)