引用最近的一个公式:lasteqn z

原文地址:http://bbs.ctex.org/viewthread.php?tid=69755

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
\documentclass{article}
\usepackage{amsmath}
\providecommand\currentseclabel{}
\newcommand\seclabel[1]{
\renewcommand\currentseclabel{#1}%
\label{sec:#1}}
\newcommand\secref[1]{
\ref{sec:#1}}
\newcommand\eqlabel[1]{
\label{eq:\currentseclabel:#1}}
\let\saveeqref\eqref
\renewcommand\eqref[2][\currentseclabel]{
\saveeqref{eq:#1:#2}}
\newcommand\lasteqn{(\theequation)}
\begin{document}
\section{Rectangle}
\seclabel{rect}
\begin{equation}
\eqlabel{area}
A = ab
\end{equation}Area formula \eqref{area}.Previous equation \lasteqn.\section{Circle}
\seclabel{circ}
\begin{equation}
\eqlabel{area}
A = \pi r^2
\end{equation}
Area formula \eqref{area}.\section{Summary}Area of rectangles see \eqref[rect]{area} in section~\secref{rect};
area of circles see \eqref[circ]{area} in section~\secref{circ}.
\end{document}
0%