2

I'm preparing a technical manual consisting of different sections, and I want the numbering of pages, figures, and tables in each section to have a prefix describing the specific section.

Moreover, I also want to add a global page counter and a section-based page counter on the same footer.

For now, my footer appears as follows:

enter image description here

However, my purpose is to count the section-based page numbers with the section prefix on the center of the footer and count the global page numbers on the right side of the footer, i.e., the right side footer in the picture should have no prefix and it should count the global page number.

I'm using \include{} command to add the sections to the main file. In the preamble of each section, I have added the following code to create the footer:

\renewcommand{\footrulewidth}{1pt}    
\lfoot{PHOTOELECTRIC EFFECT}
\rfoot{\thepage}
\setcounter{page}{1}
\renewcommand{\thepage}{PE. \arabic{page}}

I also want to add the same prefix for the tables and figures of the same section.

How can I achieve these goals?

2
  • Modifying \thefigure and \thetable is easy, but don't mess with \thepage. It is used everywhere. Mar 16 at 15:13
  • @John Kormylo, I figured out the figure and table parts after writing the question but was still not able to properly adjust the page numbers as I wish. Hoping someone can come up with a solution.
    – sahin
    Mar 16 at 16:57

1 Answer 1

1

An almost complete, but painful, answer to your question.

% secnumsprob.tex  SE 637313

\documentclass{article}

\newcommand{\secprefix}{}  %% section prefix
\renewcommand{\thefigure}{\secprefix. \arabic{figure}} %% prefix figure numbers
%% this resets the page number to zero, and adds the pefix to the page number
\newcommand{\chngpnum}{\pagenumbering{arabic} \renewcommand{\thepage}{\secprefix. \arabic{page}}}
      
\begin{document}

\section{First} \renewcommand{\secprefix}{F} \chngpnum
%%\pagenumbering{arabic} \renewcommand{\thepage}{\secprefix. \arabic{page}}
\begin{figure}
  \centering
  A FIGURE
  \caption{A figure}
\end{figure}

\section{Second} \renewcommand{\secprefix}{S} \chngpnum
%%\pagenumbering{arabic} \renewcommand{\thepage}{\secprefix. \arabic{page}}
\begin{figure}
  \centering
  A GRAPHIC
  \caption{A graphic}
\end{figure}

\clearpage

\section{Third} \renewcommand{\secprefix}{T} \chngpnum
\begin{figure}
  \centering
  A FIGURE
  \caption{A figure}
\end{figure}

\section{Fourth} \renewcommand{\secprefix}{IV} \chngpnum
\begin{figure}
  \centering
  A GRAPHIC
  \caption{A graphic}
\end{figure}

\end{document}

At the moment I don't know how to have two sequences of page numbers. The above sets local (per section) page numbers but perhaps someone else will be able to answer your desire to have a global page number as well.

BTW. You gave no indication of how you wanted the section prefix to be used when there were multiple sections on a page; Should it be the first, or the last, or whatever else you might dream up? --- GOM

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.