考虑以下:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{fancyhdr}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{expl3}
\usepackage{pst-eucl}
\usepackage{hyperref}
\ExplSyntaxOn
\cs_new_eq:NN \calculate \fp_eval:n
\ExplSyntaxOff
\def\hoejde{\calculate{3*\figurnummer}}
\def\bredde{\calculate{2*\figurnummer}}
\def\areal{\calculate{3*\figurnummer^2}}
\def\faktorA{\calculate{\hoejde+1}}
\def\faktorB{\calculate{\bredde+1}}
\def\faktorC{\calculate{\hoejde-1}}
\def\faktorD{\calculate{\figurnummer-1}}
\def\skalering{\calculate{1.9/\figurnummer}}
\def\betegn#1#2#3{%
\rput(!#1 4 div \figurnummer mul #2 4 div \figurnummer mul){\small{$#3$}}
}
\def\figur#1{%
\begin{figure}[htbp]
\def\figurnummer{#1 }
\centering
\psset{unit=\skalering}
\begin{subfigure}{0.56\textwidth}
\centering
\begin{pspicture}(0,0)(\bredde,\hoejde)
\pnodes{P}(\figurnummer,0)(0,\bredde)(\figurnummer,\hoejde)(\bredde,\bredde)
\betegn{3}{7}{A}
\betegn{3}{9}{B}
\betegn{5}{9}{C}
\betegn{5}{7}{D}
{\psset{linestyle=dashed,linecolor=blue}
\multido{\iA=0+1}{\faktorA}{\psline(0,\iA)(\bredde,\iA)}
\multido{\iB=0+1}{\faktorB}{\psline(\iB,0)(\iB,\hoejde)}}
\psset{linewidth=1pt}
\psline(P0)(P2)
\psline(P1)(P3)
\pspolygon[linejoin=2,linecolor=red](P0)(P1)(P2)(P3)
\end{pspicture}
\subcaption{Before.}
\end{subfigure}
\begin{subfigure}{0.40\textwidth}
\centering
\begin{pspicture}(0,0)(\figurnummer,\hoejde)
\pnodes{P}(0,0)(0,\bredde)(0,\hoejde)(\figurnummer,\hoejde)(\figurnummer,\bredde)(\figurnummer,0)
\betegn{3}{7}{A}
\betegn{3}{9}{B}
\betegn{1}{11}{C}
\betegn{1}{1}{D}
{\psset{linestyle=dashed,linecolor=blue}
\multido{\iC=1+1}{\faktorC}{\psline(0,\iC)(\figurnummer,\iC)}
\multido{\iD=1+1}{\faktorD}{\psline(\iD,0)(\iD,\hoejde)}}
\psset{linewidth=1pt}
\psline(P1)(P4)
\psframe(P0)(P3)
\psline[linejoin=1,linecolor=red](P5)(P1)(P3)
\end{pspicture}
\subcaption{After.}
\end{subfigure}
\caption{Figure number~$\figurnummer$ with area~$A_{\figurnummer} = \areal$.}
\end{figure}
\vspace{6ex}
}
\cfoot{\thepage}
\begin{document}
\pagenumbering{roman}
\pagestyle{plain}
\tableofcontents
\newpage
\pagenumbering{arabic}
Test.
\newpage
\section{Appendix}
\label{appendix}
\def\sider{3}
See the figures on \autopageref{appendix}--[the value of $\texttt{\textbackslash pageref\{appendix\}} + \texttt{\textbackslash sider} - 1$].
% Figurerne.
\multido{\iE=1+2,\iF=1+1}{\sider}{%
\multido{\iG=\iE+1}{2}{\figur{\iG}}
\newpage
}
\end{document}
如何创建一个计数器,其值为
\pageref{appendix} + \sider - 1
? 重点是,这个值等于最后一页的页码。
答案1
您可以使用lastpage
包获取最后一页的计数器值。还有包pageslts
,其文档lastpage
鼓励您使用。
使用lastpage
,您可以使用命令引用最后一页的值
\pageref{LastPage}