# Computing a simple maths calculation and use the result as page numbers in the Table of Contents

Following up this question here, I am looking for a way to compute a simple maths calculation inside the document and let the result of this calculation be the value that appears as page number in the table of content. The following code snippet creates an entry in the table of contents:

\protect\contentsline {section}{%
\protect\numberline {\thesection}#1}{xxxxxxxxxx}}}

Where you find xxxxxxxxxx (= the pagenumber) in this code snippet, there should be something like \thepage minus 1. This result will then be shown as page number in the table of contents.

What did not work was to insert \theprevpage as xxxxxxxxxx and to let

\newcounter{prevpage}

precede the above snippet. (Usually this, of course, works and is a very fine solution. But In my case of using ledpar the way I do it doesn't work.) So it seems that in my particular case it is not possible to "outsource" the computation.

So my question now is: Can't I just somehow replace xxxxxxxxxx by something like \resultOf{\thepage\minus{1}} in order to compute the calculation directly inside the brackets of the \addtocontents-argument, so that the seulting number is written in the *.toc-file? (I am looking for the easiest possible way... or any other method the get the "pagenumber-minus-one" in the brackets without typing it manually.)

-

The toughest part is to expand the number; this is a job for \number; in order to do an expandable computation we can use \numexpr