我正在使用一个名为虚化,以书本课程为依据,对我的硕士论文进行格式化。
我的目标是将章节编号插入到章节标题的左侧,使其与左边距对齐并保留自定义标题行。
我试图改变\@makechapterhead
和\@makeschapterhead
以及小节的定义,正如相关文章所指出的那样如何设置章节标题的格式?。下面是我尝试的输出(左边)和原始输出(右边)。
如您所见,我在尝试插入章节编号时引入了一些空格,将标题行和章节标题都向右移动。带星号的命令版本中也发生了同样的情况:
有想法该怎么解决这个吗?
这是我的 MWE:
\documentclass[oneside,msc]{ufpethesis}
\usepackage{lipsum}
\makeatletter
\def\thickhrule{\leavevmode \leaders \hrule height 1ex \hfill \kern \z@}
\def\position{\centering}
\renewcommand{\@makechapterhead}[1]{
\global\topskip 1.5pc
\relax
\begingroup
\ignorespaces
\LARGE\bfseries \thechapter\enspace
\ifnum\c@secnumdepth>\m@ne
\leavevmode \hskip-\leftskip
\rlap{\vbox to\z@{\vss
\centering\large\sc{\chaptername}\enspace\thechapter
\vskip2.5pc}}\hskip\leftskip\fi
#1\par \endgroup
\skip@4pc \advance\skip@-\normalbaselineskip
\vskip\skip@ }
\def\@makeschapterhead#1{
\global\topskip 1.5pc\relax
\begingroup
\LARGE\bfseries %\centering
#1\par \endgroup
\skip@4pc \advance\skip@-\normalbaselineskip
\vskip\skip@ }
\def\section{%
\@startsection{section}{1}{0mm}{1.5\baselineskip}
{\baselineskip}{\large\bfseries}}
\def\subsection{%
\@startsection{subsection}{2}{0mm}{1.2\baselineskip}
{.6\baselineskip}{\bfseries}}
\def\subsubsection{%
\@startsection{subsubsection}{3}{0mm}{\baselineskip}
{.6\baselineskip}{\normalfont}}
\def\paragraph{%
\@startsection{paragraph}{4}{0mm}{\baselineskip}
{-1em}{\itshape}}
\def\colophon{%
\if@openright\cleardoublepage\else\clearpage\fi
\thispagestyle{empty}
\null\vfill
\small\noindent
\@colophontext
}
\def\abstract{%
\gdef\@keywordsname{\keywordsnameEN}
\chapter*{\centerline\abstrname}}
%% Inicio do documento
\begin{document}
\chapter{Capitulo segundo}
\section{Trial}
\section{Seção especial}
Teste
\end{document}
这里还有一个版本托管在 sharelatex。
答案1
由于缺乏对 TeX 基本知识,我只能使用软件包来解决问题titlesec
,这要感谢 @Bernard 的建议。我设法根据自己的喜好调整了输出。经过这些调整后,结果如下所示:
\documentclass[oneside,msc]{ufpethesis}
%% Preamble
\usepackage{lipsum} % Cria texto "miolo de pote"
\usepackage{titlesec} % Modifica títulos
% Title adjustments (appearance and spacking)
\titleformat{\chapter}[hang]
{\LARGE\normalfont\bfseries}
{\thechapter}{0.5em}{}
\titleformat{name=\chapter,numberless}[hang]
{\normalfont\LARGE\bfseries\filcenter}{}{1ex}{}{}
\titleformat{\section}[hang]{\normalfont\bfseries}{\thesection}{0.5em}{}
\titleformat{\subsection}[hang]{\normalfont\bfseries}{\thesubsection}{0.5em}{}
\titleformat{\subsubsection}[hang]{\normalfont\bfseries}{\thesubsubsection}{0.5em}{}
\titleformat{\paragraph}[hang]{\normalfont\bfseries}{\theparagraph}{0.5em}{}
\titlespacing{\chapter}{0pt}{0pt}{40pt}
\titlespacing{\section}{0pt}{\baselineskip}{0.625\baselineskip}
\titlespacing{\subsection}{0pt}{\baselineskip}{0.6\baselineskip}
\titlespacing{\subsubsection}{0pt}{\baselineskip}{\baselineskip}
\titlespacing{\paragraph}{0pt}{\baselineskip}{\baselineskip}
\begin{document}
\chapter{Capitulo segundo}
\section{Trial}
\section{AnotherTrial}
\subsection{Seção especial}
\subsubsection{Meu teste}
\paragraph{Paragrafo teste}
\end{document}
结果: