Page Layoutfancyhf and \leftmark resizing

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
PK_TeX
Posts: 6
Joined: Fri Oct 18, 2024 7:53 am

fancyhf and \leftmark resizing

Post by PK_TeX »

Hi

I'd like to resize the \leftmark title on my doc.

I have:

Code: Select all

\usepackage{fancyhdr} 

	\fancypagestyle{front}{
		\fancyhf{}
		%\fancyfoot[C]{page \thepage}
		\renewcommand{\headrulewidth}{0pt}
		\renewcommand{\footrulewidth}{0pt}
	}

	\fancypagestyle{main}{%
		\renewcommand{\headrulewidth}{0pt}
		\fancyhf{}
		%\fancyhead[CO]{ \fontsize{8pt}{8pt}\selectfont\textit\leftmark} % 
		\fancyhead[CO]{\textit\leftmark} 
		\fancyhead[CE]{\small\textsc{\lefmark}}  
		% pied de page
		\renewcommand{\footrulewidth}{0pt}
		\fancyfoot{} 
		\fancyfoot[RO]{\thepage} 
		\fancyfoot[LE]{\thepage}
	}

	\fancypagestyle{back}{%
		\fancyhf{}
		%\fancyfoot[C]{page \thepage}%
		\renewcommand{\headrulewidth}{0pt}
		\renewcommand{\footrulewidth}{0pt}
	}
It works fine and I want to modify the main part in order that the fancyhead[CO] to be a little bit smaller.

I tried

\fancyhead[CO]{ \fontsize{8pt}{8pt}\selectfont\textit\leftmark}
\fancyhead[CO]{ \small\textit\leftmark} % \huge idem
\fancyhead[CO]{ \smaller[3]\textit\leftmark} % with the package relsize


but it does nothing. I do not understand why I can't change the size.

I use lualatex.

Thanks,

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics
Bartman
Posts: 361
Joined: Fri Jan 03, 2020 2:39 pm

fancyhf and \leftmark resizing

Post by Bartman »

The only mistake in your incomplete example is the typo in \lefmark, which should cause an error message. If I complete your source code snippet to a Infominimal working example, then I get the result you want. Please try to do the same and post an example that shows the problem.
PK_TeX
Posts: 6
Joined: Fri Oct 18, 2024 7:53 am

fancyhf and \leftmark resizing

Post by PK_TeX »

Thanks for the answer.

Yes, my simple solution works (with an error of copy-paste), but doesn't work in my doc.

I found the error. My code and solution were fine.

But I have adapted the \section to unumbered it, and it is that which caused the problem:

Code: Select all

\newcommand*{\nsection}[1]{%
    % Create the inline heading
    \vspace*{0.5cm}
    \section*{#1}%
    % Set the mark (for headers/footers)
    \markboth{\small{#1}}{}%
    % Make a Table of Contents entry
    \addcontentsline{toc}{section}{#1}
    \vspace*{-0.9cm}
    \begin{figure}[h]
        \centering
        \includesvg{./image.svg}
    \end{figure}
    \vspace*{0.25cm}
}
For adapting the \leftmark function, I need to adapt my \markboth function. With my proposal solutions, it works fine.

Thanks and sorry for the false problem.
Post Reply