2

My headrule is offset throught my thesis. It looks like this:

enter image description here

I found a MWE that displays the same behaviour:

\documentclass{article}
\usepackage{titleps}% http://ctan.org/pkg/titleps


\expandafter\def\expandafter\normalsize\expandafter{%

    \setlength\abovedisplayskip{20pt}
    \setlength\belowdisplayskip{20pt}
    \setlength\abovedisplayshortskip{5pt}
    \setlength\belowdisplayshortskip{20pt}
}


\newpagestyle{main}{
\setheadrule{.4pt}% Header rule
\sethead{\thesubsection\ \subsectiontitle}% left
        {}%                                 center
        {\thesection\ \sectiontitle}%       right
}

\pagestyle{main}

\begin{document}

This is the introduction. This is the introduction. This is the introduction. This is the introduction. This is the introduction. This is the introduction. This is the introduction. This is the introduction. 
\section{A section}

This is the introduction. This is the introduction. This is the introduction. This is the introduction. This is the introduction. This is the introduction. 

\subsection{A subsection}
dsd
\subsubsection{A subsubsection}
\end{document}

I realized that the issue is caused by the command \expandafter\def\expandafter\normalsize\expandafter. If I remove it the issue disappears. However I cannot remove it as I need it for spacing equations.

What should I do?

Thanks

0

2 Answers 2

1

I think you've lost a bit of the code you're copying:

\documentclass{article}
\usepackage{titleps}

\expandafter\def\expandafter\normalsize\expandafter{%
  \normalsize
  \setlength\abovedisplayskip{20pt}%
  \setlength\belowdisplayskip{20pt}%
  \setlength\abovedisplayshortskip{5pt}%
  \setlength\belowdisplayshortskip{20pt}%
}

\newpagestyle{main}{%
  \setheadrule{.4pt}% Header rule
  \sethead{\thesubsection\ \subsectiontitle}% left
          {}%                                 center
          {\thesection\ \sectiontitle}%       right
}

\pagestyle{main}

\begin{document}

This is the introduction. This is the introduction. 
This is the introduction. This is the introduction. 
This is the introduction. This is the introduction. 
This is the introduction. This is the introduction. 

\section{A section}

This is the introduction. This is the introduction. 
This is the introduction. This is the introduction. 
This is the introduction. This is the introduction. 

\subsection{A subsection}
dsd
\subsubsection{A subsubsection}

\end{document}

A \normalsize (that's expanded at redefinition time) was missing (and also some % were).

enter image description here

A simpler strategy would be

\documentclass{article}
\usepackage{titleps}
\usepackage{etoolbox}

\appto\normalsize{%
  \setlength\abovedisplayskip{20pt}%
  \setlength\belowdisplayskip{20pt}%
  \setlength\abovedisplayshortskip{5pt}%
  \setlength\belowdisplayshortskip{20pt}%
}

and the rest is the same.

0
0

I suggest that you replace

\expandafter\def\expandafter\normalsize\expandafter{%

with

\AtBeginDcoument{%

A full MWE (minimum working example):

\documentclass{article}
\usepackage{titleps}

\AtBeginDocument{%
    \setlength\abovedisplayskip{20pt}
    \setlength\belowdisplayskip{20pt}
    \setlength\abovedisplayshortskip{5pt}
    \setlength\belowdisplayshortskip{20pt}
}

\newpagestyle{main}{%
\setheadrule{.4pt}% Header rule
\sethead{\thesubsection\ \subsectiontitle}% left
        {}%                                 center
        {\thesection\ \sectiontitle}%       right
}
\pagestyle{main}

\begin{document}
\noindent
This is the introduction. This is the introduction. 
This is the introduction. This is the introduction. 
This is the introduction. This is the introduction. 
This is the introduction. This is the introduction.

\section{A section}
This is the introduction. This is the introduction. 
This is the introduction. This is the introduction. 
This is the introduction. This is the introduction.

\subsection{A subsection}
dsd

\subsubsection{A subsubsection}
\end{document}
2
  • This wouldn't change \normalsize and the settings would not be honored whenever the command is (implicitly) issued.
    – egreg
    Nov 2, 2017 at 11:43
  • @egreg - Isn't \normalsize -- actually, \normal-everything... -- executed automatically upon entering the document environment? Hence, there should be no need to run the command separately. Plus, I can't conceive of a reason for why the four length parameters would have to be reset more than once.
    – Mico
    Nov 2, 2017 at 14:03

You must log in to answer this question.

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