2

Does anybody know how to increase the space between underline and contents?

I am trying to use the template for my thesis, here is the .sty file for header.

%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
2
  • 1
    Welcome to tex.sx! wow that's old code:-) You could insert a zero width \rule with depth to push the line down but I wouldn't do that I'd instead use the facilities of the fancyhdr package. Jun 14, 2013 at 16:13
  • Dear David,thank you so much! Would you please give me more hints to modify the codes?
    – Aaron
    Jun 14, 2013 at 16:24

1 Answer 1

4

Try this; it's much more readable and customizable.

\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}
1
  • Hi, egreg, thank you so much for your help!!
    – Aaron
    Jun 15, 2013 at 1:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .