Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How can I create a default header, footer and customize the font of my LaTeX document?

I wanted something like this:

Default book title                     Chapter name
____________________________________________________________

content

____________________________________________________________
www.defaulturl.com                     PAGE NUMBER
share|improve this question
7  
Welcome to tex.sx! There's a lot of questions/answers about customizing headers and footers at our site; for starters, have a look at this question and browse the {header-footer} tag. –  lockstep Jun 6 '11 at 19:50
    
Also, the the Page Layout section of the LaTeX Wikibook should help you. –  Caramdir Jun 6 '11 at 20:41
1  
also see tex.stackexchange.com/questions/99215/… –  macmadness86 Feb 24 '13 at 2:08
add comment

2 Answers

As mentioned in Stefan's answer to How to customize head- and footlines?, fancyhdr is the classical package to customize headers/footers. However, recently I've been using the titlesec package to define page styles, and I've found it really useful and as powerful as fancyhdr, so here's a little example achieving the desired result with titlesec:

\documentclass{report}
\usepackage[pagestyles]{titlesec}
\usepackage{url}
\usepackage{lipsum}% just to generate some filler text

\newcommand*\defaulturl{\url{www.some-url.com}}
\newcommand*\defaulttitle{Some Title}

\newpagestyle{mystyle}{
  \sethead{\defaulttitle}{}{\chaptertitle}\headrule
  \setfoot{\defaulturl}{}{\thepage}\footrule
}

\pagestyle{mystyle}

\begin{document}

\chapter{Test chapter}
\lipsum[1-40]

\end{document}
share|improve this answer
add comment

Gonzalo mentioned fancyhdr (the classic solution) and titlesec. Modern classes such as Koma-Script classes (scrbook and friends) and memoir also have built-in ways of achieving this.

In the case of Koma-Script classes for example, you can achieve a lot by using the scrpage2 package. (Update 2014:) Since version 3.12 you should use the successor package scrlayer-scrpage instead.

share|improve this answer
3  
Actually, scrpage2 can be used with the standard classes as well. –  lockstep Jun 6 '11 at 21:40
    
@lockstep: good to know. I've only seen it used in Koma, and fancyhdr used in most cases. –  ℝaphink Jun 6 '11 at 21:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.