下划线与内容之间的空格

下划线与内容之间的空格

有人知道如何增加下划线和内容之间的间距吗?

我正在尝试将模板用于我的论文,这是标题的 .sty 文件。

%UHEAD.STY  If this is included after \documentstyle{report}, it adds
% an underlined heading style to the LaTeX report style.
% \pagestyle{uheadings} will put underlined headings at the top
% of each page. The right page headings are the Chapter titles and
% the left page titles are supplied by \def\lefthead{text}.

% Ted Shapin, Dec. 17, 1986

\makeatletter
\def\chapapp2{Chapter}

\def\appendix{\par
 \setcounter{chapter}{0}
 \setcounter{section}{0}
 \def\chapapp2{Appendix}
 \def\@chapapp{Appendix}
 \def\thechapter{\Alph{chapter}}}

\def\ps@uheadings{\let\@mkboth\markboth
% modifications
\def\@oddhead{\protect\underline{\protect\makebox[\textwidth][l]
        {\bfseries\upshape\rightmark\hfill\bfseries\thepage}}}
\def\@oddfoot{}
\def\@evenfoot{}
\def\@evenhead{\protect\underline{\protect\makebox[\textwidth][l]
        {\rm\thepage\hfill\sl\leftmark}}}
% end of modifications
\def\chaptermark##1{\markboth {\ifnum \c@secnumdepth >\m@ne
 \chapapp2\ \thechapter. \ \fi ##1}{}}%
\def\sectionmark##1{\markright {\ifnum \c@secnumdepth >\z@
   \thesection. \ \fi ##1}}}
\makeatother

答案1

尝试一下这个;它更具可读性和可定制性。

\documentclass{book}

\usepackage{fancyhdr}
\pagestyle{fancy}
\makeatletter
\def\chapapp{\@chapapp} % The LaTeX kernel doesn't make \@chapapp public
\makeatother

\renewcommand\chaptermark[1]{%
  \markboth{\ifnum\value{secnumdepth}>-1 \chapapp\ \thechapter. \ \fi #1}{}}
\renewcommand\sectionmark[1]{%
  \markright{\ifnum\value{secnumdepth}>0 \thesection. \ \fi #1}}
\fancyhf{}
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[RE]{\bfseries\leftmark}
\fancyhead[LO]{\bfseries\rightmark}

\usepackage{etoolbox}
\preto\appendix{\cleardoublepage} % a useful adjustment

\usepackage{kantlipsum} % just for the example

\begin{document}

\frontmatter
\tableofcontents

\mainmatter
\chapter{A chapter}
\section{A section}
\kant[1-10]
\appendix
\chapter{An appendix}
\section{An appendix section}
\kant[1-10]
\end{document}

相关内容