summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/fancyref
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/fancyref
Initial commit
Diffstat (limited to 'macros/latex/contrib/fancyref')
-rw-r--r--macros/latex/contrib/fancyref/COPYING339
-rw-r--r--macros/latex/contrib/fancyref/README30
-rw-r--r--macros/latex/contrib/fancyref/fancyref.dtx2072
-rw-r--r--macros/latex/contrib/fancyref/fancyref.ins40
-rw-r--r--macros/latex/contrib/fancyref/fancyref.pdfbin0 -> 115886 bytes
5 files changed, 2481 insertions, 0 deletions
diff --git a/macros/latex/contrib/fancyref/COPYING b/macros/latex/contrib/fancyref/COPYING
new file mode 100644
index 0000000000..e77696ae8d
--- /dev/null
+++ b/macros/latex/contrib/fancyref/COPYING
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/macros/latex/contrib/fancyref/README b/macros/latex/contrib/fancyref/README
new file mode 100644
index 0000000000..246115eec2
--- /dev/null
+++ b/macros/latex/contrib/fancyref/README
@@ -0,0 +1,30 @@
+ fancyref, a LaTeX package for fancy cross-referencing.
+ Copyright (C) 1999 Axel Reichert
+
+ Files:
+ fancyref.ins Batch file, run through LaTeX
+ fancyref.dtx Docstrip archive, run through LaTeX
+ fancyref.sty LaTeX package, generated by fancyref.ins from fancyref.dtx
+ fancyref.dvi Package documentation, generated from fancyref.dtx
+ freftest.tex Test file, generated by fancyref.ins from fancyref.dtx
+ freftest.dvi Test file, generated from freftest.tex
+ README This file
+ COPYING The GNU General Public License
+
+ E-Mail: axel.reichert@gmx.de
+ Address: Axel Reichert, Beethovenstrasse 25, D-40233 Duesseldorf
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
diff --git a/macros/latex/contrib/fancyref/fancyref.dtx b/macros/latex/contrib/fancyref/fancyref.dtx
new file mode 100644
index 0000000000..5f144f038f
--- /dev/null
+++ b/macros/latex/contrib/fancyref/fancyref.dtx
@@ -0,0 +1,2072 @@
+% \iffalse
+%
+% fancyref.dtx
+% Docstrip archive, run through LaTeX.
+%
+% Copyright (C) 1999 Axel Reichert
+% See the files README and COPYING.
+%
+% \fi
+%
+% \CheckSum{754}
+%
+%% \CharacterTable
+%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
+%
+% \newcommand*{\ac}[1]{{\small #1}}
+% \newcommand*{\booktitle}[1]{\emph{#1}}
+% \newcommand*{\delimitor}[1]{\texttt{#1}}
+% \newcommand*{\env}[1]{\texttt{#1}}
+% \newcommand*{\error}[1]{\texttt{#1}}
+% \newcommand*{\file}[1]{\texttt{#1}}
+% \newcommand*{\format}[1]{\texttt{#1}}
+% \newcommand*{\frowney}{\texttt{)-:}}
+% \newcommand*{\labelname}[1]{\texttt{#1}}
+% \newcommand*{\mantitle}[1]{\emph{#1}}
+% \newcommand*{\option}[1]{\texttt{#1}}
+% \newcommand*{\package}[1]{\texttt{#1}}
+% \newcommand*{\person}[1]{\textsc{#1}}
+% \newcommand*{\prefix}[1]{\texttt{#1}}
+% \newcommand*{\sampleoutput}[1]{``#1''}
+% \newcommand*{\smiley}{\texttt{(-:}}
+% \newcommand*{\socalled}[1]{``#1''}
+% \newcommand*{\source}[1]{\texttt{#1}}
+% \newcommand*{\stringdef}[1]{``#1''}
+% \newcommand*{\winkey}{\texttt{(-;}}
+%
+% \changes{v0.9b}{1999-02-02}{First release}
+% \changes{v0.9c}{1999-02-03}{%
+% Bug fixed in \fancyrefaddcaptions (\person{Felix Neubauer}%
+% }
+%
+% \title{Fancy Cross-referencing}
+% \author{Axel Reichert}
+% \date{1999-02-03}
+% \maketitle
+% \begin{abstract}
+% \noindent
+% \file{fancyref.sty} is a package for fancy
+% cross-referencing. See the files \file{README} and
+% \file{COPYING} for additional information.
+% \end{abstract}
+% \tableofcontents
+%
+%
+% \section{Introduction}
+%
+% Besides the notorious FAQ problem ``I get a section number when
+% refering to a figure!''\footnote{Just put \cmd{\label}
+% \emph{after} \cmd{\caption}.}, cross-referencing with \LaTeX{} is
+% simple: You set a \cmd{\label} and refer to it with \cmd{\ref}
+% and \cmd{\pageref}. These commands just work.
+%
+% Some lazy people soon had the idea to write a \cmd{\fullref}
+% command to save some keystrokes:
+%\begin{verbatim}
+% \newcommand*{\fullref}[1]{\ref{#1} on page~\pageref{#1}}
+%\end{verbatim}
+% After that, people sometimes got page references to the current
+% page which cluttered the text with redundant information.
+%
+% Perhaps one of these people was \person{Frank Mittelbach}, who
+% was so annoyed that he wrote the \package{varioref} package
+% \cite{Mittelbach:1998}. It provides a \cmd{\vref} command which
+% generates output dependent on the difference between the page
+% number of the label and the page number of the cross-reference,
+% e.\,g.\ like \sampleoutput{on the next page} or \sampleoutput{on
+% page~27}. No output will be generated if label and
+% cross-reference fall onto the same page. This is really great,
+% especially as the package supports lots of \emph{languages}.
+%
+% If you write larger documents with lots of sections and figures,
+% you probably will find out that it is important to keep track of
+% your labels. If you have a section labeled \labelname{britain}
+% and a figure labeled \labelname{england}, it is only a question
+% of time until you mix them up. To avoid this, most people
+% \emph{prefix} the label with an abbreviation for the type of the
+% referenced object, e.\,g.\ \prefix{fig} is widely used for figure
+% labels. Also it is common practice to separate this classifying
+% prefix from the label by a \emph{delimitor} character, normally
+% \delimitor{:} is used by convention
+% \cite[p.\,41]{Goossens:1994}. If your labels look like
+% \labelname{sec:britain} or \labelname{fig:england} a mix-up will
+% belong to the past.
+%
+% In almost all cases when you are referencing to a figure, you
+% will add a descriptive \emph{string} like \sampleoutput{Figure},
+% because the counter only is not very helpful to the
+% reader. Hence, some people write macros for this purpose:
+%\begin{verbatim}
+% \newcommand*{\figref}[1]{\figurename~\ref{#1}}
+%\end{verbatim}
+% \cmd{\figurename} is much better than hard-coding
+% \sampleoutput{Figure} into the macro, because in this way the
+% command not only works in other languages, but also if you
+% redefine the string:
+%\begin{verbatim}
+% \renewcommand*{\figurename}{Picture}
+%\end{verbatim}
+% Both captions of figures and cross-references will now happily
+% use the new string.
+%
+% In many journals cross-references to figures are emphasized by
+% usage of bold face or (much worse) underlining. This enables the
+% reader (who is normally quickly browsing through an article) to
+% find the description of an interesting figure. Of course you can
+% add a \cmd{\textbf} to the definition above, however, you will
+% run into trouble, if you want to use the \package{varioref}
+% package. Neither
+%\begin{verbatim}
+% \newcommand*{\figref}[1]{\textbf{\figurename~\vref{#1}}}
+%\end{verbatim}
+% nor
+%\begin{verbatim}
+% \newcommand*{\figref}[1]{\textbf{\figurename}~\vref{#1}}
+%\end{verbatim}
+% will produce the desired output: You will get
+% \sampleoutput{\textbf{\figurename~1 on page~2}} or
+% \sampleoutput{\textbf{\figurename}~1 on page~2} instead of
+% \sampleoutput{\textbf{\figurename~1} on page~2}. What you can do
+% in this case is to hack the strings used by \file{varioref.sty},
+% e.\,g.\ like:
+%\begin{verbatim}
+% \renewcommand*{\reftextfaraway}[1]{%
+% \normalfont on page~\pageref{#1}%
+% }
+%\end{verbatim}
+% But this is dependent on the language and does not work within
+% italic text.
+%
+% Also, you will not want bold face for every cross-reference to a
+% figure, only for the \socalled{main} cross-reference. And you
+% will not want the page number to appear in every cross-reference
+% when explaining a picture consisting of subfigures:
+% \sampleoutput{The left part of Figure~1 on the following page
+% shows England. The right part of Figure~1 on the next page shows
+% Great Britain.} So your set of macros will grow further by
+% \cmd{\mainfigref} and \cmd{\shortfigref}. And of course the same
+% applies to tables as well. Slowly, cross-referencing starts to
+% get messy~\ldots
+%
+% Ok, you got the idea. I felt the need for a more general
+% solution. The \package{fancyref} package supports different
+% \emph{languages} (at the moment only english and german) and
+% allows customization of the classifying \emph{prefixes}, the
+% \emph{delimitor} character and the \emph{strings} used in
+% cross-references. Most important, it provides user-definable
+% \emph{formats}. Enough advocacy, here we go!
+%
+%
+% \section{Loading\label{sec:loading}}
+%
+% You will need:
+% \begin{enumerate}
+% \item \LaTeXe{} (at least the 1995/06/01 release)
+% \item The \package{varioref} package (part of the standard
+% \LaTeX{} tools, normally included in every distribution)
+% \item The \package{german} or \package{babel} package
+% \cite{Raichle:1996, Braams:1997} (if you want to write not only
+% in english)
+% \end{enumerate}
+%
+% The loading is simple:
+%\begin{verbatim}
+% \usepackage{fancyref}
+%\end{verbatim}
+% English is used as the default language.
+%
+%
+% \subsection{Language Options}
+%
+% At the moment only english and german are supported languages,
+% others might follow.
+%
+% If you write a german text:
+% \DescribeMacro{german}
+%\begin{verbatim}
+% \usepackage{german} % \usepackage[german]{babel}
+% \usepackage[german]{fancyref}
+%\end{verbatim}
+% \DescribeMacro{english}
+% If you write a mixed english/german text:
+%\begin{verbatim}
+% \usepackage{german} % \usepackage[english,german]{babel}
+% \usepackage[english,german]{fancyref}
+%\end{verbatim}
+% As with \file{babel.sty} the last language given in the optional
+% argument is the current language. For \file{german.sty} you will
+% have to use the \cmd{\selectlanguage} command
+% \cite[p.\,7]{Raichle:1996} for english as current language.
+%
+% Do \emph{not} pass the language as a global option to the
+% document class! Due to a feature of the \LaTeX{} option handler
+%\begin{verbatim}
+% \documentclass[english,danish]{article}
+% \usepackage{babel,fancyref}
+%\end{verbatim}
+% will result in danish headings (\sampleoutput{Figur}) and english
+% strings for the cross-references (\sampleoutput{Figure}),
+% without a warning or an error \cite[p.\,20]{LaTeX:1998}. The
+% correct usage
+%\begin{verbatim}
+% \documentclass{article}
+% \usepackage[english,danish]{babel,fancyref}
+%\end{verbatim}
+% gives a package error, as expected, because danish is not (yet)
+% supported (see \fref{sec:names}).
+%
+%
+% \subsection{Spacing Options}
+%
+% The spacing between the string and the counter can be adjusted,
+% see also \fref{sec:spacing}.
+%
+% \DescribeMacro{loose}
+% Loose spacing, like in \sampleoutput{Figure~1}, which is the
+% default, can be turned on explicitly by:
+%\begin{verbatim}
+% \usepackage[loose]{fancyref}
+%\end{verbatim}
+% \DescribeMacro{tight}
+% Tight spacing, like in \sampleoutput{Figure\,1} will be obtained
+% with:
+%\begin{verbatim}
+% \usepackage[tight]{fancyref}
+%\end{verbatim}
+%
+% Most textbooks on typography recommend loose spacing (i.\,e.\ a
+% normal word space) in this context, but tight spacing (half a
+% word space) is recommended in abbreviated formats like
+% \sampleoutput{Fig.\,1} \cite[p.\,220]{Willberg:1997}.
+%
+%
+% \subsection{Format Options}
+%
+% The usage of page numbers for the cross-references can be
+% controlled by using different \package{fancyref} formats, see
+% \fref{sec:formats}. The two most common variants are provided
+% also as package options.
+%
+% \DescribeMacro{plain}
+% Output without a page number, like \sampleoutput{Figure~1}, is
+% used if the \option{plain} option is specified:
+%\begin{verbatim}
+% \usepackage[plain]{fancyref}
+%\end{verbatim}
+% \DescribeMacro{vario}
+% Output like from the \package{varioref} package
+% (\sampleoutput{Figure~1 on the following page}) is used by
+% default, but you could give the \option{vario} option
+% explicitely:
+%\begin{verbatim}
+% \usepackage[vario]{fancyref}
+%\end{verbatim}
+%
+%
+% \subsection{Hook Options}
+%
+% The appearance of a cross-reference can not only be controlled by
+% individual formats
+% \marginpar{\raggedleft\footnotesize$\rightarrow$
+% Sec.\,\ref{sec:formats}, p.\,\pageref{sec:formats}} which depend
+% on the type of the referenced object, but also by a \emph{hook}
+% which is executed for \emph{every} cross-reference, see
+% \fref{sec:hooks}. Two variants of this hook can be activated by
+% package options (but only one at a time).
+%
+% \DescribeMacro{margin}
+% You can place all cross-references into the margin, like
+% above. This is achieved by:
+%\begin{verbatim}
+% \usepackage[margin]{fancyref}
+%\end{verbatim}
+% If you want to do this, you should be aware of the limited space
+% in the margin and use abbreviated formats. In my opinion marginal
+% cross-references are sensible only for floats, for which I
+% already defined the \option{margin} formats
+% (see~\fref{sec:formats}), so this option should better be
+% considered as an example of a hook. The above example was indeed
+% done manually. \winkey
+%
+% \DescribeMacro{paren}
+% You can put all cross-references into parentheses, like this:
+% (\fref{sec:usage}). This is achieved by:
+%\begin{verbatim}
+% \usepackage[paren]{fancyref}
+%\end{verbatim}
+% Neither use this option in combination with the \option{margin}
+% option nor with the \format{margin} formats!
+%
+%
+% \section{Usage\label{sec:usage}}
+%
+% The cross-referencing is done by two almost identical macros.
+%
+% \DescribeMacro{\fref}
+% \cmd{\fref} is used within a sentence and gives lower-case
+% output, like \sampleoutput{figure~1}.
+%
+% \DescribeMacro{\Fref}
+% \cmd{\Fref} is used at the beginning of a sentence and gives
+% output with normal capitalization, like
+% \sampleoutput{Figure~1}. For german users the macros make no
+% difference, \sampleoutput{Abbildung~1} remains
+% \sampleoutput{Abbildung~1} even within a sentence. How sensible!
+% \winkey
+%
+% There seems to be no reliable heuristic to determine the start of
+% a sentence, so you either have to cope with two macros or accept
+% \sampleoutput{Figure~1} even within a sentence.
+%
+% Both macros take one optional argument, the format of the
+% cross-reference, and one mandatory argument, consisting of the
+% classifying prefix, the delimitor character and the label itself:
+% \begin{tabbing}
+% \small
+% | \fref[|\meta{format}|]{|\meta{prefix}\meta{delim}\meta{label}|}| \\
+% \small
+% | \Fref[|\meta{format}|]{|\meta{prefix}\meta{delim}\meta{label}|}|
+% \end{tabbing}
+% A typical cross-reference will thus look like this,
+%\begin{verbatim}
+% \fref{fig:england}
+%\end{verbatim}
+% with \prefix{fig} as the prefix, \delimitor{:} as the delimitor
+% and \labelname{britain} as the label, using the default
+% format. The formats, the prefixes and the delimitor character are
+% described in detail in the following section.
+%
+%
+% \section{Customization}
+%
+%
+% \subsection{Prefixes\label{sec:prefixes}}
+%
+% \DescribeMacro{\...labelprefix}
+% The following table shows the defaults of the various prefixes I
+% already defined for you.
+% \begin{center}
+% \begin{tabular}{@{}lll@{}}
+% \hline
+% Object &
+% Macro &
+% Prefix \\
+% \hline
+% Chapter & \cmd{\fancyrefchaplabelprefix} &
+% \prefix{\fancyrefchaplabelprefix} \\
+% Section & \cmd{\fancyrefseclabelprefix} &
+% \prefix{\fancyrefseclabelprefix} \\
+% Equation & \cmd{\fancyrefeqlabelprefix} &
+% \prefix{\fancyrefeqlabelprefix} \\
+% Figure & \cmd{\fancyreffiglabelprefix} &
+% \prefix{\fancyreffiglabelprefix} \\
+% Table & \cmd{\fancyreftablabelprefix} &
+% \prefix{\fancyreftablabelprefix} \\
+% Enumeration & \cmd{\fancyrefenumlabelprefix} &
+% \prefix{\fancyrefenumlabelprefix} \\
+% Footnote & \cmd{\fancyreffnlabelprefix} &
+% \prefix{\fancyreffnlabelprefix} \\
+% \hline
+% \end{tabular}
+% \end{center}
+%
+% If you need to add a prefix, use the following syntax:
+% \begin{tabbing}
+% \small
+% | \newcommand*{|\meta{macro}|}{|\meta{prefix}|}|
+% \end{tabbing}
+% For example, if you need theorems in your document, you could
+% use:
+%\begin{verbatim}
+% \newcommand*{\fancyrefthmlabelprefix}{thm}
+%\end{verbatim}
+% Note that the name of the macro does not matter, but names
+% fitting into the scheme are highly recommended. Be consistent.
+% After that, you will need to define your own \package{fancyref}
+% formats for the new prefixes. Read \fref{sec:formats}. And let me
+% know of objects for which I should supply prefixes.
+%
+% \DescribeMacro{\...changeprefix}
+% If you need to change a prefix (either one I already provided or
+% one you added later), use the following syntax:
+% \begin{tabbing}
+% \small
+% | \fancyrefchangeprefix{|\meta{macro}|}{|\meta{prefix}|}|
+% \end{tabbing}
+% For example, if you are labeling your equations with \prefix{eqn}
+% instead of \prefix{eq} (I guess this will be the most common
+% change):
+%\begin{verbatim}
+% \fancyrefchangeprefix{\fancyrefeqlabelprefix}{eqn}
+%\end{verbatim}
+%
+%
+% \subsection{Delimitors\label{sec:delimitors}}
+%
+% \DescribeMacro{\fancyrefargdelim}
+% The default delimitor character is the colon (\delimitor{:}). If
+% you need to change it, for example to \delimitor{-}, use the
+% following syntax:
+%\begin{verbatim}
+% \renewcommand*{\fancyrefargdelim}{-}
+%\end{verbatim}
+% There is no restriction to one character, you could also use
+% \delimitor{too-long}, but you definitely should use a delimitor
+% that never, ever occurs within the real label. A single
+% \emph{letter} would be a very bad idea.
+%
+%
+% \subsection{Spacing\label{sec:spacing}}
+%
+% \DescribeMacro{\...spacing}
+% Quite unlikely that someone is not happy with at least one of the
+% package options for this purpose, but one never knows~\ldots
+%
+% The following table shows the definition of the spacing macros.
+% \begin{center}
+% \begin{tabular}{@{}lll@{}}
+% \hline
+% Macro & Definition & Example \\
+% \hline
+% \cmd{\fancyrefloosespacing} & |~| &
+% \Freffigname\fancyrefloosespacing 1 \\
+% \cmd{\fancyreftightspacing} & \cmd{\,} &
+% \Freffigname\fancyreftightspacing 1 \\
+% \cmd{\fancyrefdefaultspacing} &
+% \cmd{\fancyrefloosespacing} &
+% \Freffigname\fancyrefdefaultspacing 1 \\
+% \hline
+% \end{tabular}
+% \end{center}
+%
+% You could switch from loose to tight spacing and vice versa even
+% after the package is loaded:
+%\begin{verbatim}
+% \renewcommand*{\fancyrefdefaultspacing}{%
+% \fancyreftightspacing
+% }
+%\end{verbatim}
+%
+% You could loosen the tight spacing or tighten the loose spacing
+% by using for example
+%\begin{verbatim}
+% \renewcommand*{\fancyrefloosespacing}{\kern.25em}
+%\end{verbatim}
+% but you should not change \cmd{\fancyrefdefaultspacing} in this
+% way, because you would lose flexibility: Almost all
+% \package{fancyref} formats (except the \format{margin} formats)
+% use \cmd{\fancyrefdefaultspacing}, so it is clever to adjust
+% \cmd{\fancyreftightspacing} and \cmd{\fancyrefloosespacing} and
+% then to switch between the two variants. But I doubt that this
+% will ever be necessary.
+%
+%
+% \subsection{Names\label{sec:names}}
+%
+% \DescribeMacro{\...name}
+% The following table shows some strings that are already provided
+% by many document classes. If they do not exist, I will define
+% them, otherwise I will not touch their values (in case you have
+% changed them already).
+% \begin{center}
+% \begin{tabular}{@{}lll@{}}
+% \hline
+% Macro &
+% English string &
+% German string \\
+% \hline
+% \cmd{\chaptername} & \chaptername & Kapitel \\
+% \cmd{\figurename} & \figurename & Abbildung \\
+% \cmd{\pagename} & \pagename & Seite \\
+% \cmd{\tablename} & \tablename & Tabelle \\
+% \hline
+% \end{tabular}
+% \end{center}
+%
+% \DescribeMacro{\Fref...name}
+% The next table shows the strings used for cross-references at the
+% beginning of a sentence.
+% \begin{center}
+% \begin{tabular}{@{}lll@{}}
+% \hline
+% Macro &
+% English string &
+% German string \\
+% \hline
+% \cmd{\Frefchapname} & \cmd{\chaptername} & \cmd{\chaptername} \\
+% \cmd{\Frefenumname} & \Frefenumname & Punkt \\
+% \cmd{\Frefeqname} & \Frefeqname & Gleichung \\
+% \cmd{\Freffigname} & \cmd{\figurename} & \cmd{\figurename} \\
+% \cmd{\Freffnname} & \Freffnname & Fu\ss note \\
+% \cmd{\Frefonname} & \Frefonname & Auf \\
+% \cmd{\Frefpgname} & \cmd{\pagename} & \cmd{\pagename} \\
+% \cmd{\Frefsecname} & \Frefsecname & Abschnitt \\
+% \cmd{\Frefseename} & \Frefseename & Siehe \\
+% \cmd{\Freftabname} & \cmd{\tablename} & \cmd{\tablename} \\
+% \hline
+% \end{tabular}
+% \end{center}
+%
+% The \package{fancyref} package uss own macros to achieve maximum
+% flexibility: If you redefine \cmd{\figurename} to
+% \stringdef{Picture}, both the caption and the cross-references
+% will use this string. If brevity is more important to you than
+% consistency, you could also use \stringdef{Picture} within the
+% caption and \stringdef{Pic.} for the cross-references. The
+% necessary code is:
+%\begin{verbatim}
+% \renewcommand*{\figurename}{Picture}
+% \renewcommand*{\Freffigname}{Pic.}
+%\end{verbatim}
+%
+% \DescribeMacro{\fref...name}
+% Within a sentence you should use \stringdef{picture} instead of
+% \stringdef{Picture}. The \package{fancyref} package takes care of
+% this for you and defines the corresponding macros
+% (\cmd{\fref...name}) with automatically generated lower-case
+% strings.
+%
+% \DescribeMacro{\Frefonname}
+% \cmd{\Frefonname} and \cmd{\Frefseename} are not used by any
+% \package{fancyref} formats, but you could use them for your
+% additional formats.
+% \DescribeMacro{\Frefseename}
+% An interesting idea would be to use an arrow ($\mathsurround
+% 0pt\rightarrow$) for \cmd{\Frefseename}:
+%\begin{verbatim}
+% \renewcommand*{\Frefseename}{%
+% \ensuremath{\mathsurround 0pt\rightarrow}%
+% }
+%\end{verbatim}
+% If do this, there will be no need to redefine \cmd{\frefseename}
+% manually, because the \cmd{\MakeLowercase} command
+% \cite[p.\,26]{LaTeX:1998} used internally to generate the
+% lower-case strings can cope even with such strange
+% things. \smiley
+%
+% \DescribeMacro{\Fref...shortname}
+% The table shows some abbreviated strings used for
+% cross-references with the \format{margin} formats. I do not like
+% abbreviations very much,\footnote{I am stubborn, \person{Dirk},
+% am I not? \winkey} because they need to be introduced carefully
+% (written out at the first occurrence) and even then make a
+% document less readable. Also, at the beginning of a sentence,
+% abbreviations should be written out, so you run into
+% inconsistencies (also known as trouble). In my opinion they are
+% reasonable for the \format{margin} formats, so only the strings
+% necessary for these formats are defined. If you are a big fan of
+% \ac{PCMCIA}\footnote{People Cannot Memorize Computer Industry's
+% Acronyms.} or abbreviations or simply do not bear my propaganda,
+% you are on your own.
+% \begin{center}
+% \begin{tabular}{@{}lll@{}}
+% \hline
+% Macro &
+% English string &
+% German string \\
+% \hline
+% \cmd{\Freffigshortname} & \Freffigshortname & Abb. \\
+% \cmd{\Frefpgshortname} & \Frefpgshortname & S. \\
+% \cmd{\Freftabshortname} & \Freftabshortname & Tab. \\
+% \hline
+% \end{tabular}
+% \end{center}
+% Lower-case versions of these strings (\cmd{\fref...shortname})
+% are generated automatically again.
+%
+% \DescribeMacro{\...addcaptions}
+% If you add new prefixes (\fref{sec:prefixes}), you will probably
+% also need further strings, e.\,g.\ \cmd{\frefthmname}. If you
+% write a multilingual document, they should automatically be
+% changed with the active language. For this case the
+% \package{fancyref} package offers the following command,
+% \begin{tabbing}
+% \small
+% | \fancyrefaddcaptions{|\meta{language}|}{|\meta{stringdefs}|}|
+% \end{tabbing}
+% which can be used only in the preamble of the document. In the
+% above example you would use:
+%\begin{verbatim}
+% \fancyrefaddcaptions{english}{%
+% \newcommand*{\Frefthmname}{Theorem}%
+% \newcommand*{\frefthmname}{%
+% \MakeLowercase{\Frefthmname}%
+% }%
+% }
+% \fancyrefaddcaptions{german}{%
+% \newcommand*{\Frefthmname}{Satz}%
+% \newcommand*{\frefthmname}{\Frefthmname}%
+% }
+%\end{verbatim}
+% If you can supply such additional strings or further languages,
+% please do and send me a mail.
+%
+%
+% \subsection{Formats\label{sec:formats}}
+%
+% The output of the \cmd{\fref} and \cmd{\Fref} commands depends on
+% the used \package{fancyref} format. For all the different objects
+% that can be cross-referenced, two \package{fancyref} formats,
+% \format{plain} and \format{vario}, are already defined. In
+% addition, for the floating objects (\env{figure} or \env{table}
+% environments) two other \package{fancyref} format called
+% \format{margin} and \format{main} are available. The following
+% table shows sample output of these \package{fancyref} formats.
+% \begin{center}
+% \begin{tabular}{@{}lll@{}}
+% \hline
+% Object &
+% Format &
+% Output \\
+% \hline
+% Chapter & \prefix{vario} &
+% \frefchapname\fancyrefdefaultspacing 1 on the following page \\
+% & \prefix{plain} & \Frefchapname\fancyrefdefaultspacing 1 \\
+% Equation & \prefix{vario} &
+% \Frefeqname\fancyrefdefaultspacing (1) on the previous page \\
+% & \prefix{plain} & \frefeqname\fancyrefdefaultspacing (1) \\
+% Figure & \prefix{margin} & \footnotesize$\rightarrow$~%
+% \Freffigshortname\fancyreftightspacing 1,
+% p.\fancyreftightspacing 1 \\
+% & \prefix{main} &
+% \textbf{\freffigname\fancyrefdefaultspacing 1} on the
+% facing page \\
+% & \prefix{vario} & \Freffigname\fancyrefdefaultspacing 1 on
+% the page before \\
+% & \prefix{plain} & \freffigname\fancyrefdefaultspacing 1 \\
+% \hline
+% \end{tabular}
+% \end{center}
+% The \package{fancyref} formats for sections, enumerations and
+% footnotes give output similar to those for chapters, whereas the
+% formats for tables correspond to the \package{fancyref} formats
+% for figures.
+%
+% \DescribeMacro{\...defaultformat}
+% If no optional argument is specified for the \cmd{\fref} or
+% \cmd{\Fref} command, the \format{vario} format will be used. You
+% can change this default \package{fancyref} format to
+% \format{plain}:
+%\begin{verbatim}
+% \renewcommand{\fancyrefdefaultformat}{plain}
+%\end{verbatim}
+%
+% If you do not like some of these \package{fancyref} formats or
+% you need some more, e.\,g.\ for theorems, algorithms etc., you
+% will have to define them yourself. If you define some nice
+% formats, please let me know, perhaps I will add them in a future
+% version of this package.
+%
+% \DescribeMacro{\frefformat}
+% The definition is done by means of two almost identical
+% macros. \cmd{\frefformat} declares (or changes) the formats used
+% within a
+% \DescribeMacro{\Frefformat}
+% sentence, whereas \cmd{\Frefformat} does the same for the formats
+% used at the beginning of a sentence. Unfortunately this means
+% that you need to do the work twice. \frowney
+%
+% Both macros take three mandatory arguments, the name of the
+% \package{fancyref} format, the prefix macro and the description
+% of the format itself:
+% \begin{tabbing}
+% \small
+% | \frefformat{|\meta{format}|}{|\meta{prefix macro}\meta{output}|}| \\
+% \small
+% | \Frefformat{|\meta{format}|}{|\meta{prefix macro}\meta{output}|}|
+% \end{tabbing}
+% Within the third argument |#1| will be replaced by the counter of
+% the referenced object (i.\,e.\ the output of a \cmd{\ref}
+% command), |#2| will be replaced by the page number (i.\,e.\ the
+% output of a \cmd{\pageref} command) and |#3| will be replaced by
+% the output of a \cmd{\vpageref} command (\sampleoutput{on the
+% facing page}, \sampleoutput{on page~1}).
+%
+% As an example, I will modify the output foss-references to
+% figures done with the \format{main} format:
+%\begin{verbatim}
+% \frefformat{main}{\fancyreffiglabelprefix}{%
+% \MakeUppercase{\freffigname}\fancyrefdefaultspacing#1#2%
+% }%
+% \Frefformat{main}{\fancyreffiglabelprefix}{%
+% \MakeUppercase{\Freffigname}\fancyrefdefaultspacing#1#2%
+% }%
+%\end{verbatim}
+% These redefinitions will make |\fref[main]{fig:foo}| come out as
+% \sampleoutput{FIGURE~1 on page~1}. The page number will always be
+% printed explicitly, not like \file{varioref.sty} output. By use
+% of the \cmd{\freffigname}, \cmd{\Freffigname} and
+% \cmd{\fancyrefdefaultspacing} commands it is ensured that further
+% modifications of the string as well as the spacing and language
+% options of the package will work. A quick and dirty hack would
+% have been:
+%\begin{verbatim}
+% \frefformat{main}{\fancyreffiglabelprefix}{FIGURE~#1#2}
+% \Frefformat{main}{\fancyreffiglabelprefix}{FIGURE~#1#2}
+%\end{verbatim}
+%
+% The usage of the defined macros for spacing and naming like in
+% the first example is of course highly recommended. Do not blame
+% me, if your lazyness leads to inconsistencies. \winkey
+%
+% Note that in either case you \emph{must} use the prefix
+% \emph{macro}, not the string itself!
+%
+%
+% \subsection{Hooks\label{sec:hooks}}
+%
+% \DescribeMacro{\fancyrefhook}
+% After all the work of the \package{fancyref} formats has been
+% done, the result is passed as an argument to a hook command
+% called \cmd{\fancyrefhook}. Normally, this hook does nothing but
+% simply passing on the output. If you want to change this hook,
+% use the following syntax:
+% \begin{tabbing}
+% \small
+% | \renewcommand{\fancyrefhook}[1]{|\meta{definition}|}|
+% \end{tabbing}
+% Within \meta{definition}, |#1| will be replaced by the output of
+% the \package{fancyref} format.
+%
+% You can use this hook for all kinds of weird stuff, e.\,g.\ if
+% you want to have huge cross-references, use the following code:
+%\begin{verbatim}
+% \renewcommand*{\fancyrefhook}[1]{{\huge #1}}
+%\end{verbatim}
+% In this simple example the |*|-form of \cmd{\renewcommand} may be
+% used, because the hook does not contain whole paragraphs
+% \cite[p.\,14]{LaTeX:1997}. This makes debugging of your code
+% easier.
+%
+% A more complex (and totally brain-dead) example does not work
+% with the |*|-form:
+%\begin{verbatim}
+% \renewcommand{\fancyrefhook}[1]{%
+% \begin{itemize}%
+% \item #1%
+% \end{itemize}%
+% }
+%\end{verbatim}
+% If you define really \emph{useful} and \socalled{typographically
+% correct} hooks, please send me a mail, so I can include your work
+% in future versions of this package. \winkey
+%
+%
+% \section{Examples}
+%
+% See the example file \file{freftest.tex} and its output,
+% \file{freftest.dvi}.
+%
+%
+% \section{Bugs}
+%
+% None, as my beta testers, \person{Dirk Kuypers} and
+% \person{Robin~S.~Socha}, told me. \winkey
+%
+% If you encounter problems after having changed all your
+% cross-references to the macros provided by \file{fancyref.sty},
+% please go through the following checklist:
+% \begin{enumerate}
+% \item Make sure that you either use \delimitor{:} as a delimitor
+% or that have changed it as described in \fref{sec:delimitors}.
+% \item Make sure that you either use the default prefixes or that
+% you have changed them as described in
+% \fref{sec:prefixes}. Especially do \emph{not} try to modify the
+% prefixes with the \cmd{\renewcommand} command.
+% \item Make sure that you have defined all necessary formats in
+% addition to those provided by me. The definition of
+% \package{fancyref} formats is described in \fref{sec:formats}.
+% \item Make sure that you have eliminated all old superfluous
+% strings like \source{Figure} or \cmd{\figurename} in your source
+% code. Just replacing all \cmd{\ref} commands with \cmd{\fref}
+% will \emph{not} be sufficient.
+% \end{enumerate}
+%
+% As far as I know, there is only one \emph{real} problem: If you
+% are working on a multi-author document where each author is used
+% to a different set of prefixes and prefers a different delimitor,
+% be \emph{extremely cautious} when redefining the prefixes and the
+% delimitor. You will get really funny errors, if the current
+% delimitor is \delimitor{-}, the prefix for equations is
+% \prefix{eqn} and you try to make a cross-reference to an equation
+% in a part written by another author who used \delimitor{:} and
+% \prefix{eq} in his \cmd{\label} commands.
+%
+% With the current implementation the only solution is to
+% temporarily redefine the prefix and the deliminator, do the
+% cross-reference and switch back to the original definitions
+% again. This is annoying, of course. \frowney
+%
+% As a consequence, I would recommend either to drop this
+% cross-reference or to try to convince your co-authors that your
+% prefixes and delimitor are the best. Sorry.
+%
+%
+% \section{Implementation}
+%
+%
+% \subsection{Documentation Driver}
+%
+% \begin{macrocode}
+%<*driver>
+\documentclass[12pt,a4paper]{ltxdoc} \usepackage{fancyref}
+\begin{document}
+ \DocInput{fancyref.dtx}
+\end{document}
+%</driver>
+% \end{macrocode}
+% \StopEventually{
+% \font\logosl=logosl10 scaled\magstep1
+% \begin{thebibliography}{1}
+% \bibitem{AMS:1996}
+% American Mathematical Society.
+% \newblock \mantitle{$\cal{AMS}$-\LaTeX{} Version~1.2 User's
+% Guide}, Nov.~1996.
+% \newblock Version~1.02.
+% \bibitem{Braams:1997}
+% \person{Braams,~J.}: \mantitle{Babel, a multilingual package for
+% use with \LaTeX's standard document classes}.
+% \newblock Zoetermeer, Jan.~1997.
+% \bibitem{Franz:1998}
+% \person{Franz,~M.}: \mantitle{The \package{soul} package}, Dec.~1998.
+% \newblock Version~1.1a.
+% \bibitem{Goossens:1994}
+% \person{Goossens,~M.; Mittelbach,~F.; Samarin,~A.}: \booktitle{Der
+% \LaTeX-Begleiter}.
+% \newblock Addison-Wesley, Bonn, 1st~edn., 1994.
+% \bibitem{LaTeX:1997}
+% \LaTeX3 Project Team.
+% \newblock \mantitle{\LaTeXe{} for authors}, Jun.~1997.
+% \bibitem{LaTeX:1998}
+% \LaTeX3 Project Team.
+% \newblock \mantitle{\LaTeXe{} for class and package writers},
+% Jun.~1998.
+% \bibitem{Mittelbach:1998}
+% \person{Mittelbach,~F.}: \mantitle{The \package{varioref} package}.
+% \newblock Mainz, May~1998.
+% \newblock Version~1.1g.
+% \bibitem{Raichle:1996}
+% \person{Raichle,~B.}:
+% \mantitle{Kurzbeschreibung~--~\file{german.sty} (Version~2.5)}.
+% \newblock Deutschsprachige Anwendervereinigung \TeX{}~e.\,V.,
+% May~1996.
+% \newblock Version~2.5c.
+% \bibitem{Willberg:1997}
+% \person{Willberg,~H.\,P.; Forssman,~F.}:
+% \booktitle{Lesetypographie}.
+% \newblock Hermann Schmidt, Mainz, 1997.
+% \end{thebibliography}
+% }
+%
+%
+% \subsection{\file{fancyref.sty}}
+%
+% \begin{macrocode}
+%<*package>
+% \end{macrocode}
+%
+%
+% \subsubsection{Identification}
+%
+% As this package uses the \cmd{\MakeLowercase} command, it does
+% not work with older \LaTeXe{} versions.
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[1995/06/01]%
+% \end{macrocode}
+% The package identifies itself with its release date, a version
+% number and a short description.
+% \begin{macrocode}
+\ProvidesPackage{fancyref}[%
+ 1999/02/03 v0.9c Fancy cross-referencing%
+]%
+% \end{macrocode}
+%
+%
+% \subsubsection{Initialization}
+%
+% \begin{macro}{\@fancyref@add@to}
+% This macro is adapted from \file{babel.def}. If a command (the
+% first argument) is undefined, it will be defined by the content
+% of the second argument. If the command is defined already, the
+% content of the second argument will be appended to the old
+% definition of the command. The macro will be used to add further
+% definitions to the \cmd{\captions...} commands provided by the
+% \package{babel}~package or \file{german.sty}.
+% \begin{macrocode}
+\newcommand*{\@fancyref@add@to}[2]{%
+ \ifx#1\@undefined
+ \newcommand*{#1}{#2}%
+ \else
+ \ifx#1\relax
+ \newcommand*{#1}{#2}%
+ \else
+ \bgroup
+ \toks@\expandafter{#1#2}%
+ \xdef#1{\the\toks@}%
+ \egroup
+ \fi
+ \fi
+}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\...addcaptions}
+% This macro adds strings (the second argument) to the
+% \cmd{\captions...} commands\footnote{Credits go to \person{Bernd
+% Raichle} who told me how to do this in a politically correct
+% way.} provided by the \package{babel} package or
+% \file{german.sty}, or it simply defines these new strings. The
+% name of the language is given in the first argument.
+%
+% To make the new strings become effective, the current language is
+% saved\footnote{Credits go to \person{Felix Neubauer}, who pointed
+% out that this should be done in a temporary command rather than
+% a token register to avoid an error in combination with
+% \file{babel.sty} or \file{german.sty} and automatically
+% generated lists like the \file{toc}, \file{lof} or \file{lot}
+% files.} at the beginning of the document, the code defining the
+% strings is executed and the language for the captions is
+% switched back again.
+% \begin{macrocode}
+\newcommand*{\@fancyref@temp}{\@empty}%
+\newcommand*{\fancyrefaddcaptions}[2]{%
+ \@ifundefined{captions#1}{%
+ #2%
+ }{%
+ \expandafter
+ \@fancyref@add@to\csname captions#1\endcsname{#2}%
+ \AtBeginDocument{%
+ \let\@fancyref@temp=\languagename
+ \csname captions#1\endcsname
+ \csname captions\@fancyref@temp\endcsname
+ \let\@fancyref@temp=\@empty
+ }%
+ }%
+}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\fancyrefhook}
+% \label{sec:fancyrefhook}
+% It may be clever to define a hook that is executed for every
+% \cmd{\fref} or \cmd{\Fref} command. For the moment the hook does
+% nothing but simply inserting its argument. I will do something
+% more useful with it later in this file. \emph{You} can use it
+% also for the way of cross-referencing the world is waiting for.
+% \winkey
+%
+% Send me a mail, if you think you have defined a really nifty
+% hook, so I can include it in future versions of this package.
+% \begin{macrocode}
+\newcommand*{\fancyrefhook}[1]{#1}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\...spacing}
+% These two macros are used to define the spacing between the type
+% of the referenced object and the counter of the object, for
+% example between \sampleoutput{Figure} and \sampleoutput{1} in
+% \sampleoutput{Figure~1}. Normally there is no need to change
+% these definitions.
+% \begin{macrocode}
+\newcommand*{\fancyrefloosespacing}{~}%
+\newcommand*{\fancyreftightspacing}{\,}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\...defaultformat}
+% Now the default \package{fancyref} format is initialized. The
+% real value will be set later depending on the package options.
+% \begin{macrocode}
+\newcommand*{\fancyrefdefaultformat}{\@empty}%
+% \end{macrocode}
+% \end{macro}
+% Now some strings are initialized. The real values will be
+% declared later depending on the package options.
+% \begin{macrocode}
+\newcommand*{\Frefchapname}{\@empty}%
+\newcommand*{\Frefenumname}{\@empty}%
+\newcommand*{\Frefeqname}{\@empty}%
+\newcommand*{\Freffigname}{\@empty}%
+\newcommand*{\Freffnname}{\@empty}%
+\newcommand*{\Frefonname}{\@empty}%
+\newcommand*{\Frefpgname}{\@empty}%
+\newcommand*{\Frefsecname}{\@empty}%
+\newcommand*{\Frefseename}{\@empty}%
+\newcommand*{\Freftabname}{\@empty}%
+\newcommand*{\Freffigshortname}{\@empty}%
+\newcommand*{\Frefpgshortname}{\@empty}%
+\newcommand*{\Freftabshortname}{\@empty}%
+\newcommand*{\frefchapname}{\@empty}%
+\newcommand*{\frefenumname}{\@empty}%
+\newcommand*{\frefeqname}{\@empty}%
+\newcommand*{\freffigname}{\@empty}%
+\newcommand*{\freffnname}{\@empty}%
+\newcommand*{\frefonname}{\@empty}%
+\newcommand*{\frefpgname}{\@empty}%
+\newcommand*{\frefsecname}{\@empty}%
+\newcommand*{\frefseename}{\@empty}%
+\newcommand*{\freftabname}{\@empty}%
+\newcommand*{\freffigshortname}{\@empty}%
+\newcommand*{\frefpgshortname}{\@empty}%
+\newcommand*{\freftabshortname}{\@empty}%
+% \end{macrocode}
+%
+%
+% \subsubsection{Option Declaration}
+%
+% \DescribeMacro{english}
+% Now the package options are declared. Send me a mail, if you
+% define options for other languages than english or german.
+% \begin{macrocode}
+\DeclareOption{english}{%
+% \end{macrocode}
+% Some strings for cross-referencing in english are added (if the
+% command \cmd{\captionsenglish} is existing) or simply defined.
+% \begin{macrocode}
+ \fancyrefaddcaptions{english}{%
+% \end{macrocode}
+% I better do not touch these strings, because they are used in
+% many document classes and may be already changed by the user.
+% Therefore they will be defined only if they did not exist before
+% \cite{LaTeX:1997}.
+% \begin{macrocode}
+ \providecommand*{\chaptername}{Chapter}%
+ \providecommand*{\figurename}{Figure}%
+ \providecommand*{\pagename}{Page}%
+ \providecommand*{\tablename}{Table}%
+% \end{macrocode}
+% \begin{macro}{\Fref...name}
+% The \package{fancyref} package uses its own strings for
+% cross-referencing purposes. In this way you can use
+% \stringdef{Chapter} for chapter headings but \stringdef{Chap.}
+% for cross-referencing.
+%
+% However, I do not recommend abbreviations for cross-references,
+% because they look ugly at the beginning of a sentence and should
+% be avoided in these places according to most typographers. Also,
+% the scientific publisher Springer does not allow abbreviation of
+% the words \sampleoutput{table} or \sampleoutput{Tabelle} (I
+% suppose because of ambuigity with \sampleoutput{tabbing} or
+% \sampleoutput{Tabulator}).
+%
+% The macros \cmd{\Frefonname} and \cmd{\Frefseename} may be useful
+% in new, user-defined \package{fancyref} formats
+% (\frefseename~\frefpgname~\pageref{sec:fancyrefformats}).
+%
+% All macro names start with a capital \source{S}, because they
+% will be used for cross-references at the beginning of a sentence,
+% where usually capital letters are used.
+% \begin{macrocode}
+ \renewcommand*{\Frefchapname}{\chaptername}%
+ \renewcommand*{\Frefenumname}{Item}%
+ \renewcommand*{\Frefeqname}{Equation}%
+ \renewcommand*{\Freffigname}{\figurename}%
+ \renewcommand*{\Freffnname}{Footnote}%
+ \renewcommand*{\Frefonname}{On}%
+ \renewcommand*{\Frefpgname}{\pagename}%
+ \renewcommand*{\Frefsecname}{Section}%
+ \renewcommand*{\Frefseename}{See}%
+ \renewcommand*{\Freftabname}{\tablename}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\Fref...shortname}
+% These macros are used for cross-references placed in the margin.
+% In marginal notes compact information is crucial due to the
+% limited space, so abbreviated versions of the strings are used.
+% For my general opinion about abbreviations see above.
+% \begin{macrocode}
+ \renewcommand*{\Freffigshortname}{Fig.}%
+ \renewcommand*{\Frefpgshortname}{P.}%
+ \renewcommand*{\Freftabshortname}{Tab.}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\fref...name}
+% Now the lower-case versions of the language dependent strings
+% (starting with a lower-case \source{s}) are declared. As these
+% macros are generated automatically by use of the
+% \cmd{\MakeLowercase} command, there is no need to customize them,
+% except you want to use for example \stringdef{Table} at the start
+% of a sentence and \stringdef{tabular} within a sentence.
+% Inconsistencies like this should of course be avoided.
+% \begin{macrocode}
+ \renewcommand*{\frefchapname}{%
+ \MakeLowercase{\Frefchapname}%
+ }%
+ \renewcommand*{\frefenumname}{%
+ \MakeLowercase{\Frefenumname}%
+ }%
+ \renewcommand*{\frefeqname}{%
+ \MakeLowercase{\Frefeqname}%
+ }%
+ \renewcommand*{\freffigname}{%
+ \MakeLowercase{\Freffigname}%
+ }%
+ \renewcommand*{\freffnname}{%
+ \MakeLowercase{\Freffnname}%
+ }%
+ \renewcommand*{\frefonname}{%
+ \MakeLowercase{\Frefonname}%
+ }%
+ \renewcommand*{\frefpgname}{%
+ \MakeLowercase{\Frefpgname}%
+ }%
+ \renewcommand*{\frefsecname}{%
+ \MakeLowercase{\Frefsecname}%
+ }%
+ \renewcommand*{\frefseename}{%
+ \MakeLowercase{\Frefseename}%
+ }%
+ \renewcommand*{\freftabname}{%
+ \MakeLowercase{\Freftabname}%
+ }%
+ \renewcommand*{\freffigshortname}{%
+ \MakeLowercase{\Freffigshortname}%
+ }%
+ \renewcommand*{\frefpgshortname}{%
+ \MakeLowercase{\Frefpgshortname}%
+ }%
+ \renewcommand*{\freftabshortname}{%
+ \MakeLowercase{\Freftabshortname}%
+ }%
+% \end{macrocode}
+% \end{macro}
+% The closing brace of the second argument of \cmd{\fancyrefaddto}:
+% \begin{macrocode}
+ }%
+% \end{macrocode}
+% If \cmd{\captionsenglish} is defined (\file{babel.sty} or
+% \file{german.sty} are used), the language is switched to
+% \option{english}. In either case the \package{varioref} package
+% will be called with the option \option{english} to provide
+% english strings like \sampleoutput{on the following page}, see
+% \file{varioref.dvi}.
+% \begin{macrocode}
+ \@ifundefined{captionsenglish}{%
+ }{%
+ \selectlanguage{english}%
+ }%
+ \PassOptionsToPackage{\CurrentOption}{varioref}%
+% \end{macrocode}
+% The closing brace of the \option{english} option:
+% \begin{macrocode}
+}%
+% \end{macrocode}
+% \DescribeMacro{german}
+% The definition of the german strings is more simple. Except for
+% \cmd{\Frefonname} and \cmd{\Frefseename} the lower-case versions
+% of the macros are identical with the upper-case version. Damn,
+% my mother tongue seems to be a rather simple language. \winkey
+%
+% A check for the existence of \cmd{\captionsgerman} should not be
+% necessary as in almost all cases german \LaTeX nicians use either
+% \file{babel.sty} or \file{german.sty}, but one never
+% knows~\ldots{} The language is switched and the
+% \package{varioref} package is prepared accordingly.
+% \begin{macrocode}
+\DeclareOption{german}{%
+ \fancyrefaddcaptions{german}{%
+ \providecommand*{\chaptername}{Kapitel}%
+ \providecommand*{\figurename}{Abbildung}%
+ \providecommand*{\pagename}{Seite}%
+ \providecommand*{\tablename}{Tabelle}%
+ \renewcommand*{\Frefchapname}{\chaptername}%
+ \renewcommand*{\Frefenumname}{Punkt}%
+ \renewcommand*{\Frefeqname}{Gleichung}%
+ \renewcommand*{\Freffigname}{\figurename}%
+ \renewcommand*{\Freffigshortname}{Abb.}%
+ \renewcommand*{\Freffnname}{Fu\ss note}%
+ \renewcommand*{\Frefonname}{Auf}%
+ \renewcommand*{\Frefpgname}{\pagename}%
+ \renewcommand*{\Frefpgshortname}{S.}%
+ \renewcommand*{\Frefsecname}{Abschnitt}%
+ \renewcommand*{\Frefseename}{Siehe}%
+ \renewcommand*{\Freftabname}{\tablename}%
+ \renewcommand*{\Freftabshortname}{Tab.}%
+ \renewcommand*{\frefchapname}{\Frefchapname}%
+ \renewcommand*{\frefenumname}{\Frefenumname}%
+ \renewcommand*{\frefeqname}{\Frefeqname}%
+ \renewcommand*{\freffigname}{\Freffigname}%
+ \renewcommand*{\freffigshortname}{\Freffigshortname}%
+ \renewcommand*{\freffnname}{\Freffnname}%
+ \renewcommand*{\frefonname}{%
+ \MakeLowercase{\Frefonname}%
+ }%
+ \renewcommand*{\frefpgname}{\Frefpgname}%
+ \renewcommand*{\frefpgshortname}{\Frefpgshortname}%
+ \renewcommand*{\frefsecname}{\Frefsecname}%
+ \renewcommand*{\frefseename}{%
+ \MakeLowercase{\Frefseename}%
+ }%
+ \renewcommand*{\freftabname}{\Freftabname}%
+ \renewcommand*{\freftabshortname}{\Freftabshortname}%
+ }%
+ \@ifundefined{captionsgerman}{%
+ }{%
+ \selectlanguage{german}%
+ }%
+ \PassOptionsToPackage{\CurrentOption}{varioref}%
+}%
+% \end{macrocode}
+% \DescribeMacro{loose}
+% This option sets up loose spacing between string and counter like
+% \sampleoutput{Figure~1}. This spacing is recommended, because
+% \file{varioref.sty} is using it also (on a hard-coded base), and
+% so inconsistencies can be avoided. Do not take things too
+% seriously, the inter-word spacing varies quite a bit from line to
+% line. Even a trained eye will not always be able to distinguish
+% between \socalled{tight} and \socalled{loose} spacing. Compared
+% with favourite \ac{WYTYSYDG}\footnote{What You Thought You Saw
+% You Didn't Get.} word processors the spacing will be tight in
+% either case. \winkey
+% \begin{macrocode}
+\DeclareOption{loose}{%
+ \newcommand*{\fancyrefdefaultspacing}{%
+ \fancyrefloosespacing
+ }%
+}%
+% \end{macrocode}
+% \DescribeMacro{margin}
+% This option is an example for a application of
+% \cmd{\fancyrefhook}. It places all cross-references into the
+% margin, typesetting them in \cmd{\footnotesize} and
+% \cmd{\raggedright}. For details see the definition of the
+% \format{margin} format \vpageref{sec:margin}.
+%
+% Do \emph{not} use the \option{margin} option in combination with
+% those \format{margin} formats. As this would need nested
+% \cmd{\marginpar} commands, you will get \error{Float(s) lost.}
+% error messages.
+%
+% Also, you should use abbreviated formats in combination with the
+% \option{margin} option, because there is not enough space for a
+% message like \sampleoutput{Figure~1 on the following page} out
+% there.
+%
+% I would recommend the usage of marginal cross-references only for
+% floats. The according formats are already defined, so take this
+% options as an example for what is possible.
+% \begin{macrocode}
+\DeclareOption{margin}{%
+ \renewcommand{\fancyrefhook}[1]{%
+ \mbox{}%
+ \marginpar{%
+ \raggedright\hspace{0pt}\footnotesize
+ \ensuremath{\m@th\rightarrow}~#1%
+ }%
+ }%
+}%
+% \end{macrocode}
+% \DescribeMacro{paren}
+% Another example for an application of \cmd{\fancyrefhook}. It
+% simply puts parentheses around every cross-reference. This does
+% not make much sense, if you intend to use marginal notes for
+% cross-referencing purposes: If you combine this option with the
+% |margin| option, the last specified option \socalled{wins}. If
+% you use the \format{margin} formats defined later, you will get
+% parentheses around marginal notes, which is ugly.
+% \begin{macrocode}
+\DeclareOption{paren}{%
+ \renewcommand*{\fancyrefhook}[1]{(#1)}%
+}%
+% \end{macrocode}
+% \DescribeMacro{plain}
+% If this package option is given, only the plain counter of the
+% referenced object will be used, no page number will be printed at
+% all.
+% \begin{macrocode}
+\DeclareOption{plain}{%
+ \renewcommand*{\fancyrefdefaultformat}{plain}%
+}%
+% \end{macrocode}
+% \DescribeMacro{tight}
+% This option may be useful, if you prefer tight spacing between
+% string and counter. According to most textbooks on typography
+% this is the recommended spacing between parts of abbreviations
+% like \sampleoutput{i.\,e.} or \sampleoutput{Fig.\,1}.
+% \begin{macrocode}
+\DeclareOption{tight}{%
+ \newcommand*{\fancyrefdefaultspacing}{%
+ \fancyreftightspacing
+ }%
+}%
+% \end{macrocode}
+% \DescribeMacro{vario}
+% If this package option is given, all cross-referencing commands
+% will use the \format{vario} format with variable output of the
+% page number, like with \file{varioref.sty}. This is the default.
+% \begin{macrocode}
+\DeclareOption{vario}{%
+ \renewcommand*{\fancyrefdefaultformat}{vario}%
+}%
+% \end{macrocode}
+% Other local options will be passed to the \package{varioref}
+% package after causing an error message. If you use e.\,g.\
+% \option{danish} as a \emph{global} option (see
+% \file{clsguide.dvi}), you will get \emph{english}
+% \package{fancyref} strings without a warning or an error, hence
+% be careful. This is \emph{not} the fault of the
+% \package{fancyref} package, but a feature of the \LaTeXe{} option
+% handler. You \emph{really} should load the package according to
+% \fref{sec:loading}.
+% \begin{macrocode}
+\DeclareOption*{%
+ \PackageError{fancyref}{%
+ Unknown option ``\CurrentOption''%
+ }{%
+ The option ``\CurrentOption'' was not declared in
+ package ``fancyref'',\MessageBreak
+ perhaps you have only misspelled its name.\MessageBreak
+ Currently only the languages ``english'' and
+ ``german'' are defined.\MessageBreak
+ Try typing <return> to proceed. Most likely your
+ output will be wrong,\MessageBreak
+ e. g. ``Figure'' instead of ``Abbildung''.%
+ }%
+ \PassOptionsToPackage{\CurrentOption}{varioref}%
+}%
+% \end{macrocode}
+%
+%
+% \subsubsection{Option Processing}
+%
+% If no options are specified, english strings for
+% cross-referencing, loose spacing between string and counter, and
+% variable output of the page numbers will be used by default.
+% Otherwise the options are processed in the order given by the
+% calling command.
+% \begin{macrocode}
+\ExecuteOptions{english,loose,vario}%
+\ProcessOptions*%
+% \end{macrocode}
+%
+%
+% \subsubsection{Loading Files}
+%
+% This package uses a nice feature of the \package{varioref}
+% package to generate variable output depending on the difference
+% between the page number on which the cross-reference occurs and
+% the page number of the referenced object. \file{varioref.sty} is
+% therefore required.
+% \begin{macrocode}
+\RequirePackage{varioref}%
+% \end{macrocode}
+%
+%
+% \subsubsection{Defining Commands}
+%
+% \begin{macro}{\...labelprefix}
+% Most users distinguish between labels for figures and tables to
+% avoid a mix-up. This is usually done by prefixing the labels
+% with \prefix{fig} or \prefix{tab}. These definitions declare the
+% defaults for this classifying part.
+% \begin{macrocode}
+\newcommand*{\fancyrefchaplabelprefix}{chap}%
+\newcommand*{\fancyrefenumlabelprefix}{enum}%
+\newcommand*{\fancyrefeqlabelprefix}{eq}%
+\newcommand*{\fancyreffiglabelprefix}{fig}%
+\newcommand*{\fancyreffnlabelprefix}{fn}%
+\newcommand*{\fancyrefseclabelprefix}{sec}%
+\newcommand*{\fancyreftablabelprefix}{tab}%
+% \end{macrocode}
+% \end{macro}
+% To enable user changes of these prefixes it is necessary to do
+% some list processing.\footnote{Credits go to \person{Carsten
+% Heinz} and \person{Heiko Oberdiek} for providing and optimizing
+% this code. I did not understand a single token in the beginning.
+% \winkey} There is one command list for each prefix. It contains
+% a number of macros that will rename the formatting commands
+% defined for this prefix. Initially, the package defines the
+% \cmd{\@fancyref@ren} command as empty, by means of
+% \cmd{\newcommand*}. In this way, even with the \cmd{\def} command
+% other macros cannot be overwritten by accident.\footnote{Credits
+% go to \person{Bernd Raichle} for this nice little trick, which is
+% used throughout this package.}
+% \begin{macro}{\@...append@ren}
+% The first argument of the following command is one of those
+% command lists, the second argument is a \package{fancyref}
+% format. A macro renaming the corresponding formatting command
+% will be appended to the command list.
+% \begin{macrocode}
+\newcommand*{\@fancyref@ren}{\@empty}%
+\newcommand*{\@fancyref@append@ren}[2]{%
+ \ifx\relax#1%
+ \def#1{\@fancyref@ren{#2}}%
+ \else
+ \expandafter\def\expandafter#1%
+ \expandafter{#1\@fancyref@ren{#2}}%
+ \fi
+}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@...check@prefix}
+% This command does most of the work, when a prefix is to be
+% renamed. First, the old, saved prefix for the corresponding
+% object type is recalled.
+% \begin{macrocode}
+\newcommand*{\@fancyref@check@prefix}[1]{%
+ \expandafter\let\expandafter\@fancyref@old@prefix
+ \csname @fancyref@saved@prefix\string#1\endcsname
+% \end{macrocode}
+% The old prefix is compared with the prefix given by the
+% argument.
+% \begin{macrocode}
+ \ifx\@fancyref@old@prefix#1%
+% \end{macrocode}
+% If the prefixes are different, the renaming macros are set up.
+% Their only argument will be a \package{fancyref} format.
+% \begin{macrocode}
+ \else
+ \def\@fancyref@ren##1{%
+% \end{macrocode}
+% The prefixing part of the name will be changed, if the renaming
+% macros are called with the corresponding argument.
+%
+% More precisely, the definition of the old formatting command is
+% copied to a new command including the new prefix in its name.
+% \begin{macrocode}
+ \expandafter
+ \let\csname fr@##1@#1\expandafter\endcsname
+ \csname fr@##1@\@fancyref@old@prefix\endcsname
+% \end{macrocode}
+% Then the old command is deleted.
+% \begin{macrocode}
+ \expandafter
+ \let\csname fr@##1@\@fancyref@old@prefix\endcsname
+ \@undefined
+ }%
+% \end{macrocode}
+% Now the command list containing the renaming macros for the given
+% prefix is executed.
+% \begin{macrocode}
+ \csname @fr@ren@list\string#1\endcsname
+% \end{macrocode}
+% The procedure is repeated for the upper-case formatting
+% commands.
+% \begin{macrocode}
+ \def\@fancyref@ren##1{%
+ \expandafter
+ \let\csname Fr@##1@#1\expandafter\endcsname
+ \csname Fr@##1@\@fancyref@old@prefix\endcsname
+ \expandafter
+ \let\csname Fr@##1@\@fancyref@old@prefix\endcsname
+ \@undefined
+ }%
+ \csname @Fr@ren@list\string#1\endcsname
+% \end{macrocode}
+% Finally the new prefix for the corresponding object type is
+% saved.
+% \begin{macrocode}
+ \expandafter\let
+ \csname @fancyref@saved@prefix\string#1\endcsname#1%
+ \fi
+}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\...changeprefix}
+% This user command changes the default prefix for an object type
+% (the first argument) to a new string (the second argument). Then
+% the renaming of the formatting commands is done.
+% \begin{macrocode}
+\newcommand*{\fancyrefchangeprefix}[2]{%
+ \renewcommand*{#1}{#2}%
+ \@fancyref@check@prefix{#1}%
+}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\frefformat}
+% This macro is used to define new formats for the typesetting of
+% cross-references. It takes three arguments, the first is the
+% name of the declared format, the second is the prefix macro used
+% for this format (e.\,g.\ \cmd{\fancyreffiglabelprefix} for
+% cross-references to figures) and the third describes the output
+% generated by the cross-reference.
+%
+% Within the third argument |#1| will be replaced by the counter of
+% the referenced object (i.\,e.\ the output of a \cmd{\ref}
+% command), |#2| will be replaced by the page number (i.\,e.\ the
+% output of a \cmd{\pageref} command) and |#3| will be replaced by
+% the output of a \cmd{\vpageref} command.
+% \begin{macrocode}
+\newcommand{\frefformat}[2]{%
+% \end{macrocode}
+% It is checked if the prefix has changed and the already existing
+% formatting commands are renamed.
+% \begin{macrocode}
+ \@fancyref@check@prefix{#2}%
+% \end{macrocode}
+% Then the \package{fancyref} format given in the first argument is
+% appended to the command list for the prefix given in the second
+% argument.
+% \begin{macrocode}
+ \expandafter\@fancyref@append@ren
+ \csname @fr@ren@list\string#2\endcsname{#1}%
+% \end{macrocode}
+% Finally the formatting command is defined.
+% \begin{macrocode}
+ \@namedef{fr@#1@#2}##1##2##3%
+}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\Frefformat}
+% The definition of the command for declaring \package{fancyref}
+% formats used at the beginning of a sentence is almost the same,
+% the only difference is that upper-case commands like
+% \cmd{\Fr@sample@ex} are used internally. This enables usage of
+% \stringdef{figure} within a sentence and \stringdef{Figure} at
+% the beginning of a sentence.
+% \begin{macrocode}
+\newcommand{\Frefformat}[2]{%
+ \@fancyref@check@prefix{#2}%
+ \expandafter\@fancyref@append@ren
+ \csname @Fr@ren@list\string#2\endcsname{#1}%
+ \@namedef{Fr@#1@#2}##1##2##3%
+}%
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \paragraph{Format Definition.\label{sec:fancyrefformats}}
+%
+% Now it is time for the definition of the \package{fancyref}
+% formats. Generally the \format{vario} formats use the features
+% of the \package{varioref} package, whereas the \format{plain}
+% formats provide the name of the referenced object and its
+% counter, but no page number.
+%
+% Of course the various macros for spacing, classifying prefixes
+% and names of the referenced object are used. This will ensure
+% that the default formats also work after redefining e.\,g.\
+% \cmd{\chaptername} to \stringdef{Fool} and
+% \cmd{\fancyrefchaplabelprefix} to \stringdef{moron}.
+% Cross-references generated by |\fref{moron:bar}| will then come
+% out correctly as \sampleoutput{fool~1}.
+% \begin{macrocode}
+\frefformat{vario}{\fancyrefchaplabelprefix}{%
+ \frefchapname\fancyrefdefaultspacing#1#3%
+}%
+\frefformat{plain}{\fancyrefchaplabelprefix}{%
+ \frefchapname\fancyrefdefaultspacing#1%
+}%
+\frefformat{vario}{\fancyrefenumlabelprefix}{%
+ \frefenumname\fancyrefdefaultspacing#1#3%
+}%
+\frefformat{plain}{\fancyrefenumlabelprefix}{%
+ \frefenumname\fancyrefdefaultspacing#1%
+}%
+% \end{macrocode}
+% The formats for the cross-refernces to equations are more
+% complex, because I wanted to support the \cmd{\tagform@} command
+% of the \package{amsmath} package \cite{AMS:1996}:
+%\begin{verbatim}
+% \makeatletter
+% \renewcommand{\tagform@}[1]{\textup{[#1]}}
+% \makeatother
+%\end{verbatim}
+% will make both the equation numbers and the cross-references
+% generated e.\,g.\ by |\fref{eq:bar}| come out as
+% \sampleoutput{[1]}. Even within a formula a cross-referenced
+% equation number will \emph{not} be typeset in italics.
+% \begin{macrocode}
+\@ifundefined{tagform@}{%
+ \frefformat{vario}{\fancyrefeqlabelprefix}{%
+ \frefeqname\fancyrefdefaultspacing\textup{(#1)}#3%
+ }%
+ \frefformat{plain}{\fancyrefeqlabelprefix}{%
+ \frefeqname\fancyrefdefaultspacing\textup{(#1)}%
+ }%
+}{%
+ \frefformat{vario}{\fancyrefeqlabelprefix}{%
+ \frefeqname\fancyrefdefaultspacing
+ \textup{\tagform@{#1}}#3%
+ }%
+ \frefformat{plain}{\fancyrefeqlabelprefix}{%
+ \frefeqname\fancyrefdefaultspacing
+ \textup{\tagform@{#1}}%
+ }%
+}%
+% \end{macrocode}
+%
+% \label{sec:margin}
+% For figures and tables an additional \package{fancyref} format
+% called \format{margin} is provided to put cross-references into
+% the margin.
+%
+% |\mbox{}| will fix an alignment problem, if the \cmd{\marginpar}
+% command occurs prior to the first word of a paragraph, see
+% \cite[p.~75]{Goossens:1994}. |\hspace{0pt}| enables hyphenation
+% of the very first word of the \cmd{\marginpar} command.
+%
+% Marginal notes are typeset in a smaller font and
+% \cmd{\raggedright}. The \cmd{\rightarrow} is typeset in math
+% mode without the horizontal space usually added by
+% \cmd{\mathsurround}.
+%
+% In marginal notes tight spacing is appropriate, because due to
+% the limited space in the margins abbreviated strings are used.
+% \begin{macrocode}
+\frefformat{margin}{\fancyreffiglabelprefix}{%
+ \mbox{}\marginpar{%
+ \raggedright\hspace{0pt}\footnotesize
+ \ensuremath{\m@th\rightarrow}~%
+ \Freffigshortname\fancyreftightspacing#1,
+ \frefpgshortname\fancyreftightspacing#2%
+ }%
+}%
+% \end{macrocode}
+% The \format{main} format should be used for that cross-reference
+% which explains the referenced object in detail. Scientific
+% papers usually are browsed very quickly, perhaps the reader stops
+% at a figure or a table and begins to search for the explanation
+% of this float. Hence it is very helpful to typeset this main
+% cross-reference in bold face and to provide the full information
+% including the page number (with support of the \package{varioref}
+% package). These \format{main} formats are defined only for
+% floats, i.\,e.\ figures or tables, because for other,
+% non-floating objects the \socalled{main} cross-reference usually
+% can be found very near to the object.
+% \begin{macrocode}
+\frefformat{main}{\fancyreffiglabelprefix}{%
+ \textbf{\freffigname\fancyrefdefaultspacing#1}#3%
+}%
+% \end{macrocode}
+% The rest of the format definitions should now be straight
+% forward.
+% \begin{macrocode}
+\frefformat{vario}{\fancyreffiglabelprefix}{%
+ \freffigname\fancyrefdefaultspacing#1#3%
+}%
+\frefformat{plain}{\fancyreffiglabelprefix}{%
+ \freffigname\fancyrefdefaultspacing#1%
+}%
+\frefformat{vario}{\fancyreffnlabelprefix}{%
+ \freffnname\fancyrefdefaultspacing#1#3%
+}%
+\frefformat{plain}{\fancyreffnlabelprefix}{%
+ \freffnname\fancyrefdefaultspacing#1%
+}%
+\frefformat{vario}{\fancyrefseclabelprefix}{%
+ \frefsecname\fancyrefdefaultspacing#1#3%
+}%
+\frefformat{plain}{\fancyrefseclabelprefix}{%
+ \frefsecname\fancyrefdefaultspacing#1%
+}%
+\frefformat{margin}{\fancyreftablabelprefix}{%
+ \mbox{}\marginpar{%
+ \raggedright\hspace{0pt}\footnotesize
+ \ensuremath{\m@th\rightarrow}~%
+ \Freftabshortname\fancyreftightspacing#1,
+ \frefpgshortname\fancyreftightspacing#2%
+ }%
+}%
+\frefformat{main}{\fancyreftablabelprefix}{%
+ \textbf{\freftabname\fancyrefdefaultspacing#1}#3%
+}%
+\frefformat{vario}{\fancyreftablabelprefix}{%
+ \freftabname\fancyrefdefaultspacing#1#3%
+}%
+\frefformat{plain}{\fancyreftablabelprefix}{%
+ \freftabname\fancyrefdefaultspacing#1%
+}%
+% \end{macrocode}
+% Now it is time for the upper-case versions of the format
+% definitions.
+% \begin{macrocode}
+\Frefformat{vario}{\fancyrefchaplabelprefix}{%
+ \Frefchapname\fancyrefdefaultspacing#1#3%
+}%
+\Frefformat{plain}{\fancyrefchaplabelprefix}{%
+ \Frefchapname\fancyrefdefaultspacing#1%
+}%
+\Frefformat{vario}{\fancyrefenumlabelprefix}{%
+ \Frefenumname\fancyrefdefaultspacing#1#3%
+}%
+\Frefformat{plain}{\fancyrefenumlabelprefix}{%
+ \Frefenumname\fancyrefdefaultspacing#1%
+}%
+\@ifundefined{tagform@}{%
+ \Frefformat{vario}{\fancyrefeqlabelprefix}{%
+ \Frefeqname\fancyrefdefaultspacing\textup{(#1)}#3%
+ }%
+ \Frefformat{plain}{\fancyrefeqlabelprefix}{%
+ \Frefeqname\fancyrefdefaultspacing\textup{(#1)}%
+ }%
+}{%
+ \Frefformat{vario}{\fancyrefeqlabelprefix}{%
+ \Frefeqname\fancyrefdefaultspacing
+ \textup{\tagform@{#1}}#3%
+ }%
+ \Frefformat{plain}{\fancyrefeqlabelprefix}{%
+ \Frefeqname\fancyrefdefaultspacing
+ \textup{\tagform@{#1}}%
+ }%
+}%
+\Frefformat{margin}{\fancyreffiglabelprefix}{%
+ \mbox{}\marginpar{%
+ \raggedright\hspace{0pt}\footnotesize
+ \ensuremath{\m@th\rightarrow}~%
+ \Freffigshortname\fancyreftightspacing#1,
+ \frefpgshortname\fancyreftightspacing#2%
+ }%
+}%
+\Frefformat{main}{\fancyreffiglabelprefix}{%
+ \textbf{\Freffigname\fancyrefdefaultspacing#1}#3%
+}%
+\Frefformat{vario}{\fancyreffiglabelprefix}{%
+ \Freffigname\fancyrefdefaultspacing#1#3%
+}%
+\Frefformat{plain}{\fancyreffiglabelprefix}{%
+ \Freffigname\fancyrefdefaultspacing#1%
+}%
+\Frefformat{vario}{\fancyreffnlabelprefix}{%
+ \Freffnname\fancyrefdefaultspacing#1#3%
+}%
+\Frefformat{plain}{\fancyreffnlabelprefix}{%
+ \Freffnname\fancyrefdefaultspacing#1%
+}%
+\Frefformat{vario}{\fancyrefseclabelprefix}{%
+ \Frefsecname\fancyrefdefaultspacing#1#3%
+}%
+\Frefformat{plain}{\fancyrefseclabelprefix}{%
+ \Frefsecname\fancyrefdefaultspacing#1%
+}%
+\Frefformat{margin}{\fancyreftablabelprefix}{%
+ \mbox{}\marginpar{%
+ \raggedright\hspace{0pt}\footnotesize
+ \ensuremath{\m@th\rightarrow}~%
+ \Freftabshortname\fancyreftightspacing#1,
+ \frefpgshortname\fancyreftightspacing#2%
+ }%
+}%
+\Frefformat{main}{\fancyreftablabelprefix}{%
+ \textbf{\Freftabname\fancyrefdefaultspacing#1}#3%
+}%
+\Frefformat{vario}{\fancyreftablabelprefix}{%
+ \Freftabname\fancyrefdefaultspacing#1#3%
+}%
+\Frefformat{plain}{\fancyreftablabelprefix}{%
+ \Freftabname\fancyrefdefaultspacing#1%
+}%
+% \end{macrocode}
+% \ldots~much tedious work!
+% \begin{macro}{\fancyrefargdelim}
+% \label{sec:delim}
+% The following definition sets up the default for the delimiting
+% character between the \socalled{classifying} part and the
+% \socalled{labeling} part of a label, e.\,g.\ in
+% \labelname{fig:foo} the colon is used as a delimitor. This can
+% be customized, but most users will stick to the conventional
+% \delimitor{:}.
+% \begin{macrocode}
+\newcommand*{\fancyrefargdelim}{:}%
+% \end{macrocode}
+% \end{macro}
+% The following code saves the backslash char in a token register,
+% so it can be used in \cmd{\PackageError}
+% messages.\footnote{Credits go to \person{Bernd Raichle} for this
+% dirty trick.} Sorry, I do not understand the code due to its
+% \cmd{\catcode} and grouping hacking. Still much to learn~\ldots
+% \begin{macrocode}
+\begingroup \catcode`\|=0 |catcode`|\=12
+|toks0={|endgroup
+ |def|backslashchar{\}}
+|the|toks0 \relax
+% \end{macrocode}
+% \begin{macro}{\@...page@ref}
+% This macro is a hacked version of the \cmd{\vpageref} command
+% from the \package{varioref} package, which removes a space that
+% is superfluous for my purpose.
+% \begin{macrocode}
+\newcommand*{\@fancyref@page@ref}{\@ifnextchar[%]
+ \@vpageref{\@vpageref[\unskip]}%
+}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@f@ref}
+% This macro now does the real work. It tests if the specified
+% format for the given classifying prefix exists. If it does, the
+% formatting command is called with three arguments: The counter of
+% the referenced object (\cmd{\ref}), the page number of the
+% referenced object (\cmd{\pageref}) and the page number resulting
+% from a \cmd{\vpageref}. The output of the formatting command
+% will be passed as an argument to the \cmd{\fancyrefhook} command
+% (\frefseename~\frefpgname~\pageref{sec:fancyrefhook}). If the
+% formatting command does not exist, a package error occurs.
+% \begin{macrocode}
+\newcommand*{\@f@ref}[4]{%
+ \@ifundefined{#1r@#2@#3}{%
+ \PackageError{fancyref}{%
+ \backslashchar#1ref\space format ``#2''
+ undefined\MessageBreak
+ for label type ``#3''%
+ }{%
+ The format ``#2'' was not defined for the label type
+ ``#3''\MessageBreak
+ and the \backslashchar#1ref\space command. Perhaps
+ you have only misspelled its name.\MessageBreak
+ Otherwise you will have to define it with
+ \protect\new#1refformat\MessageBreak
+ prior to using it.%
+ }%
+ }{%
+ \fancyrefhook{%
+ \@nameuse{#1r@#2@#3}%
+ {\ref{#3\fancyrefargdelim#4}}%
+ {\pageref{#3\fancyrefargdelim#4}}%
+ {\@fancyref@page@ref{#3\fancyrefargdelim#4}}%
+ }%
+ }%
+}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\fref}
+% This macro is the front-end for the user. Its first, optional
+% argument is the format of the cross-reference, the second,
+% mandatory argument is the label of the cross-referenced object.
+% If no optional argument is provided, \cmd{\fancyrefdefaultformat}
+% will be used as a format.
+%
+% The second argument is then split at the delimiting character
+% (\cmd{\fancyrefargdelim},
+% \frefseename~\frefpgname~\pageref{sec:delim}) into a classifying
+% prefix and the labeling part. I am sorry that I do not
+% understand the \cmd{\@fref} command completely. But it works
+% really well,\footnote{Credits go to \person{David Carlisle} who
+% once again send me the cut-and-paste solution for my problems.}
+% and passes four arguments to the \cmd{\@f@ref} command:
+% Lower-case flag, format, classifying prefix and labeling part.
+% \begin{macrocode}
+\newcommand*{\@fref}{\@empty}%
+\newcommand*{\fref}[2][\fancyrefdefaultformat]{%
+ \edef\@fref{%
+ \def\noexpand\@fref
+ ####1\fancyrefargdelim####2\noexpand\@fref{%
+ \noexpand\@f@ref{f}{#1}{####1}{####2}%
+ }%
+ }%
+ \@fref
+ \@fref#2\@fref
+}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\Fref}
+% This macro works exactly the same way as \cmd{\Fref}. It should
+% be used at the beginning of a sentence and hence passes an
+% upper-case \source{S} to the \cmd{\@f@ref} command.
+% \person{Stefan Ulrich}\footnote{He will easily notice that his
+% name was typeset without his additions to the \package{soul}
+% package \cite{Franz:1998}. \winkey} told me kindly that it is
+% very difficult to implement a reliable heuristic to check for the
+% start of a sentence. So I decided to leave this as an exercise
+% for the reader. \winkey
+% \begin{macrocode}
+\newcommand*{\@Fref}{\@empty}%
+\newcommand*{\Fref}[2][\fancyrefdefaultformat]{%
+ \edef\@Fref{%
+ \def\noexpand\@Fref
+ ####1\fancyrefargdelim####2\noexpand\@Fref{%
+ \noexpand\@f@ref{F}{#1}{####1}{####2}%
+ }%
+ }%
+ \@Fref
+ \@Fref#2\@Fref
+}%
+%</package>
+% \end{macrocode}
+% \end{macro}
+% \Finale
+% \iffalse
+%<*testfile>
+\documentclass[12pt,a4paper]{ltxdoc}
+%
+\usepackage{fancyref}
+\fancyrefaddcaptions{english}{%
+ \newcommand*{\Frefthmname}{Theorem}%
+ \newcommand*{\frefthmname}{\MakeLowercase{\Frefthmname}}%
+}%
+%
+\newcommand*{\booktitle}[1]{``#1''}
+\newcommand*{\format}[1]{\texttt{#1}}
+\newcommand*{\labelname}[1]{\texttt{#1}}
+\newcommand*{\option}[1]{\texttt{#1}}
+\newcommand*{\package}[1]{\texttt{#1}}
+\newcommand*{\person}[1]{\textsc{#1}}
+\newcommand*{\prefix}[1]{\texttt{#1}}
+\newcommand*{\stringdef}[1]{``#1''}
+%
+\newtheorem{theorem}{Theorem}
+%
+\begin{document}
+%
+Let us start with a famous equation:
+\begin{equation}
+ \label{eq:pythagoras}
+ a^2 + b^2 = c^2
+\end{equation}
+\Fref{eq:pythagoras} has been proven by \person{Pythagoras}. And this
+cross-reference was made with |\Fref{eq:pythagoras}|. Note that I
+really wrote:
+\begin{verbatim}
+ \Fref{eq:pythagoras} has ...
+\end{verbatim}
+I did not use:
+\begin{verbatim}
+ Equation~(\Fref{eq:pythagoras}) has ...
+\end{verbatim}
+
+See the next page for further features of the \package{fancyref}
+package, I need this page break for demonstration purposes.
+
+\clearpage
+The cross-reference works also in the middle of a sentence:
+\person{Pythagoras} has proven \fref{eq:pythagoras}. And this
+cross-reference was made with |\fref{eq:pythagoras}|. You can see the
+fancy output from the \package{varioref} package.
+
+Oh, you do not like this package and want normal \cmd{\ref} output
+instead? No problem, just redefine the default format:
+\renewcommand*{\fancyrefdefaultformat}{plain}
+\begin{verbatim}
+ \renewcommand*{\fancyrefdefaultformat}{plain}
+\end{verbatim}
+Now the cross-reference looks like this: \Fref{eq:pythagoras}. There
+is also a package option called \option{plain} for this purpose.
+
+Oh, you do not like \stringdef{Equation} and want \stringdef{Eq.}
+instead? No problem, just redefine the string:
+\renewcommand*{\Frefeqname}{Eq.}
+\begin{verbatim}
+ \renewcommand*{\Frefeqname}{Eq.}
+\end{verbatim}
+\Fref{eq:pythagoras} and \fref{eq:pythagoras} will be the result,
+respectively. Note that there is no need to redefine
+\cmd{\frefeqname} to \stringdef{eq.}. The \package{fancyref} package
+will do this automatically for you. But of course you can use
+\stringdef{eqn.} instead, if you really want to.
+
+Oh, you are not using the colon as a delimitor but rather the dash? No
+problem, just redefine the character:
+\renewcommand*{\fancyrefargdelim}{-}
+\begin{verbatim}
+ \renewcommand*{\fancyrefargdelim}{-}
+\end{verbatim}
+The new test equation with label \labelname{eq-trivial} will be:
+\begin{equation}
+ \label{eq-trivial}
+ a = a
+\end{equation}
+The cross-reference |\fref{eq-trivial}| will give \fref{eq-trivial} as
+output, as expected.
+
+All that stuff may be nice, but you are using \prefix{eqn} instead of
+\prefix{eq}? No problem, just redefine the prefix:
+\fancyrefchangeprefix{\fancyrefeqlabelprefix}{eqn}
+\begin{verbatim}
+ \fancyrefchangeprefix{\fancyrefeqlabelprefix}{eqn}
+\end{verbatim}
+We need a new, fantastic test equation with label
+\labelname{eqn-fantastic}:
+\begin{equation}
+ \label{eqn-fantastic}
+ b = b
+\end{equation}
+The cross-reference |\fref{eqn-fantastic}| will give
+\fref{eqn-fantastic} as output, as expected.
+
+Maybe the spacing between \stringdef{eq.} and ``3'' is too generous,
+let us tighten things a bit, with
+\renewcommand*{\fancyrefdefaultspacing}{\fancyreftightspacing}
+\begin{verbatim}
+ \renewcommand*{\fancyrefdefaultspacing}{%
+ \fancyreftightspacing
+ }
+\end{verbatim}
+the spacing looks like \fref{eqn-fantastic}. If you think this is
+better, just use the \option{tight} option of this package.
+\fancyrefchangeprefix{\fancyrefeqlabelprefix}{eq}
+
+Perhaps you want parentheses around the cross-reference? No problem,
+just redefine the appropriate hook:
+\renewcommand*{\fancyrefhook}[1]{(#1)}
+\begin{verbatim}
+ \renewcommand*{\fancyrefhook}[1]{(#1)}
+\end{verbatim}
+The result from |\fref{eq-trivial}| is \fref{eq-trivial}. In fact
+this could have been obtained easier, as I provided an package option
+just for this purpose:
+\begin{verbatim}
+ \usepackage[paren]{fancyref}
+\end{verbatim}
+
+Now let us try something really cool. What about introducing a new
+type of objects, e.\,g.\ theorems, with \prefix{thm} prefixed, new
+strings like \stringdef{Theorem} added and the cross-reference in huge
+italics? Also, as you have read in that bargain textbook on
+typography (\booktitle{cAN U rEaD It} by \person{John Badmountain}),
+cross-references to theorems should be typeset as footnotes. No
+problem: First, we need a new prefix:
+\newcommand*{\fancyrefthmlabelprefix}{thm}
+\begin{verbatim}
+ \newcommand*{\fancyrefthmlabelprefix}{thm}
+\end{verbatim}
+Then we declare a new \package{fancyref} format called \format{foot}:
+\frefformat{foot}{\fancyrefthmlabelprefix}{%
+ \unskip\footnote{%
+ \huge\itshape\Frefthmname\fancyrefdefaultspacing#1#3%
+ }%
+}
+\Frefformat{foot}{\fancyrefthmlabelprefix}{%
+ \unskip\footnote{%
+ \huge\itshape\Frefthmname\fancyrefdefaultspacing#1#3%
+ }%
+}
+\begin{verbatim}
+ \frefformat{foot}{\fancyrefthmlabelprefix}{%
+ \unskip\footnote{%
+ \huge\itshape\Frefthmname\fancyrefdefaultspacing#1#3%
+ }%
+ }
+ \Frefformat{foot}{\fancyrefthmlabelprefix}{%
+ \unskip\footnote{%
+ \huge\itshape\Frefthmname\fancyrefdefaultspacing#1#3%
+ }%
+ }
+\end{verbatim}
+The strings have to be setup in the preamble of the document, I did
+this already, because I knew it would be necessary. The code I used
+was:
+\begin{verbatim}
+ \fancyrefaddcaptions{english}{%
+ \newcommand*{\Frefthmname}{Theorem}%
+ \newcommand*{\frefthmname}{%
+ \MakeLowercase{\Frefthmname}%
+ }%
+ }%
+\end{verbatim}
+And finally this is the test theorem:
+\begin{theorem}[Murphy]
+ \label{thm-murphy}
+ If something \emph{can} go wrong, it \emph{will} go wrong.
+\end{theorem}
+Now let us try it. |\Fref[foot]{thm-murphy}| comes out
+as \Fref[foot]{thm-murphy}. Oops, the hook is still at work, I will
+just reset it to its default value:
+\renewcommand*{\fancyrefhook}[1]{#1}%
+\begin{verbatim}
+ \renewcommand*{\fancyrefhook}[1]{#1}
+\end{verbatim}
+And now? \Fref[foot]{thm-murphy} Gotcha!
+%
+\end{document}
+%</testfile>
+% \fi
+\endinput
diff --git a/macros/latex/contrib/fancyref/fancyref.ins b/macros/latex/contrib/fancyref/fancyref.ins
new file mode 100644
index 0000000000..70a9ccbeec
--- /dev/null
+++ b/macros/latex/contrib/fancyref/fancyref.ins
@@ -0,0 +1,40 @@
+%%
+%% fancyref.ins
+%% Batch file, run through LaTeX.
+%%
+%% Copyright (C) 1999 Axel Reichert
+%% See the files README and COPYING.
+%%
+\def\batchfile{fancyref.ins}
+\input docstrip.tex
+\preamble
+
+LaTeX package for fancy cross-referencing.
+
+Copyright (C) 1999 Axel Reichert
+See the files README and COPYING.
+
+\endpreamble
+\keepsilent
+\generateFile{fancyref.sty}{t}{\from{fancyref.dtx}{package}}
+\generateFile{freftest.tex}{t}{\from{fancyref.dtx}{testfile}}
+\Msg{**************************************************************}
+\Msg{*}
+\Msg{* To finish the installation you have to move the following}
+\Msg{* files into a directory searched by LaTeX:}
+\Msg{*}
+\Msg{* \space\space fancyref.sty}
+\Msg{*}
+\Msg{* To produce the documentation run the following files}
+\Msg{* through LaTeX:}
+\Msg{*}
+\Msg{* \space\space fancyref.dtx}
+\Msg{*}
+\Msg{* To produce a test file run the following files}
+\Msg{* through LaTeX:}
+\Msg{*}
+\Msg{* \space\space freftest.tex}
+\Msg{*}
+\Msg{* Happy TeXing!}
+\Msg{*}
+\Msg{**************************************************************}
diff --git a/macros/latex/contrib/fancyref/fancyref.pdf b/macros/latex/contrib/fancyref/fancyref.pdf
new file mode 100644
index 0000000000..b04c2a7352
--- /dev/null
+++ b/macros/latex/contrib/fancyref/fancyref.pdf
Binary files differ