TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have document where exists numeration. I would like to do double numeration for some part of document. For example, pages numbering:

1
2
3(1)
4(2)
5(3)
6
7
8(1)

Numeration for this parts always starts from 1. For usual numeration I am using this part of code:

\usepackage{kantlipsum}
\usepackage{fancyhdr}
\fancyhf{} % clear all header and footers
\renewcommand{\headrulewidth}{0pt}

\fancyfoot[R]{\thepage}

\pagestyle{fancy}
\fancypagestyle{plain}{%
  \fancyhf{}%
  \renewcommand{\headrulewidth}{0pt}%
  \fancyhf[lef,rof]{\thepage}%
}

Is there any way to do as is explained above ?

share|improve this question

I would use two pagestyles, and a new counter called pageother to keep track of the second page numbering.

\newcounter{pageother}

\fancypagestyle{normal}{%
  \fancyhf{}
  \renewcommand{\headrulewidth}{0pt}
  \fancyfoot[R]{\thepage}
}

\fancypagestyle{double}{%
  \setcounter{pageother}{0}
  \fancyhf{}
  \renewcommand{\headrulewidth}{0pt}
  \fancyfoot[R]{\stepcounter{pageother}\thepage(\thepageother)}
}

Use \pagestyle{normal} in your preamble to use the normal page numbering, and then switch to the double numbering with \pagestyle{double}. Use \pagestyle{normal} to go back to the normal numbering style again.

Note that this does not affect the table of contents or any other references to the page number.

share|improve this answer
    
Is the instruction \newcommand{\thepageother}{\arabic{pageother}} needed, or should it be\renewcommand{\thepageother}{\arabic{pageother}}? – Mico Jan 22 at 0:51
    
I agree; \thepageother is defined by default as \arabic{pageother} with \newcounter{pageother}. – Werner Jan 22 at 1:44
    
Thanks--I didn't know about that extra feature of \newcounter, – ChrisS Jan 22 at 1:57

You can use xassoccnt to establish an "association" between two counters. One "slave counter" is stepped whenever a "driver counter" is stepped.

\documentclass[twoside]{article}
\usepackage{lipsum}

\usepackage{fancyhdr,xassoccnt}
\fancypagestyle{plain}{%
  \fancyhf{}
  \renewcommand{\headrulewidth}{0pt}
  \fancyfoot[LE,RO]{\thepage}
}
\fancypagestyle{combined}{%
  \pagestyle{plain}% The same as plain
  \setcounter{otherpage}{1}% Restart otherpage counter
  \fancyfoot[LE,RO]{\thepage (\theotherpage)}
}

% Declare otherpage to be associated with (stepped together with) page
\DeclareAssociatedCounters[autodefine=associated]{page}{otherpage}

\pagestyle{plain}% Set default page style
\sloppy% Just for this example
\begin{document}

\tableofcontents

\section{First}
\lipsum[1-10]

\clearpage
\pagestyle{combined}% Switch to combined pages style
\section{Second}
\lipsum[11-25]

\clearpage
\pagestyle{plain}% Switch back to plain (default) page style
\section{Third}
\lipsum[26-40]

\clearpage
\pagestyle{combined}% Switch back to combined page style
\section{Last}
\lipsum[41-55]

\end{document}

Page styles are used to switch between the different displays. The above minimal example sets the page number sequence as

1
2
3
4(1)
5(2)
6(3)
7
8
9
10(1)
11(2)
12(3)

Since the associated counter doesn't form part of the actual page counter display, reference to pages may not include the associated counter. Additionally, entries in the Contents won't display this information as only \thepage is written to auxiliary files. This can be seen when viewing the output created by \tableofcontents:

enter image description here

If you wish to include the associated counter in the Contents (and possibly page references), then the following setup would work:

\usepackage{fancyhdr,xassoccnt}
\fancypagestyle{plain}{%
  \fancyhf{}
  \renewcommand{\headrulewidth}{0pt}
  \renewcommand{\thepage}{\arabic{page}}% Update page display
  \fancyfoot[LE,RO]{\thepage}
}
\fancypagestyle{combined}{%
  \pagestyle{plain}% The same as plain
  \setcounter{otherpage}{1}% Restart otherpage counter
  \renewcommand{\thepage}{\arabic{page}(\theotherpage)}% Update page display
}

% Declare otherpage to be associated with (stepped together with) page
\DeclareAssociatedCounters[autodefine=associated]{page}{otherpage}

enter image description here

share|improve this answer

You could add the following code to the preamble:

\usepackage{atbegshi} % for "\AtBeginShipout" macro
\newcounter{extranum}
\AtBeginShipout{\stepcounter{extranum}}
\newcommand\simplepagenumbering{%
   \clearpage
   \renewcommand\thepage{\arabic{page}}}
\newcommand\compoundpagenumbering{%
   \clearpage
   \setcounter{extranum}{1} % reset "extranum" counter
   \renewcommand\thepage{\arabic{page}(\arabic{extranum})}}

The code defines two page styles: "simple" and "compound". The macros \simplepagenumbering and \compoundpagenumbering start with a \clearpage instruction; if that's not desired, simply omit the \clearpage instructions.

A full MWE (output not shown since it would take up 11 pages):

\documentclass{article}
\usepackage{lipsum}

\usepackage{fancyhdr}
\fancyhf{} % clear all header and footers
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[R]{\thepage}
\pagestyle{fancy}
\fancypagestyle{plain}{%
  \fancyhf{}%
  \renewcommand{\headrulewidth}{0pt}%
  \fancyhf[lef,rof]{\thepage}%
}

\usepackage{atbegshi} % for "\AtBeginShipout" macro
\newcounter{extranum}
\AtBeginShipout{\stepcounter{extranum}}
\newcommand\simplepagenumbering{%
   \clearpage
   \renewcommand\thepage{\arabic{page}}}
\newcommand\compoundpagenumbering{%
   \clearpage
   \setcounter{extranum}{1} % reset "extranum" counter
   \renewcommand\thepage{\arabic{page}(\arabic{extranum})}}

\begin{document}
\lipsum[1-10]
\compoundpagenumbering
\lipsum[11-25]
\simplepagenumbering
\lipsum[26-40]
\compoundpagenumbering
\lipsum[41-55]
\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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