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:
\addtocontents{toc}{%
\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}
\setcounter{prevpage}{\value{page}}\addtocounter{prevpage}{-1}
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.)
\thepageor (b)\number\value{page}is used. (Does this make any sense?) (a) results in3and (b) in1. Taking 1 off means that (a') would be2(correct) and (b') is0(wrong). So, can I use\thepagein a computation somehow to get the correct result2from\thepage minus 1? – ClintEastwood May 14 '12 at 18:12\thepageresults in the correct number x but\value{page}gives at some placesx-1and at other placesx-2. With your solution in my environment I get for a computation ofpagenumber minus 1the follwoing results:page 11 minus 1= 8 and later in the documentpage 21 minus 1= 19 although the first should be 10 and the second 20. This seems to be due to the fact that at these places\value{page}is not the same asthepage. I know, it's weird. sorry. – ClintEastwood May 14 '12 at 20:18\thepage? – ClintEastwood May 14 '12 at 20:29\addcontentsare expanded during the output routine, whenpagehas already been incremented. I understand thatledmacmight do bad jokes with the OR, that's why an example is needed: too many factors may be involved. Sorry. – egreg May 14 '12 at 20:35