# Re: formatting cross references — \ref, \prettyref , etc

On 16 September 2010 19:35, Richard Heck <rgh...@comcast.net> wrote:

>  On 09/16/2010 04:26 AM, Justin Wood wrote:
>
> Is it possible to control the format of cross references to labels so that
> I can specify the text prepended to the label number? I realise LyX
> automagically adds 'chapter', 'section', 'subsection', and 'Figure', most of
> which are fine. But normally I would prefer to simply use 'section' for
> actual subsections too.
>
> *Formatted reference* looks to be the place to do this, but I've not been
> able to find \prettyref's implementation sufficiently documented for LyX,
>
>  There's no special LyX documentation. We just use prettyref as LaTeX
> would.
>

Yes I appreciate that. (And I've since realised the problem is some sort of
conflict with the document class.)

>
> and what I have found seems to strongly imply it's use should be avoided.
>
>  Where's that? There are some issues with prettyref, mostly to do with
> internationalization and babel support. That's why 2.0 will by default use
>
>
Other than the passing mention in the User Guide and Customization help
files, mostly some 'robust' discussion on this group from a couple of years
ago which referred to prettyref being effectively unsupported. I might start
working with LyX 2.0 alpha now then actually (suitably forewarned and files
backed up of course).

>
> Nonetheless I tried inserting the \prettyref name definition to my LaTeX
> preamble and it did work, but... the text is being prepended to the LyX
> 'section 1.1', 'subsection 1.1.1', etc, rather than *replacing* it.
>
>  What prettyref command did you use? Prettyref itself predefines several of
> these things, but you should be able to redefine them yourself.
>

Just this in the preamble, as an example: \newrefformat{sub}{TEST \ref{#1}}

It outputs as 'TEST subsection x.y.z' — the original subsection remains in
place. But that was with a document class of *book (KOMA-script)*, the
thesis template[1].

I just tried it with a new file, all LyX defaults (article class), and the
override works as you'd expect, replacing 'subsection' with 'TEST'. And in
fact it works fine for the box float customisation has Jürgen helped me
with. So obviously the problem is within the *scrbook *document class? I
don't really know how to solve that at this point but at least I know where
to look...

Thanks Richard.

[1]
\documentclass[12pt,a4paper,english,british,intoc,bibtotoc,idxtotoc,BCOR10mm,titlepage,tablecaptionabove,
fleqn]{scrbook}

>
> Richard
>
>