Nameref support.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34884 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-07-13 03:23:29 +00:00
parent e2e63b4b1b
commit 47db764ccc
5 changed files with 167 additions and 141 deletions

View File

@ -7,6 +7,11 @@ The good example would be 2010-01-10 entry.
-----------------------
2010-07-13 Richard Heck <rgheck@comcast.net>
* Format incremented to 396 (r34884)
nameref support
new commands nameref and Nameref for InsetRef
2010-07-13 Uwe Stöhr <uwestoehr@web.de>
* Format incremented to 395: support for ISO C-series paper format;
new parameter \papersize cxpaper with (x = 0 - 6)

View File

@ -91,6 +91,8 @@ Menuset
Item "On Page <Page>|O" "inset-modify changetype vpageref"
Item "<Reference> on Page <Page>|f" "inset-modify changetype vref"
Item "Formatted Reference|t" "inset-modify changetype prettyref"
Item "Textual Reference|x" "inset-modify changetype nameref"
Item "Textual Reference plus <page>|l" "inset-modify changetype Nameref"
Separator
Item "Settings...|S" "inset-settings"
End

View File

@ -1775,7 +1775,9 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
texrow.newlines(lines);
// set back for the rest
lyxpreamble.clear();
}
} else if (features.isRequired("nameref"))
// hyperref loads this automatically
lyxpreamble += "\\usepackage{nameref}\n";
// Will be surrounded by \makeatletter and \makeatother when not empty
docstring atlyxpreamble;

View File

@ -5,7 +5,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>386</width>
<width>435</width>
<height>443</height>
</rect>
</property>
@ -24,12 +24,12 @@
</property>
<item row="2" column="0" colspan="3">
<layout class="QHBoxLayout">
<property name="margin" >
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="findKeysLA">
<property name="text">
@ -67,18 +67,16 @@
</item>
<item row="7" column="0" colspan="3">
<layout class="QHBoxLayout">
<property name="margin" >
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="updatePB">
<property name="sizePolicy">
<sizepolicy>
<hsizetype>3</hsizetype>
<vsizetype>0</vsizetype>
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -99,7 +97,7 @@
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>31</width>
<height>30</height>
@ -147,20 +145,20 @@
</item>
<item row="3" column="0" colspan="3">
<layout class="QHBoxLayout">
<property name="margin" >
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout">
<property name="margin" >
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="sortCB">
<property name="toolTip">
@ -187,7 +185,7 @@
<item>
<widget class="QCheckBox" name="groupCB">
<property name="toolTip">
<string>Group labels by prefix (e.g. "sec:")</string>
<string>Group labels by prefix (e.g. &quot;sec:&quot;)</string>
</property>
<property name="text">
<string>Grou&amp;p</string>
@ -201,7 +199,7 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
@ -212,9 +210,7 @@
<item>
<widget class="QPushButton" name="gotoPB">
<property name="sizePolicy">
<sizepolicy>
<hsizetype>3</hsizetype>
<vsizetype>0</vsizetype>
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -239,9 +235,7 @@
<item row="0" column="2">
<widget class="QComboBox" name="bufferCO">
<property name="sizePolicy">
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -287,9 +281,7 @@
<item row="5" column="1" colspan="2">
<widget class="QComboBox" name="typeCO">
<property name="sizePolicy">
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -299,27 +291,27 @@
</property>
<item>
<property name="text">
<string>&lt;reference></string>
<string>&lt;reference&gt;</string>
</property>
</item>
<item>
<property name="text">
<string>(&lt;reference>)</string>
<string>(&lt;reference&gt;)</string>
</property>
</item>
<item>
<property name="text">
<string>&lt;page></string>
<string>&lt;page&gt;</string>
</property>
</item>
<item>
<property name="text">
<string>on page &lt;page></string>
<string>on page &lt;page&gt;</string>
</property>
</item>
<item>
<property name="text">
<string>&lt;reference> on page &lt;page></string>
<string>&lt;reference&gt; on page &lt;page&gt;</string>
</property>
</item>
<item>
@ -327,6 +319,16 @@
<string>Formatted reference</string>
</property>
</item>
<item>
<property name="text">
<string>Textual reference</string>
</property>
</item>
<item>
<property name="text">
<string>Textual reference plus &lt;page&gt;</string>
</property>
</item>
</widget>
</item>
<item row="4" column="0">
@ -346,7 +348,13 @@
<widget class="QLineEdit" name="referenceED"/>
</item>
<item row="1" column="0" colspan="3">
<widget class="QTreeWidget" name="refsTW" />
<widget class="QTreeWidget" name="refsTW">
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>

View File

@ -52,7 +52,9 @@ bool InsetRef::isCompatibleCommand(string const & s) {
|| s == "vref"
|| s == "vpageref"
|| s == "prettyref"
|| s == "eqref";
|| s == "eqref"
|| s == "nameref"
|| s == "Nameref";
}
@ -132,9 +134,11 @@ docstring InsetRef::xhtml(XHTMLStream & xs, OutputParams const &) const
display_string = _("elsewhere");
else if (cmd == "eqref")
display_string = bformat(from_ascii("equation (%1$s)"), value);
else { // "prettyref"
else if (cmd == "prettyref"
// we don't really have the ability to handle these
// properly in XHTML output
|| cmd == "nameref" || cmd == "Nameref")
display_string = il->prettyCounter();
}
} else
display_string = ref;
@ -206,12 +210,15 @@ void InsetRef::addToToc(DocIterator const & cpit)
void InsetRef::validate(LaTeXFeatures & features) const
{
if (getCmdName() == "vref" || getCmdName() == "vpageref")
string const cmd = getCmdName();
if (cmd == "vref" || cmd == "vpageref")
features.require("varioref");
else if (getCmdName() == "prettyref")
else if (cmd == "prettyref")
features.require("prettyref");
else if (getCmdName() == "eqref")
else if (cmd == "eqref")
features.require("amsmath");
else if (cmd == "nameref" || cmd == "Nameref")
features.require("nameref");
}
@ -222,6 +229,8 @@ InsetRef::type_info InsetRef::types[] = {
{ "vpageref", N_("Textual Page Number"), N_("TextPage: ")},
{ "vref", N_("Standard+Textual Page"), N_("Ref+Text: ")},
{ "prettyref", N_("PrettyRef"), N_("FrmtRef: ")},
{ "nameref", N_("Reference to Name"), N_("NameRef:")},
{ "Nameref", N_("Name+Textual Page"), N_("NamePgRef:")},
{ "", "", "" }
};