我正在使用 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
环境并非设计用于跨页面边界工作,在某些情况下可能会中断。(文本块将在页面上水平偏移。)