2- You can use the restatable
environment provided by thmtools
.
1- Since the environment generates an anchor, you can use the standard \label
, \ref
(\pageref
) mechanism for cross-referencing.
A complete example:
\documentclass{article}
\usepackage{amsthm}
\usepackage{thmtools, thm-restate}
\usepackage{hyperref}
\declaretheorem{theorem}
\begin{document}
\section{Test Section}
\begin{theorem}
Test theorem
\end{theorem}
\begin{restatable}[Fundamental Theorem of Algebra]{theorem}{fta}
\label{thm:FTA}
Every non-constant single-variable polynomial with complex coefficients has at least one complex root.
\end{restatable}
\appendix
\section[Proof of the Fundamental Theorem of Algebra]{Proof of Theorem~\ref{thm:FTA} (See page~\pageref{thm:FTA})}
\fta*
\begin{proof}
Assume...
\end{proof}
\end{document}
Now that the question has been edited, and the used document class is known, here's a solution using the vldb
document class (the link to the class can be found in the question):
\documentclass{vldb}
\usepackage{textcase}
\usepackage{thmtools,thm-restate}
\usepackage{hyperref}
\makeatletter
\def\@sect#1#2#3#4#5#6[#7]#8{%
\ifnum #2>\c@secnumdepth
\let\@svsec\@empty
\else
\refstepcounter{#1}%
\edef\@svsec{%
\begingroup
%\ifnum#2>2 \noexpand\rm \fi % changed to next 29 July 2002 gkmt
\ifnum#2>2 \noexpand#6 \fi
\csname the#1\endcsname
\endgroup
\ifnum #2=1\relax .\fi
\hskip 1em
}%
\fi
\@tempskipa #5\relax
\ifdim \@tempskipa>\z@
\begingroup
#6\relax
\@hangfrom{\hskip #3\relax\@svsec}%
\begingroup
\interlinepenalty \@M
\if@uchead
\MakeTextUppercase{#8}% HERE
\else
#8%
\fi
\par
\endgroup
\endgroup
\csname #1mark\endcsname{#7}%
\vskip -12pt %gkmt, 11 aug 99 and GM July 2000 (was -14) - numbered section head spacing
\addcontentsline{toc}{#1}{%
\ifnum #2>\c@secnumdepth \else
\protect\numberline{\csname the#1\endcsname}%
\fi
#7%
}%
\else
\def\@svsechd{%
#6%
\hskip #3\relax
\@svsec
\if@uchead
\uppercase{#8}%
\else
#8%
\fi
\csname #1mark\endcsname{#7}%
\addcontentsline{toc}{#1}{%
\ifnum #2>\c@secnumdepth \else
\protect\numberline{\csname the#1\endcsname}%
\fi
#7%
}%
}%
\fi
\@xsect{#5}\hskip 1pt
\par
}
\makeatother
\declaretheorem{theorem}
\begin{document}
\section{Test Section}
\begin{theorem}
Test theorem
\end{theorem}
\begin{restatable}[Fundamental Theorem of Algebra]{theorem}{fta}
\label{thm:FTA}
Every non-constant single-variable polynomial with complex coefficients has at least one complex root.
\end{restatable}
\appendix
\section[Proof of the Fundamental Theorem of Algebra]{Proof of Theorem~\ref{thm:FTA}}
\fta*
\begin{proof}
Assume...
\end{proof}
\end{document}
Explanation:
The problem is that vldb.cls
sets the section (and also part) titles in upper case and uses the old TeX \uppercase
command to this end; this will produce problems if special commands, such as \ref
, are inside the argument of \section
(or \part
) since \uppercase
don't recognize them as special commands and tretas them in the wrong way (the LaTeX command \MakeUppercase
will also behave bad in this regard). To correct this situation, one can redefine (or patch) the internal command \@sect
, to use \MakeTextUppercase
(from the textcase
package), instead of the problematic \uppercase
command. In the example code above, the change was signaled with % HERE
.
New answer
The package cleveref
allows one to alias different counters to other ones, and this works locally in groups. So one solution is to add
\crefalias{section}{appendix}
just after \begin{appendices}
. You can do this globally using \AtBeginEnvironment
from etoolbox
.
\documentclass{scrartcl}
\usepackage{lipsum} % for dummy text
\usepackage{etoolbox}
\usepackage{appendix}
\usepackage[capitalize]{cleveref}
\AtBeginEnvironment{appendices}{\crefalias{section}{appendix}}
\begin{document}
\section{The first section}
\label{sec:1}
\lipsum[2]
\section{The second section}
\Cref{sec:1} tells us something, while \cref{app:1} tells us something
else! In \cref{app:2}, we see that this is self-contradictory. All
is fine again in \cref{sec:3}.
\begin{appendices}
\section{The first appendix}
\label{app:1}
\lipsum[2]
\subsection{An appendix subsection}
\label{app:2}
\lipsum[3]
\end{appendices}
\section{The third section}
\label{sec:third-section}
\label{sec:3}
\lipsum[4]
\end{document}
Old answer
The package cleveref
provides a mechanism for this. Introduce a new type appsec
and set up the label name via \crefname
; then in the appendices part use \crefalias
to get the section type to point to the type appsec
:
\documentclass{scrartcl}
\usepackage{lipsum}
\usepackage{appendix}
\usepackage[capitalize]{cleveref}
\Crefname{appsec}{appendix}{appendices}
\begin{document}
\section{The first section}\label{sec:1}
\lipsum[2]
\section{The second section}
\Cref{sec:1} tells us something, while \cref{app:1} tells us something else!
\begin{appendices}
\crefalias{section}{appsec}
\section{The first appendix}\label{app:1}
\lipsum[2]
\end{appendices}
\end{document}
Best Answer
If you want to suppress the cross-reference name for a particular type, it's simpler to just use
Then all the formats get defined for you automatically, instead of having to redefine
\crefformat
,\crefmultiformat
,\crefrangeformat
, and\labelcrefformat
separately. (These days,cleveref
is clever enough to omit the usual non-breaking space after the cross-reference name if you define an empty name.)However, this solution (and ach's too) will break
cleveref
's multi-reference features somewhat. E.g.\cref{apdx1,apdx2,apdx3,apdx5,apdx7}
will produce "Appendix 1 to Appendix 3 and Appendix 4 and Appendix 5", instead of "Appendices 1 to 3, 4 and 5".Luckily,
elsarticle
defines an\appendixname
macro to hold the string used in appendix labels, no doubt to allow it to be customised easily. So the best solution is simply to get rid ofelsarticle
's\appendixname
entirely, and letcleveref
do its job as usual, by adding this to your preamble: