TransWikia.com

Section number of first word on the page in header

TeX - LaTeX Asked on April 18, 2021

I’m using fancyhead and I wanted to include in headers number of section, which 1st word on the page belongs to:

documentclass[leqno]{book}
usepackage[utf8]{inputenc}
usepackage{polski}
usepackage{fancyhdr}
usepackage{lipsum}
renewcommand{headrulewidth}{0pt}
renewcommand{chaptermark}[1]{ markboth{#1}{} }
renewcommand{sectionmark}[1]{ markright{#1}{} }

pagestyle{fancy}
fancyhead[LE]{thepage} 
fancyhead[CE]{thepart. parttitle}
fancyhead[RE]{[thesubsection}
fancyhead[LO]{thesubsection]} 
fancyhead[CO]{nouppercase{rightmark}}
fancyhead[RO]{thepage}
begin{document}


setcounter{page}{5}
setcounter{part}{1}
setcounter{chapter}{3}
setcounter{section}{4}

section{first section}

subsection{first subsection}
lipsum[1]
lipsum[1]
lipsum[1]
lipsum[1]

that text comes from section 1 and should make header to [3.5.1
subsection{second subsection}
that text comes from subsection 2 and changes header in the top right to [3.5.2 (supposed to be [3.5.1)
end{document}

xx

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP