On 05/23/2011 09:13 PM, Julien Rioux wrote:
On 23/05/2011 5:22 PM, Ruida Yun wrote:
Hi all,

I'm writing my dissertation using Lyx2.0 with the built-in thesis template.

The preamble in thesis template define
\renewcommand{\figureautorefname}{Fig.\negthinspace} to change the
default Figure to Fig. while referencing the figure.  However, I found
out the it doesn't work for my me.  Please find the attached file to
see the problem.

  I've googled this problem for a while but couldn't find a solution.
Any suggestion would be more than welcome.

Thanks a lot!

Ruida

This extract:
% increase link area for cross-references and autoname them
\AtBeginDocument{\renewcommand{\ref}[1]{\mbox{\autoref{#1}}}}

from your preamble is an old trick to change the normal reference format, which appear as "<reference>" in the cross-ref dialog of LyX, into named references. Named references are now supported by LyX so it is no longer necessary to use this trick. Simply use the "Formatted reference" format in the cross-ref dialog. We should probably remove this trick from places where it is used in LyX's docs and templates.

Named references are provided by one of these latex packages: either prettyref or refstyle. This is configurable in the "Doucment class" options.

Using prettyref you can write in your preamble:
\newrefformat{fig}{Fig.~\ref{#1}}

If you are using hyperref and you want the "Fig." part to be clickable also, instead use this:
\newrefformat{fig}{\hyperref[#1]{Fig.~\ref*{#1}}}

I do not know at the moment how to customize refstyle, but it should be possible to do so in a similar way.

Refstyle supports figure-naming natively, so no new refformat needs to be declared. By default, it gives "figure~\ref{#1}" (or whatever is appropriate to the language). If you want to change this, then the easy way is just to change the definition of \RSfigtxt, e.g.:
    \def\RSfigtex{fig.~}
New reference formats can be defined as follows:
    \newref{prop}{refcmd = {proposition \ref{#1}}
So prettyref's
    \newrefformat{pfx}{...}
becomes:
    \newref{pfx}{refcmd={...}}
This won't get you the range support, plurals and so forth, but LyX doesn't yet support those anyway.

Note that you can also use \newref to redefine things refstyle defines by default.

Richard

Reply via email to