Am 14.07.2011 um 19:47 schrieb Julien Rioux:
> On 14/07/2011 7:08 AM, Sebastian Rockel wrote:
>>
>> Am 09.07.2011 um 16:49 schrieb Richard Heck:
>>
>>> 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.
>>
>> Thanks for the explanation.
>> IMO another solution would be that LyX by default uses 'sec' instead of
>> 'sub'.
>>
>>> (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.
>>
>> I tried local layout and stdrefprefix.inc (under Mac OS) but it didn't work
>> (still '??').
>> For the time being I don't use LyX 'formatted reference' and keep manually
>> writing 'section'.
>>
>> Sebastian
>
> Are you by any chance also using subfloats? i.e. floats within floats?
> There is a incompatibility between the package used by LyX to do this, and
> the refstyle package used for formatted references.
Indeed I am using subfloats.
Thanks for pointing that out.
Sebastian