On 07/09/2011 10:08 AM, Sebastian Rockel wrote:
> Hi,
>
> I am using Lyx-2.0 with KOMA-book class (pdflatex) on Mac OSX 10.6.8.
>
> I am often using the cross-reference option 'Formatted reference' as it is 
> quite convenient to have automatic addition of 'figure', 'section' etc.
>
> Nevertheless I noticed (by accident) that in the Lyx window references appear 
> to be fine but show up in the final pdf as '??'. This is the case for 
> references within a 'subsection'.
>
> This is a little bit annoying as it can be overseen in a larger document 
> easily.
>
> Is this a bug? Has anyone else this problem?
> Any comments?
>
The reason for this is that LyX by default uses the prefix "sub" for
such references, as you create them, but neither prettyref nor refstyle
defines a format for this. I'm not sure if that counts as a bug or not.
Anyway, you can deal with it two ways.

(i) Put a format declaration for "sub" references into your preamble.
How you do this depends upon whether you are using refstyle or
prettyref. (This is set under Document>Settings.) For prettyref, you can
do something like:
    \newrefformat{sub}{Subsection \ref{#1}}
For refstyle:
    \newref{sub}{refcmd={Subsection \ref{#1}}}
Of course, you can adapt these as you wish.

(ii) Modify what LyX uses for subsections. This is a matter of layout,
and can be done in a module, in local layout (under Document>Settings),
or wherever you wish:
    Style Subsection
        RefPrefix sec
    End
The defaults are in the file stdrefprefix.inc. If you like, you can copy
the system file to your local layout directory (by default, on Linux,
~/.lyx/layouts/), modify it, and then LyX will use it instead of the
system one.

Richard

Reply via email to