GeneralCustomized "headings" Page Style

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
franzrogar
Posts: 4
Joined: Mon Dec 01, 2008 4:15 am

Customized "headings" Page Style

Post by franzrogar »

Hello,

I'm writting my custom class but I've found a problem I've not been able to solve. When I add the hrule, it's missplaced: instead of using baseline (to keep distance from headings) it uses descenders line. (Yes, I'm spaniard... sorry). I'll try to explain it:

- If text has "g" or "p" or other letter with descenders, headings are at ~ 6pt.
- If text has no descenders, headings are at ~ 4pt.

So you can see that hrule is moving if you compare differentes pages.

This' the code:

Code: Select all

\if@twoside
  \def\ps@headings{%
      \let\@oddfoot\@empty\let\@evenfoot\@empty
      \def\@evenhead{\vbox{{\small\lsc\thepage}\normalfont\hfil\leftmark \vskip 5\p@ \hrule}}%
      \def\@oddhead{\vbox{\normalfont\partmark\hfil{\small\thepage} \vskip 5\p@ \hrule}}%
Anyone has any idea how could I solve this?

Thanks in advance :-)
Last edited by franzrogar on Thu Dec 04, 2008 12:54 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Customized "headings" Page Style

Post by Juanjo »

Since \hrule is affected by the depth of the preceding text, an alternative strategy could be to write first the rule at a fixed length below the baseline. Let \HeadRule defined as follows:

Code: Select all

\newcommand{\HeadRule}{\makebox[0pt][l]{\rule[-5pt]{\textwidth}{0.4pt}}}
Just to compare it with \hrule, try this in the body of the document:

Code: Select all

\parindent 0pt
\HeadRule Height and depth\par
\HeadRule Text and boxes\par
Height and depth \vskip 5pt\hrule\par
Text and boxes \vskip 5pt \hrule\par
With the help of \HeadRule, the definition of \@evenhead, for example, could be:

Code: Select all

\def\@evenhead{\HeadRule{\small\lsc\thepage}\normalfont\hfil\leftmark}
By the way, since you are a Spanish-speaking user of TeX, I would suggest you to join the es-tex list, which, like this community, is quite active and helpful.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
franzrogar
Posts: 4
Joined: Mon Dec 01, 2008 4:15 am

Customized "headings" Page Style

Post by franzrogar »

Thank you very much Juanjo, that gave me the solution and reach what I wanted:

Code: Select all

\if@twoside
  \def\ps@headings{%
      \let\@oddfoot\@empty\let\@evenfoot\@empty
      \def\@evenhead{\vbox{\hbox to \textwidth{\rule[-.5ex]{0em}{.5ex}
          \rm {\small\thepage}\hfil \sl \leftmark}
          \vskip3pt \hrule height.3pt}}
      \def\@oddhead{\vbox{\hbox to \textwidth{\rule[-.5ex]{0em}{.5em}
          \sl \partmark \hfil \rm{\small\thepage}} 
          \vskip3pt \hrule height.3pt}}
Post Reply