On 03/22/2010 09:08 AM, Jürgen Spitzmüller wrote:

Hm. I have in one of my class files this:

% Prettyref:
\RequirePackage{prettyref}
\newrefformat{cha}{Kapitel~\ref{#1}}
\newrefformat{sec}{Abschnitt~\ref{#1}}
\newrefformat{sub}{Abschnitt~\ref{#1}}
\newrefformat{anm}{Anm.~\ref{#1}}
\newrefformat{fn}{Anm.~\ref{#1}}
\newrefformat{app}{Anhang~\ref{#1}}
\newrefformat{tab}{Tabelle~\vref{#1}}
\newrefformat{fig}{Abbildung~\vref{#1}}
\newrefformat{exp}{Argumentation~\vref{#1}}

Note that some of these definitions include varioref (the \vref macro), so
\prettyref{fig:foo} actually yields "see figure X on the following page" (or
whatever the context requires). I am aware that I will be forced to change
that class file if we completely ditch prettyref (which is bad enough), but is
refstyle at least able to allow similar inclusion of varioref functionality?

Ultimately, refstyle has much better and more flexible support for this sort of thing. Thus, one can write in LaTeX:
    \Tabref[vref]{tab:foo}
and then you get:
    table 3 on the previous page
or whatever. So we could support that sort of thing directly in LyX. And refstyle will do other things, too, like plurals and ranges, e.g., "sections 3 to 5".

But you can also do the sort of thing you do there. E.g., we can redefine figure refs as follows:

  \newref{fig}{%
      name    = \RSfigtxt,
      names   = \RSfigstxt,
      Name    = \RSFigtxt,
      Names   = \RSFigstxt,
      rngtxt  = \RSrngtxt,
      lsttxt  = \RSlsttxt,
      refcmd = \ref{#1} \vpageref{#1}}

Other than refcmd, this is all just from refstyle.cfg. There isn't any straightforward way just to redefine refcmd for figs.

rh

Reply via email to