Page Layoutunderlined headers

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
tjampman
Posts: 1
Joined: Wed Feb 25, 2009 6:57 pm

underlined headers

Post by tjampman »

Hello

I would very much like to underline my headings. I'm using the book class. I have found the underlin package at CTAN which should do what I want.

But I don't know how to use it! I am a LaTeX beginner and have just barely managed to compile it to a style file "underlin.sty".
This is my preamble:

Code: Select all

\documentclass[a4paper,11pt]{book}
\pagestyle{underline} % This is pseudo code for what I want!
\usepackage[danish]{babel}
\usepackage[latin1]{inputenc}
How should I use the underlin style file? And what location is the best place to save it on Ubuntu?

I have read the accompanying pdf file, but unfortunately I do not understand what I need to do in order for it to be used.


TIA
BR

Recommended reading 2024:

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

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

underlined headers

Post by localghost »

You better take a look at the fancyhdr or the titlesec package. But with the package you suggested the desired result should be easy to get.

Code: Select all

\documentclass[11pt,a4paper]{book}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}   % changed to English to get blindtext package working
\usepackage{underlin}
\usepackage{lmodern}
\usepackage{blindtext}

\pagestyle{underline}

\begin{document}
  \Blinddocument
\end{document}
The underlin package should be already part of your LaTeX distribution. Perhaps the according document class scrbook from the KOMA Script bundle is worth a look. Another interesting alternative could be the memoir class.


Best regards and welcome to the board
Thorsten¹
daleif
Posts: 199
Joined: Wed Nov 19, 2008 12:46 am

underlined headers

Post by daleif »

yes either use fancyhdr plus the fancy style and activate the header line (I do think it is activated by default).

Better choice would be to switch to memoir which has a much better pagestyle support than fancyhdr and book.

then, assuming that you are using the default headings style, you just need to add

Code: Select all

\makeheadrule{headings}{\textwidth}{\normalrulethickness}
% \nouppercaseheads
\pagestyle{headings}
the \nouppercaseheads will completely remove the automatic uppercasing of the headers that the books class does (and by default memoir does too), it does not look good and cause problems when there is math in the headers.

As you are writing in danish, you might want to have a look at my Danish LaTeX book, beta version can be found via http://www.imf.au.dk/system/latex/bog/ it contains, among other things, a chapter about memoir configuration.
hucanghe
Posts: 1
Joined: Sat Aug 07, 2010 11:27 pm

Re: underlined headers

Post by hucanghe »

Hi,
I tried the sources by localhost - it works fine.
However, if I insert
\usepackage{color) or \usepackage{tikz},
the underlines of the headings disappear.

How can solve this conflict (I need the both packages for my graphics).

Thanks in advance, Hucang He
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

underlined headers

Post by localghost »

hucanghe wrote:[...] However, if I insert
\usepackage{color) or \usepackage{tikz},
the underlines of the headings disappear.

How can solve this conflict (I need the both packages for my graphics). [...]
Just use one of the other packages I suggested.


Best regards and welcome to the board
Thorsten
Post Reply