summaryrefslogtreecommitdiff
path: root/tex/thesis/style/prettyref.sty
blob: d1700a847b74f013e931b9da7cbe2c8dca9cd30f (about) (plain)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
%% prettyref v3.0
%%
%% Copyright 1995,1998.  by Kevin Ruland kevin@rodin.wustl.edu
%%
%% Modified 2003, by David Symonds:
%%	- added non-breaking space (~) in reference formats
%%	- used {varioref} to get nicer page references
%%	- added \shortref to get almost the same, except for page references
%%
\ProvidesPackage{style/prettyref}[1998/07/09 v3.0]
\usepackage{varioref}
\def\newrefformat#1#2{%
  \@namedef{pr@#1}##1{#2}}
\def\prettypageref#1{\vpageref{#1}}
\newrefformat{eq}{\textup{(\ref{#1})}}
\newrefformat{lem}{Lemma~\ref{#1} \prettypageref{#1}}
\newrefformat{thm}{Theorem~\ref{#1}}
\newrefformat{cha}{Chapter~\ref{#1} \prettypageref{#1}}
\newrefformat{sec}{Section~\ref{#1} \prettypageref{#1}}
\newrefformat{app}{Appendix~\ref{#1} \prettypageref{#1}}
\newrefformat{tab}{Table~\ref{#1} \prettypageref{#1}}
\newrefformat{fig}{Figure~\ref{#1} \prettypageref{#1}}
\newrefformat{alg}{Algorithm~\ref{#1} \prettypageref{#1}}
\def\prettyref#1{\@prettyref#1:}
\def\@prettyref#1:#2:{%
  \expandafter\ifx\csname pr@#1\endcsname\relax%
    \PackageWarning{prettyref}{Reference format #1\space undefined}%
    \ref{#1:#2}%
  \else%
    \csname pr@#1\endcsname{#1:#2}%
  \fi%
}



\def\newshortrefformat#1{%
  \@namedef{prS@#1}##1}
\newshortrefformat{lem}{Lemma~\ref{#1}}
\newshortrefformat{cha}{Chapter~\ref{#1}}
\newshortrefformat{sec}{Section~\ref{#1}}
\newshortrefformat{app}{Appendix~\ref{#1}}
\newshortrefformat{tab}{Table~\ref{#1}}
\newshortrefformat{fig}{Figure~\ref{#1}}
\newshortrefformat{alg}{Algorithm~\ref{#1}}
\def\shortref#1{\@shortref#1:}
\def\@shortref#1:#2:{%
  \expandafter\ifx\csname prS@#1\endcsname\relax%
    \PackageWarning{prettyref}{Reference format #1\space undefined}%
    \ref{#1:#2}%
  \else%
    \csname prS@#1\endcsname{#1:#2}%
  \fi%
}


\endinput
%%
%% End of file `prettyref.sty'.