General ⇒ a newbie header question (disappearing text)
a newbie header question (disappearing text)
So I'm using the book class, and I've got a bunch of chapters and sections.
When I use the (default) 'twopage' option, the left page header shows the current section name and page number, and the right page header shows the current page number.
When I use the 'onepage' option, I would like to see the current section name and page number in my header, but instead all that comes out is the page number.
Is there an easy way to do it? Most of the things I have read online point to using the fancy header package, but it seems like that shouldn't be necessary here.
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
a newbie header question (disappearing text)
If there is any question left, that's not answered by reading twice the manual, feel free to ask.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Re: a newbie header question (disappearing text)
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
a newbie header question (disappearing text)
Code: Select all
%\documentclass[letterpaper,10pt,twoside]{book}
\documentclass[letterpaper,10pt,oneside]{book}
\begin{document}
%\chapter{Header Test}
\section{The first section}
The text on the first page.
The book class' left header is chapter name, and the right header is section name.
With no chapters defined and using the 'oneside' option, no header information is displayed.
Therefore the 'oneside' option uses the left header information. Is there a way to make it
show right header information instead?
\newpage
The text on the second page.
Again we see no header when using the 'oneside' option unless a chapter has been defined.
\newpage
The text on the third page.
With 'twoside' this is where we see section information, the right header.
\end{document}
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
a newbie header question (disappearing text)
Code: Select all
\documentclass[letterpaper,10pt,oneside]{book}
\usepackage{blindtext}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}} % This redefines the right column title, only for option oneside
\begin{document}
\blinddocument
\end{document}
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10