On 03/06/2011 10:52 AM, Tommaso Cucinotta wrote:
Hello,
the attached patch provides an additional entry for the GuiRef reference
insertion dialog which is supposed to automatically provide the correct
"format" for the reference, specifically:
1. if the label is inside a footnote, then the reference has a
footnote ref format,
i.e., it resembles $^(<number>)$.
2. if the label is inside an equation, then the ref is formatted with
\eqref{}, i.e.,
"(<number>)".
3. otherwise, it is a normal \ref{}
This might be worth having, but it looks late to me for 2.0. I'd want to
have some discussion about how it should be implemented, etc, before
committing to it, and we're not in discussion mode. The problems you
mention below would also need addressing, and touching anything to do
with threaded export at this late stage looks dangerous.
Also, note that how it works is only visible in the "View Source"
panel (you can check
View Entire Source, then copy the whole thing and paste into an
external .tex file
and compile it), but not yet if you type "Ctrl+t" or "Export->LaTeX
(normal)" 'cause
in such cases the TOC is not found (why ?!?).
Because the Buffer gets cloned and we do not regenerate it. I had to
deal with this same issue in XHTML output.
I'll take the chance for notifying a few inconsistencies of the GUI
for the "xref subsystem":
-) The second entry in the typeCO combo of the dialog says
"(<reference>)", so the
non-latex-expert user may be tempted to think that it's only a
matter of taste and
appearance, and select this for a normal label, but in such a case
the generated
\eqref{} command doesn't work and a "(??)" is generated in the
output.
I would suggest to rework that label as "Equation Reference"
instead (but it should
actually be forbidden for non-equation refs). This should be
reported in the Trac,
if not already there.
I agree about this. It's an easy change. Note that this should also be
disabled, really, if it's not an equation we're referencing.
-) There are some inconsistencies among the text shown to the user in
that dialog
as "reference format" (i.e., the entries in the RefUi.ui), and the
short text that is
shown as prefix in the on-screen inset (i.e., the text coming from
InsetRef.cpp).
This is the whole list:
"<reference>" => "Ref: label"
"(<reference>)" => "EqRef: label"
"Page" => "Page: label"
"On page" => "TextPage: label"
"<reference> on page <page>" => "Ref+Text:label"
"Formatted reference" => "Format: label"
"Textual reference" => "NameRef:label" [ this is missing the
extra-space w.r.t. others]
Also, the shown colon ":" is somewhat ugly, due to the usual
convention in using
normally colons within label texts themselves, i.e.:
"EqRef:eq:foo". I would call
for nicer ideas on what to show on the screen inside this inset,
i.e., something
more consistent with what is shown on the selection dialog.
What about "Ref to LABEL", etc?
-) Finally, some missing options might be the ones that one finds
normally in OpenOffice,
i.e., how to reference:
-) the section or chapter within which the label is contained
I don't think LaTeX can do this. We could do it, but it would mean
having auto-generated section labels, etc, which starts to touch on a
different issue.
-) the label number, with or without "full context" (including
chapters/sections).
If this isn't just \ref{}, what do you mean?
Richard