LaTeX forum ⇒ Page Layout"\markboth" not working

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
lnsam22
Posts: 28
Joined: Thu Jan 13, 2011 6:47 pm

"\markboth" not working

Postby lnsam22 » Thu Feb 03, 2011 4:19 am

Hi All.

I'm attempting to make my own headers for a paper I'm writing. I want to alternate between two headings: "Left" and "Right"; i.e. Page 1 has 'Left' written in the left corner (along with the page number), page 2 has 'Right' written in the right corner. Page 3 again has 'Left' written in the left corner, page 4 Right in right corner... and so forth.

My problem is: I'm not getting the Left and Right printing out when I use "\markboth". Only Left. Can you help me figure out why? And when you do, get them to alternate pages?

\documentclass{article}
%
\usepackage{amsmath}%
\usepackage{amsfonts}%
\usepackage{amssymb}%
\usepackage{graphicx}
\usepackage{graphics,color}
\usepackage[superscript]{cite}

\begin{document}
\pagestyle{myheadings}
\markboth{Right}{Left}

First page
\newpage
Second page
\newpage
Third page
\newpage
Fourth page

 \end{document}


Thanks much!
lnsam
Last edited by lnsam22 on Thu Feb 10, 2011 2:17 pm, edited 1 time in total.

Recommended reading 2021:

LaTeXguide.org • LaTeX-Cookbook.net
LaTeX Beginner's Guide LaTeX Cookbook
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

"\markboth" not working

Postby frabjous » Thu Feb 03, 2011 7:43 pm

The article class is one-sided by default, so it doesn't treat odd and even page numbers differently, and \rightmark is never used.

Change
\documentclass{article}

to
\documentclass[twoside]{article}

This, however, will have other effects you may or may not want.

Or better yet, use the fancyhdr package for more customizability.

lnsam22
Posts: 28
Joined: Thu Jan 13, 2011 6:47 pm

Re: "\markboth" not working

Postby lnsam22 » Thu Feb 10, 2011 2:16 pm

I'm using fancyhdr. You guys on this forum are really helpful. Thanks!


Return to “Page Layout”

Who is online

Users browsing this forum: Google [Bot] and 2 guests