On 03/12/2011 04:34 PM, Tommaso Cucinotta wrote:
This is bring things closer to Tommaso's desire for all references to be
automatically formatted properly.

From your description, it seems exactly what I was needing.

I just tried it on my little stress test (attached).

I have to say that, AFAICS, the refstyle references seem kind of broken,
as compared to the prettyref ones:
-) the "()" style doesn't work and produces "(??)", also for equations, I have to say (why ?)

This is because refstyle itself redefines \eqref, and it is expecting NOT to get the prefix within the reference. I've fixed this, but not in the obvious way. The default refstyle.cfg outputs:
    equation (\ref{label})
rather than just:
    (\ref{label})
as the AMS classes do. So, since we say in the UI that the latter is what you will get, we ought simply output "(\ref{label})" in this case. If one wants \eqref, then that is just a formatted reference, under refstyle.

I did not change how this works under prettyref, but I wonder if we should.

-) the apparent intent of "formatted ref" for refstyle is to include both text and reference number, as in "section x.y" or "equation (1.1)", but of course it fails without the proper prefixes. Also, for numbered items shouldn't it expand to smth.
    like "item 1." or similar ?

How it expands depends upon how the relevant macros have been defined. You can of course redefine them yourself, if you wish. There actually isn't any default for enumerations defined in refstyle.cfg, so it just gets the fallback that we define:
    \AtBeginDocument{\providecommand\enuref[1]{\ref{enu:#1}}}
We do this for all such commands under refstyle, to make sure that we can compile.

For enumerations, you could do:
    \newref{enu}{refcmd={item \ref{#1}}}
to get what you want. I tend to do:
    \newref{enu}{refcmd={(\ref{#1})}}
myself.

Furthermore, the intent of "Formatted Ref" for prettyref seems now somewhat unclear to me (even though when enabling the new module it produces exactly what I'd need
most of the times), and anycase it mismatches with the refstyle output.

The intent is the same, but refstyle and prettyref define different formats for references.

On a related note, the user cannot yet see straight on the screen the output of the
various macros expansion, or at least a template of it.
I mean, while writing, it would be useful to see smth. like ("[]" is the inset on screen):

  As highlighted in [Equation (eq:foo)]

or

  As highlighted in [(eq:foo)]

or

  In [Section sec:intro], ...

Now, I can't probably desire an instant preview of these, however
my question is: can we make all of these variations available to users in a friendly fashion ? As mentioned in a previous post, it still seems to me that the user needs a trial phase to find out how each type expands in the PDF, with what options, before actually managing to master
xrefs in LyX!

I think it would be possible to do something like this, but it's definitely too late for 2.0. The right way to do it would be via layout, so that someone could add, say, a prop:xxx prefix and have it display right.

If you add this to trac, I'll try to do it early in the 2.1 cycle.

Richard

Reply via email to