1

I'm writing several SOP's - Standard Operation Procedure for a cosmetics industry. I need two page numbering scheme in the footer, one with all pages of the document and other with all pages of specific SOP, something like this:

Global Page: 1/180

SOP Page: 1/7

the main TOC must show the global numbering and the TOC of each SOP, the local numbering.

How to do it?

\documentclass {article} 
\usepackage{fancyhdr}

\fancyhf{} %clear header and footer \fancypagestyle{firststyle}{ \rfoot{ \fbox{ \begin{tabular}{r} Global Page: \thepage/\thepage \ SOP Page: \thepage/\thepage \ \end{tabular} }} } \usepackage{titletoc}

\begin{document}

\tableofcontents \newpage

\addcontentsline{toc}{section}{SOP 1 - Administration}

\pagestyle{firststyle}

\startlist{toc} \printlist{toc}{}{\section*{Contents - SOP 1}}

\setcounter{page}{1}

\section{OBJECTIVE} \section{RESPONSIBILITY} \section{PROCEDURES} \stopcontents \newpage

\setcounter{section}{0} \addcontentsline{toc}{section}{SOP 2 - Prodution}

\startlist{toc} \printlist{toc}{}{\section*{Contents - SOP 2}} \setcounter{page}{1}

\section{OBJECTIVE} \section{RESPONSIBILITY} \section{PROCEDURES}

\end{document}

1 Answers1

2

Two page counters were defined: the normal page number and a secondary one that is reset before each SOP.

The code for the second was taken from two sets of page numbers in a document

The total number of physical pages of the document was obtained using the package lastpage.

The complete document has a total of 11 pages: SOP 1 (one page) SOP 2 (9 pages) and the ToC (one page).

SOP 1 : one page long.

a

SOP 2 : first page, nine pages long.

b

The last page of SOP2 and also of the full document.

C

And the ToC.

d

\documentclass{article}

\usepackage{atenddvi} % added <<<<<<<<<<<<< \usepackage{lastpage} % added <<<<<<<<<<<<< \usepackage[user]{zref}% added <<<<<<<<<<<<<

\usepackage{titletoc}

\usepackage{kantlipsum}% ONLY dummy text

\usepackage{fancyhdr} \fancypagestyle{firststyle}{% changed <<<<<<<<<<<<<<<< \fancyhf{} %clear header and footer \fancyfoot[R]{\stepcounter{pageaux} \fbox{% \begin{tabular}{r} Global Page: \thepage/\pageref{LastPage} \ SOP Page: \thepageaux/\ref{\currentauxref} \ \end{tabular}} }} \pagestyle{firststyle}

%%********************************* from https://tex.stackexchange.com/a/82560/161015 \newcounter{pageaux} \def\currentauxref{PAGEAUX1} \makeatletter \newcommand{\resetpageaux}{% \clearpage \edef@currentlabel{\thepageaux}\label{\currentauxref}% \xdef\currentauxref{PAGEAUX\thepage}% \setcounter{pageaux}{0}} \AtEndDvi{\edef@currentlabel{\thepageaux}\label{\currentauxref}} \makeatother %%*********************************

\begin{document}

\thispagestyle{empty}   
\tableofcontents
\newpage

\addcontentsline{toc}{section}{SOP 1 - Administration}

\resetpageaux% reset aux page numbers

\startlist{toc}
\printlist{toc}{}{\section*{Contents - SOP 1}}

\section{OBJECTIVE}
\kant[9]
\section{RESPONSIBILITY}
\kant[2]
\section{PROCEDURES}
\kant[9]
\stopcontents

\newpage

\setcounter{section}{0}
\addcontentsline{toc}{section}{SOP 2 - Production}

\resetpageaux% reset aux page numbers

\startlist{toc}
\printlist{toc}{}{\section*{Contents - SOP 2}}

\section{OBJECTIVE}
\kant[1-8]
\section{RESPONSIBILITY}
\kant[1-8]
\section{PROCEDURES}
\kant[1-8]
\stopcontents

\end{document}

Simon Dispa
  • 39,141