Page LayoutHeadings

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Isak Y
Posts: 12
Joined: Sat Jul 15, 2023 11:25 pm

Headings

Post by Isak Y »

Hi, I have a question.
The moment I put "oneside" in my documentclass, my \leftmark has dissapeared on my pdf if someone know how to fix it, it'd be really nice.
Thx.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Headings

Post by Stefan Kottwitz »

Hi Isak,

welcome to the forum!

With a KOMA-Script class, you can use the twoside=semi option, then you have margins like with oneside while still having \leftmark and \rightmark. If you use the ("old") base classes, you may consider switching to a KOMA-Script class because they are enormously flexible.

Code: Select all

\documentclass[twoside=semi]{scrreprt}
\usepackage[automark]{scrlayer-scrpage}
\pagestyle{scrheadings}
\clearscrheadfoot
\lehead{\leftmark}
\rehead{\rightmark}
\lohead{\leftmark}
\rohead{\rightmark}
\usepackage{blindtext}
\begin{document}
\Blinddocument
\end{document}
Stefan
LaTeX.org admin
Isak Y
Posts: 12
Joined: Sat Jul 15, 2023 11:25 pm

Headings

Post by Isak Y »

Thank you for your answer. But the thing is that I started using "oneside" to not have the white pages before the next chapters (because i think it starts the chapters on odd pages ...) and with twoside=semi i still have this issue..
If you have an idea maybe to solve this problem ;)

Thanks,
Isak Y.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Headings

Post by Stefan Kottwitz »

Hi Isak,

use the openany option, such as

Code: Select all

\documentclass[openany]{book}
Stefan
LaTeX.org admin
Isak Y
Posts: 12
Joined: Sat Jul 15, 2023 11:25 pm

Headings

Post by Isak Y »

Let's goooo, finally.. I've been chating with a lot of users and nobody found a solution...

Thank you a lot Mister, I have a last question on my book, I've parts, chapters and in my headings I have on the left "Part [with the number of this part]" thanks to \thepart and on the right "Chapter [Number] [Title]" thanks to \leftmark.
And I'd like to have also The Title of the part right after the number of this part on the left but I haven't find the command to have so.

Thanks,
Isak Y.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Headings

Post by Stefan Kottwitz »

You can redefine the \part command to store the title in a macro, such as:

Code: Select all

\let\Oldpart\part
\newcommand{\parttitle}{}
\renewcommand{part}[1]{\Oldpart{#1}\renewcommand{\parttitle}{#1}}
(Source)

Stefan
LaTeX.org admin
Isak Y
Posts: 12
Joined: Sat Jul 15, 2023 11:25 pm

Headings

Post by Isak Y »

I added this to my main.tex and this is what I got, many errors :
Attachments
b.png
b.png (14.94 KiB) Viewed 7832 times
a.png
a.png (17.44 KiB) Viewed 7832 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Headings

Post by Stefan Kottwitz »

That doesn't seem to work together with hyperref.

Then take it out; you can use \newcommand and \renewcommand to set a part title macro yourself manually at the beginning of each part: I guess that's just a few parts, so no big deal.

Stefan
LaTeX.org admin
Isak Y
Posts: 12
Joined: Sat Jul 15, 2023 11:25 pm

Headings

Post by Isak Y »

Sorry I'm a beginner, so what should I write in each part to have it "manually" when I write \part{Algebra} for example what should I write next ?

Also, I have another question, on each page instead of having the number of the page I want to have - [number page] - with the two "-" on each side of the number, the problem is that when I write :

\fancyfoot[C]{ $-$ \thepage $-$}

It works only on the not starting-chapter-pages and on the others it's "normal" so without the two "-".

Thank you for your time,
Isak Y.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Headings

Post by Stefan Kottwitz »

Without seeing your code, it's hard to say why the original part suggestion is not working there, or how to make it work. Perhaps if you post a copy of your code (full preamble, dummy text, showing the problem) see that link: Infominimal working example.

The page style at the beginning of a chapter is called plain, it's different since headers above a chapter title are usually different from text page headers in books. You can modify this, see the section Redefining page style plain in the fancyhdr manual.

Stefan
LaTeX.org admin
Post Reply