目前,我正在尝试使用该命令时减少行距\part
。理想情况下,我目前正在尝试实现以下结果:
Part I: Project Scope
尽可能减少周围的填充。我该如何在 LaTeX 中实现这一点,因为我花了整个晚上寻找答案,但似乎找不到我需要的答案。
我目前有这样的东西:
\documentclass{article}
\begin{document}
\part{Project Scope}
\section{Background}
\end{document}
问候
答案1
假设您使用article
类,您可以这样做:
\documentclass{article}
\makeatletter
\def\@part[#1]#2{%
\ifnum \c@secnumdepth >\m@ne
\refstepcounter{part}%
\addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
\else
\addcontentsline{toc}{part}{#1}%
\fi
{\parindent \z@ \raggedright
\interlinepenalty \@M
\normalfont
\ifnum \c@secnumdepth >\m@ne
\Large\bfseries \partname\nobreakspace\thepart
\hskip1em
\fi
\Large \bfseries #2%
\markboth{}{}\par}%
\nobreak
\vskip 3ex
\@afterheading}
\def\@spart#1{%
{\parindent \z@ \raggedright
\interlinepenalty \@M
\normalfont
\Large \bfseries #1\par}%
\nobreak
\vskip 3ex
\@afterheading}
\makeatother
\begin{document}
\part{Project Scope}
\section{Background}
\end{document}
或这个:
\documentclass{article}
\usepackage{xpatch}
\makeatletter
\xpatchcmd{\@part}{\par\nobreak}{\hskip1em}{}{}
\xpatchcmd{\@part}{\huge \bfseries}{\Large \bfseries}{}{}
\xpatchcmd{\@spart}{\huge \bfseries}{\Large \bfseries}{}{}
\makeatother
\begin{document}
\part*{Project Scope}
\section{Background}
\end{document}