GeneralShort version of section only in header

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
marbocam
Posts: 38
Joined: Thu Dec 19, 2024 11:14 am

Short version of section only in header

Post by marbocam »

Good morning,

so my thesis has the title of the chapter/section in the header of each page. I'm using /section[short version]{long version} to reduce the text on the header, as some titles are too long. I figured the short version is also showing on my content - Is there a way to change that so that the long version shows in my content?

Two lines in my header could also work.

Thank you in advance!

Recommended reading 2024:

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

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

marbocam
Posts: 38
Joined: Thu Dec 19, 2024 11:14 am

Re: Short version of section only in header

Post by marbocam »

Btw, I tried fancyhdr but this overlaps the title with my paragraphs..
User avatar
Stefan Kottwitz
Site Admin
Posts: 10319
Joined: Mon Mar 10, 2008 9:44 pm

Re: Short version of section only in header

Post by Stefan Kottwitz »

You can use \markright or \markboth, like this:

Code: Select all

\section{Long Title}
\markright{Short Title}
% or \markright{Short Title}{Short Title}
Stefan
LaTeX.org admin
marbocam
Posts: 38
Joined: Thu Dec 19, 2024 11:14 am

Re: Short version of section only in header

Post by marbocam »

Thank you for your answer, Stefan. I didn't get the expected result. This way, only the second time the title shows will it appear shortened. Plus, I'm missing the numbering.

I also realized I didn't explain myself quite well: Each page has either the title of the chapter or the title of the section (both with numbering)
marbocam
Posts: 38
Joined: Thu Dec 19, 2024 11:14 am

Re: Short version of section only in header

Post by marbocam »

I managed to fix it this way:

\sectionmark{Short version}
\section{Second section: Too much text for a running head}
\sectionmark{Short versions}

EDIT: Turns out sometimes \sectionmark is ignored...
marbocam
Posts: 38
Joined: Thu Dec 19, 2024 11:14 am

Re: Short version of section only in header

Post by marbocam »

When the section starts on a new page, the first \sectionmark is ignored..

I tried this, but it's still not working..


\sectionmark{On the Use of a Directly Modulated Laser in a Phase Modulated-Assisted}
\section[On the Use of a Directly Modulated Laser in a Phase Modulated-Assisted mmW Signal Generation and Transmission Link]{On the Use of a Directly Modulated Laser in a Phase Modulated-Assisted mmW Signal Generation and Transmission Link%
\sectionmark{On the Use of a Directly Modulated Laser in a Phase Modulated-Assisted}}
\sectionmark{On the Use of a Directly Modulated Laser in a Phase Modulated-Assisted}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10319
Joined: Mon Mar 10, 2008 9:44 pm

Re: Short version of section only in header

Post by Stefan Kottwitz »

Perhaps use this:

Code: Select all

\renewcommand{\sectionmark}[1]{\gdef\rightmark{#1}}
Stefan
LaTeX.org admin
marbocam
Posts: 38
Joined: Thu Dec 19, 2024 11:14 am

Re: Short version of section only in header

Post by marbocam »

That works fine, but removes the numbering from the header title..
User avatar
Stefan Kottwitz
Site Admin
Posts: 10319
Joined: Mon Mar 10, 2008 9:44 pm

Re: Short version of section only in header

Post by Stefan Kottwitz »

Then take

Code: Select all

\renewcommand{\sectionmark}[1]{\gdef\rightmark{\thesection\ #1}}
Stefan
LaTeX.org admin
marbocam
Posts: 38
Joined: Thu Dec 19, 2024 11:14 am

Re: Short version of section only in header

Post by marbocam »

That did the trick! Thank you so much, Stefan!!
Post Reply