Using mweclass
LaTeX class (report
based) is writing a document as follows:
\documentclass{mweclass}
\title{MWE}
\author{J. Doe}
\begin{document}
\thispagestyle{mwetest}
\maketitle
\pagestyle{mwetest}
\chapter{One}
\section{First}
% LaTeX code ...
\end{document}
In the header there must be a headrule on each page at a fixed offset in height.
But… when there are any g
, q
, p
etc. letters in the text above (chapter or section names) the headrule is distanced correctly. Otherwise, the headrule is "attaching" to the text.
In a mweclass.cls
I have this code for the mwetest
pagestyle:
\newcommand{\ps@mwetest}{%
\setlength\fancy@headwidth {\mwe@textwidth}%
\fancy@setoffs%
\renewcommand\headrulewidth {\mwe@headrulewidth}%
\renewcommand\footrulewidth {0pt}%
\renewcommand\footruleskip {0pt}%
\def\headrule{\hrule\@height\headrulewidth\@width\headwidth\vskip-\headrulewidth}%
\def\footrule{}%
\def\f@ncyorh{\rightmark~\ \ \ \ \ ~\thepage}%
\def\f@ncyelh{\thepage~\ \ \ \ \ ~\leftmark}%
\def\@oddhead{\@fancyhead\fancy@Oolh\@empty\hfil\f@ncyorh\fancy@Oorh}%
\def\@evenhead{\@fancyhead\fancy@Oelh\f@ncyelh\hfil\@empty\fancy@Oerh}%
\def\@oddfoot{}\def\@evenfoot{}%
\def\chaptermark##1{\markboth{##1\ -- \ \thechapter}{}}%
\def\sectionmark##1{\markright{\thechapter.\arabic{section}\ --\ ##1}}%
}
Some code is taken from distributed fancyhdr.sty
, version 3.2, lines 432-435. The \mwe@textwidth and \mwe@headrulewidth are calculated OK
by the mweclass
class before.
The problem is probably something to do with the baseline in letters. The headrule keeps attaching/detaching from the chapter / section names above, whether the text contains letters whose shape in the font prolongs below the baseline; or not.
- Is there a way to insert invisible (that are not typeset) letters in a text? If there were, an easy workaround is to put a
q
in chapter and section names. - What is wrong? Except this mobile headrule, the header is but
OK
.
I appreciate any reply or suggestions.
Best Answer
You can put
\strut
command: it inserts a piece of nothing of the\height
and\depth
as large as the largest letters in current font, but having no\width
.