Page LayoutPage footer code

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
ciema7
Posts: 22
Joined: Sat Nov 10, 2018 2:31 am

Page footer code

Post by ciema7 »

Hello Community,

I need some help with my page footer. Is there a way to add a dot after the number of each sections in footer ?
For example "1. ROZDZIAL PIERWSZY" or "2. ROZDZIAL DRUGI".

I would like to also know how to achieve the effect with no number in footer. I tried to use command:

Code: Select all

\renewcommand{\sectionmark}[1]{\markright{#1}}
But as the result I receive multiple time phrase: "TABLE OF CONTENTS" insted each sections name.

Can anyone help me?

This is my code:

Code: Select all

\documentclass[12pt]{article}
\usepackage[table,xcdraw]{xcolor}
\usepackage{listings}
\usepackage{inputenc}
\usepackage{graphicx}
\usepackage{polski}
\usepackage[foot=1.25cm,head=\baselineskip, headheight=12pt, marginparsep=2mm ]{geometry} 

\usepackage{textcomp} 
\usepackage{gensymb}
\usepackage{parskip}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{enumitem}
\usepackage{booktabs,arydshln}
\usepackage{array}
\usepackage{caption} 
\usepackage{amsmath}

\usepackage{scrextend}
\usepackage{mwe} 
\usepackage[export]{adjustbox}  
\usepackage{setspace}
\usepackage{stanli}
\usepackage{tikz} 
\usepackage{wrapfig}


\usepackage{fancyhdr}
\setlength{\headsep}{1.3cm} 
\pagestyle{fancy}
\fancyhf{} 
\fancyhead[LE,RO]{Analizy~Wytrzymalosciowe}
\fancyhead[RE,LO]{Zadania i rozwiazania}
\fancyfoot[CE,CO]{\leftmark}
\fancyfoot[LE,RO]{str.~\thepage}

%\renewcommand{\sectionmark}[1]{\markright{#1}} 







\renewcommand{\headrulewidth}{2pt} 
\renewcommand{\footrulewidth}{1pt}

\begin{document}
	
	\tableofcontents
	
	\newpage\section{rozdzial pierwszy}
	\newpage\subsection{podrozdzial pierwszy}
	\newpage\section{rozdzial drugi}
	\newpage\subsection{podrozdzial jeden}
	\newpage\section{rozdzial trzeci}
	
	\newpage\subsection{podrozdzial o pierwszym numerze}
	
\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Page footer code

Post by Ijon Tichy »

\renewcommand{\sectionmark}[1]{\markboth{\MakeUppercase{\thesection. #1}}{}}
should do it.

Another suggestion would be to switch to a more flexible class:
\documentclass[emulatestandardclasses,12pt,parskip=full-,
  automark,headsepline=2pt,footsepline=1pt,% options to scrlayer-scrpage
]{scrartcl}
\usepackage[table,xcdraw]{xcolor}
\usepackage{listings}
\usepackage{inputenc}% inputenc without option makes not sense with LaTeX from 2018/04/01
\usepackage{graphicx}
\usepackage{polski}
\usepackage[foot=1.25cm,head=\baselineskip, headheight=12pt, marginparsep=2mm ]{geometry} 

\usepackage{textcomp} 
\usepackage{gensymb}
%\usepackage{parskip}% Don't use it with scrartcl, use class option parskip.
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{enumitem}
\usepackage{booktabs,arydshln}
%\usepackage{array}% Useless, because already loaded by tabularx
\usepackage{caption}
\usepackage{amsmath}

%\usepackage{scrextend}% Not needed, because you are now using a KOMA-Script class.
\usepackage{mwe} 
\usepackage[export]{adjustbox}  
\usepackage{setspace}
\usepackage{stanli}
\usepackage{tikz} 
\usepackage{wrapfig}

% Using scrlayer-scrpage instead of fancyhdr. The package is already loaded,
% because of option "emulatestandardclasses". Otherwise we would use, e.g.,
% \usepackage[automark,headsepline=2pt,footsepline=1pt]{scrlayer-scrpage}
\renewcommand*{\sectionmarkformat}{\thesection.\enskip}
\clearpairofpagestyles
\ohead{Analizy~Wytrzymalosciowe}
\ihead{Zadania i rozwiazania}
\cfoot*{\headmark}
\ofoot{str.~\thepage}
\pagestyle{scrheadings}% needed, because the default for article is plain

\begin{document}

    \tableofcontents

    \newpage\section{rozdzial pierwszy}
    \newpage\subsection{podrozdzial pierwszy}
    \newpage\section{rozdzial drugi}
    \newpage\subsection{podrozdzial jeden}
    \newpage\section{rozdzial trzeci}

    \newpage\subsection{podrozdzial o pierwszym numerze}

\end{document}
As you have used scrextend already, you are not far away from using a KOMA-Script class, because package scrextend was made to bring at least some of the KOMA-Script extensions to the standard classes.

BTW: scrlayer-scrpage can also be used with the standard classes:
\documentclass[12pt]{article}
\usepackage[table,xcdraw]{xcolor}
\usepackage{listings}
\usepackage{inputenc}% inputenc without option makes not sense with LaTeX from 2018/04/01
\usepackage{graphicx}
\usepackage{polski}
\usepackage[foot=1.25cm,head=\baselineskip, headheight=12pt, marginparsep=2mm ]{geometry} 

\usepackage{textcomp} 
\usepackage{gensymb}
\usepackage{parskip}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{enumitem}
\usepackage{booktabs,arydshln}
%\usepackage{array}% Useless, because already loaded by tabularx
\usepackage{caption}
\usepackage{amsmath}

\usepackage{scrextend}
\usepackage{mwe} 
\usepackage[export]{adjustbox}  
\usepackage{setspace}
\usepackage{stanli}
\usepackage{tikz} 
\usepackage{wrapfig}

% Using scrlayer-scrpage instead of fancyhdr.
\usepackage[automark,headsepline=2pt,footsepline=1pt]{scrlayer-scrpage}
\renewcommand*{\sectionmarkformat}{\thesection.\enskip}
\clearpairofpagestyles
\ohead{Analizy~Wytrzymalosciowe}
\ihead{Zadania i rozwiazania}
\cfoot*{\headmark}
\ofoot{str.~\thepage}
\setkomafont{pageheadfoot}{\normalfont}

\begin{document}

    \tableofcontents

    \newpage\section{rozdzial pierwszy}
    \newpage\subsection{podrozdzial pierwszy}
    \newpage\section{rozdzial drugi}
    \newpage\subsection{podrozdzial jeden}
    \newpage\section{rozdzial trzeci}

    \newpage\subsection{podrozdzial o pierwszym numerze}

\end{document}
As you can see, it is almost the same as with a KOMA-Script class. ;-)
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
ciema7
Posts: 22
Joined: Sat Nov 10, 2018 2:31 am

Page footer code

Post by ciema7 »

Thanks a lot :)
Post Reply