commit ddda08f36b3a0a2ea462b61d3bcd4f969d3c4638
Author: Pavel Sanda <[email protected]>
Date: Thu Oct 31 21:23:20 2024 +0100
Fix for bug #12010. Make the setting of the numbering resemble the easiness
of other word processors.
- Adds an argument to LFUN "paragraph-params": "paragraph-params
\setcounter default|restart|resume|<int>"
- Adds menu and context-menu entries
- Adds Paragraph Settings dialog options
Patch from Daniel Ramoeller, adopted to the current master.
---
lib/ui/stdcontext.inc | 1 +
lib/ui/stdmenus.inc | 9 +++++
src/Buffer.cpp | 23 ++++++++++--
src/Counters.cpp | 18 ++++++++++
src/Counters.h | 4 +++
src/LyXAction.cpp | 5 +--
src/Paragraph.cpp | 8 +++++
src/ParagraphParameters.cpp | 39 ++++++++++++++++++++
src/ParagraphParameters.h | 8 +++++
src/Text.cpp | 9 +++++
src/frontends/qt/GuiParagraph.cpp | 66 ++++++++++++++++++++++++++++++++++
src/frontends/qt/GuiParagraph.h | 4 +++
src/frontends/qt/ui/ParagraphUi.ui | 74 ++++++++++++++++++++++++++++++++++++--
src/output_latex.cpp | 68 +++++++++++++++++++++++++++++++++--
src/tex2lyx/text.cpp | 5 +++
15 files changed, 333 insertions(+), 8 deletions(-)
diff --git a/lib/ui/stdcontext.inc b/lib/ui/stdcontext.inc
index 5037fa8172..263ac519bf 100644
--- a/lib/ui/stdcontext.inc
+++ b/lib/ui/stdcontext.inc
@@ -401,6 +401,7 @@ Menuset
Submenu "Text Properties|x" "edit_textprops"
OptSubmenu "Custom Text Styles|y" "edit_textstyles"
Item "Paragraph Settings...|P" "layout-paragraph"
+ OptSubmenu "Numbering" "edit_numbering"
OptItem "Unify Graphics Groups|U" "graphics-unify"
LanguageSelector
Separator
diff --git a/lib/ui/stdmenus.inc b/lib/ui/stdmenus.inc
index fd38567844..52c25067e3 100644
--- a/lib/ui/stdmenus.inc
+++ b/lib/ui/stdmenus.inc
@@ -123,6 +123,7 @@ Menuset
Item "Paragraph Settings...|P" "layout-paragraph"
Submenu "Text Properties|x" "edit_textprops"
OptSubmenu "Custom Text Styles|S" "edit_textstyles"
+ OptSubmenu "Numbering" "edit_numbering"
Item "Manage Counter Values..." "dialog-show-new-inset counter"
LanguageSelector
Separator
@@ -199,6 +200,14 @@ Menuset
End
# not much we can do to help here
+
+ Menu "edit_numbering"
+ Item "Default" "paragraph-params \setcounter-toggle default"
+ Item "Restart" "paragraph-params \setcounter-toggle restart"
+ Item "Resume" "paragraph-params \setcounter-toggle resume"
+ Item "Customize..." "layout-paragraph"
+ End
+
Menu "edit_tabular"
Item "Multi-page Table|g" "tabular-feature toggle-longtabular"
Item "Formal Style|F" "tabular-feature toggle-booktabs"
diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 222a146d35..75c95c2951 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -5301,9 +5301,19 @@ void Buffer::Impl::setLabel(ParIterator & it, UpdateType
utype) const
if (layout.stepparentcounter)
counters.stepParent(enumcounter, utype);
// Maybe we have to reset the enumeration counter.
- if (!layout.resumecounter)
+ if (!layout.resumecounter && par.params().counter() !=
"resume")
counters.reset(enumcounter);
}
+ if (!par.params().counter().empty()) {
+ if (par.params().counter() == "restart")
+ counters.set(enumcounter,
counters.initialValue(enumcounter));
+ else if (par.params().counter() == "resume") {
+ // enumitem package is added in Paragraph.cpp
+ // emumitem's resume* option is added in
output_latex.cpp
+ } else {
+ counters.set(enumcounter,
convert<int>(par.params().counter()));
+ }
+ }
counters.step(enumcounter, utype);
string const & lang = par.getParLanguage(bp)->code();
@@ -5344,8 +5354,17 @@ void Buffer::Impl::setLabel(ParIterator & it, UpdateType
utype) const
if (layout.toclevel <= bp.secnumdepth
&& (layout.latextype !=
LATEX_ENVIRONMENT
||
it.text()->isFirstInSequence(it.pit()))) {
- if (counters.hasCounter(lcounter))
+ if (counters.hasCounter(lcounter)) {
+ if (!par.params().counter().empty()) {
+ if (par.params().counter() ==
"restart")
+ counters.set(lcounter,
counters.initialValue(lcounter));
+ else if (par.params().counter()
== "resume") {
+ // don't do anything
since resume is default
+ } else
+ counters.set(lcounter,
convert<int>(par.params().counter()));
+ }
counters.step(lcounter, utype);
+ }
par.params().labelString(par.expandLabel(layout, bp));
} else
par.params().labelString(docstring());
diff --git a/src/Counters.cpp b/src/Counters.cpp
index 703125f537..9cbe3c5fc5 100644
--- a/src/Counters.cpp
+++ b/src/Counters.cpp
@@ -177,6 +177,12 @@ int Counter::value() const
}
+int Counter::initialValue() const
+{
+ return initial_value_;
+}
+
+
void Counter::saveValue()
{
saved_value_ = value_;
@@ -322,6 +328,18 @@ int Counters::value(docstring const & ctr) const
}
+int Counters::initialValue(docstring const & ctr) const
+{
+ CounterList::const_iterator const cit = counterList_.find(ctr);
+ if (cit == counterList_.end()) {
+ lyxerr << "value: Counter does not exist: "
+ << to_utf8(ctr) << endl;
+ return 0;
+ }
+ return cit->second.initialValue();
+}
+
+
void Counters::saveValue(docstring const & ctr) const
{
CounterList::const_iterator const cit = counterList_.find(ctr);
diff --git a/src/Counters.h b/src/Counters.h
index 67a790fc0c..c9e867a0d0 100644
--- a/src/Counters.h
+++ b/src/Counters.h
@@ -47,6 +47,8 @@ public:
///
int value() const;
///
+ int initialValue() const;
+ ///
void saveValue();
///
void restoreValue();
@@ -151,6 +153,8 @@ public:
///
int value(docstring const & ctr) const;
///
+ int initialValue(docstring const & ctr) const;
+ ///
void saveValue(docstring const & ctr) const;
///
void restoreValue(docstring const & ctr) const;
diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp
index 8d6982993f..712d7d3735 100644
--- a/src/LyXAction.cpp
+++ b/src/LyXAction.cpp
@@ -3350,10 +3350,11 @@ void LyXAction::init()
* \li Notion: Modifies the current paragraph, or currently selected
paragraphs.
This function only modifies, and does not override, existing
settings.
Note that the "leftindent" indent setting is deprecated.
- * \li Syntax: paragraph-params [<INDENT>] [<SPACING>] [<ALIGN>] [<OTHERS>]
+ * \li Syntax: paragraph-params [<INDENT>] [<SPACING>] [<ALIGN>] [<COUNTER>]
[<OTHERS>]
* \li Params: <INDENT>: \noindent|\indent|\indent-toggle|\leftindent LENGTH\n
<SPACING>: \paragraph_spacing
default|single|onehalf|double|other SIZE \n
<ALIGN>: \align block|left|right|center|default\n
+ <COUNTER>: \setcounter|\setcounter-toggle
default|restart|reset|resume|VALUE\n
<OTHERS>: \labelwidthstring WIDTH|\start_of_appendix
* \li Origin: rgh, Aug 15 2007
* \endvar
@@ -3365,7 +3366,7 @@ void LyXAction::init()
* \li Action: Change paragraph settings.
* \li Notion: Overwrite all nonspecified settings to the default ones.
Use paragraph-params lfun if you don't want to overwrite others
settings.
- * \li Syntax: paragraph-params-apply <INDENT> <SPACING> <ALIGN> <OTHERS>
+ * \li Syntax: paragraph-params-apply <INDENT> <SPACING> <ALIGN> <COUNTER>
<OTHERS>
* \li Params: For parameters see #LFUN_PARAGRAPH_PARAMS
* \li Origin: leeming, 30 Mar 2004
* \endvar
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 1f1940e1da..893916d1c5 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -1562,6 +1562,14 @@ void Paragraph::Private::validate(LaTeXFeatures &
features) const
if (!params_.spacing().isDefault())
features.require("setspace");
+ // pit_type pit = runparams.par_begin;
+ if (layout_->labeltype == LABEL_ENUMERATE
+ // FIXME: add enumitem package only when resuming at first item
+ // && (priorpit->layout() != pit->layout()
+ // || priorpit->getDepth() != pit->getDepth())
+ && params_.counter() == "resume")
+ features.require("enumitem");
+
// then the layouts
features.useLayout(layout_->name());
diff --git a/src/ParagraphParameters.cpp b/src/ParagraphParameters.cpp
index 32dc44900b..2a0edeefe1 100644
--- a/src/ParagraphParameters.cpp
+++ b/src/ParagraphParameters.cpp
@@ -78,6 +78,18 @@ void ParagraphParameters::spacing(Spacing const & s)
}
+docstring ParagraphParameters::counter() const
+{
+ return counter_;
+}
+
+
+void ParagraphParameters::counter(docstring const & v)
+{
+ counter_ = v;
+}
+
+
bool ParagraphParameters::noindent() const
{
return noindent_;
@@ -226,6 +238,28 @@ void ParagraphParameters::read(Lexer & lex, bool merge)
} else {
lex.printError("Unknown spacing token:
'$$Token'");
}
+ } else if (token == "\\setcounter") {
+ lex.next();
+ docstring const tmp = lex.getDocString();
+ if (tmp == "default") {
+ //not found in LyX files but can be used with
lfuns
+ counter(docstring());
+ } else
+ counter(tmp);
+ } else if (token == "\\setcounter-toggle") {
+ //not found in LyX files but can be used with lfuns
+ lex.next();
+ docstring const tmp = lex.getDocString();
+ if (tmp == counter()) {
+ //not found in LyX files but can be used with
lfuns
+ counter(docstring());
+ } else {
+ if (tmp == "default") {
+ //not found in LyX files but can be
used with lfuns
+ counter(docstring());
+ } else
+ counter(tmp);
+ }
} else if (token == "\\align") {
lex.next();
int tmpret = findToken(string_align, lex.getString());
@@ -252,6 +286,7 @@ void ParagraphParameters::apply(
align(params.align());
labelWidthString(params.labelWidthString());
noindent(params.noindent());
+ counter(params.counter());
}
@@ -273,6 +308,10 @@ void ParagraphParameters::write(ostream & os) const
if (noindent())
os << "\\noindent\n";
+ // Counter?
+ if (!counter().empty())
+ os << "\\setcounter " << to_utf8(counter()) << "\n";
+
// Do we have a manual left indent?
if (!leftIndent().zero())
os << "\\leftindent " << leftIndent().asString() << '\n';
diff --git a/src/ParagraphParameters.h b/src/ParagraphParameters.h
index 540ea95679..f4ebea1a58 100644
--- a/src/ParagraphParameters.h
+++ b/src/ParagraphParameters.h
@@ -47,6 +47,10 @@ public:
///
void noindent(bool);
///
+ docstring counter() const;
+ ///
+ void counter(docstring const &);
+ ///
LyXAlignment align() const;
///
void align(LyXAlignment);
@@ -97,6 +101,10 @@ private:
Spacing spacing_;
///
bool noindent_;
+ /// contains information what should happen to the counter
+ /// empty (= default), "restart" (from counter's initial value),
+ /// "reset" (to previously set value), "resume", "<int>" (= set to
<int>)
+ docstring counter_;
///
bool start_of_appendix_;
///
diff --git a/src/Text.cpp b/src/Text.cpp
index c26a5da35e..60bf7da128 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -6265,6 +6265,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
// NOTE: This function overrides all existing settings.
setParagraphs(cur, cmd.argument());
cur.message(_("Paragraph layout set"));
+ cur.forceBufferUpdate();
break;
}
@@ -6276,6 +6277,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
// settings.
setParagraphs(cur, cmd.argument(), true);
cur.message(_("Paragraph layout set"));
+ cur.forceBufferUpdate();
break;
}
@@ -7044,6 +7046,13 @@ bool Text::getStatus(Cursor & cur, FuncRequest const &
cmd,
case LFUN_PARAGRAPH_PARAMS_APPLY:
case LFUN_PARAGRAPH_UPDATE:
enable = owner_->allowParagraphCustomization();
+ if (cmd.getArg(0) == "\\setcounter-toggle") {
+ enable = enable &&
!cur.paragraph().layout().counter.empty();
+ if (cmd.getArg(1) == "default")
+
status.setOnOff(cur.paragraph().params().counter().empty());
+ else
+
status.setOnOff(to_utf8(cur.paragraph().params().counter()) == cmd.getArg(1));
+ }
break;
// FIXME: why are accent lfuns forbidden with pass_thru layouts?
diff --git a/src/frontends/qt/GuiParagraph.cpp
b/src/frontends/qt/GuiParagraph.cpp
index d2fbd484f5..bfc5d1730a 100644
--- a/src/frontends/qt/GuiParagraph.cpp
+++ b/src/frontends/qt/GuiParagraph.cpp
@@ -28,6 +28,7 @@
#include "ParagraphParameters.h"
#include "Spacing.h"
+#include "support/convert.h"
#include "support/debug.h"
#include "support/Lexer.h"
@@ -64,6 +65,9 @@ GuiParagraph::GuiParagraph(GuiView & lv)
connect(noindentCB, SIGNAL(clicked()), this, SLOT(changed()));
connect(labelWidth, SIGNAL(textChanged(QString)),
this, SLOT(changed()));
+ connect(setCounterCO, SIGNAL(activated(int)), this, SLOT(changed()));
+ connect(setCounterSB, SIGNAL(valueChanged(int)),
+ this, SLOT(changed()));
#ifdef Q_OS_MAC
// On Mac it's common to have tool windows which are always in the
@@ -106,6 +110,12 @@ void GuiParagraph::on_linespacing_activated(int index)
}
+void GuiParagraph::on_setCounterCO_activated(int index)
+{
+ setCounterSB->setEnabled(index == 4);
+}
+
+
void GuiParagraph::checkAlignmentRadioButtons()
{
static std::map<LyXAlignment, QString> labelMap_;
@@ -244,6 +254,25 @@ void GuiParagraph::applyView()
Spacing const spacing(ls, other);
params_.spacing(spacing);
+ // get numbering
+ docstring counterValue;
+ switch (setCounterCO->currentIndex()) {
+ case 0:
+ counterValue = from_ascii("default");
+ break;
+ case 1:
+ counterValue = from_ascii("restart");
+ break;
+ case 2:
+ counterValue = from_ascii("resume");
+ break;
+ case 3:
+ // set counter value to one less since it will be increased
when used
+ counterValue = convert<docstring>(setCounterSB->value() - 1);
+ break;
+ }
+ params_.counter(counterValue);
+
// label width
params_.labelWidthString(qstring_to_ucs4(labelWidth->text()));
// indentation
@@ -317,6 +346,34 @@ void GuiParagraph::updateView()
linespacingValue->setText(QString());
linespacingValue->setEnabled(false);
}
+
+ // counter
+ if (hasNumbering()) {
+ numberingGB->setEnabled(true);
+ int c;
+ docstring const & counter = pp.counter();
+ if (counter.empty())
+ c = 0;
+ else if (counter == "restart")
+ c = 1;
+ else if (counter == "resume")
+ c = 2;
+ else
+ c = 3;
+ setCounterCO->setCurrentIndex(c);
+ if (c == 3) {
+ setCounterSB->setValue(convert<int>(counter) + 1);
+ setCounterSB->setEnabled(true);
+ } else {
+ setCounterSB->setValue(0);
+ setCounterSB->setEnabled(false);
+ }
+ } else {
+ numberingGB->setEnabled(false);
+ setCounterSB->setValue(0);
+ setCounterSB->setEnabled(false);
+ }
+
// Somewhere in the chain this can lose default status (#11417)
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
}
@@ -327,6 +384,7 @@ void GuiParagraph::enableView(bool enable)
noindentCB->setEnabled(canIndent() && enable);
linespacing->setEnabled(enable);
labelWidth->setEnabled(enable);
+ setCounterCO->setEnabled(enable);
synchronizedViewCB->setEnabled(enable);
buttonBox->button(QDialogButtonBox::Apply)->setEnabled(enable);
buttonBox->button(QDialogButtonBox::Reset)->setEnabled(enable);
@@ -390,6 +448,14 @@ bool GuiParagraph::hasLabelwidth() const
}
+bool GuiParagraph::hasNumbering() const
+{
+ Layout layout = bufferview()->cursor().innerParagraph().layout();
+ return (layout.labeltype == LABEL_ENUMERATE
+ || (layout.labeltype == LABEL_STATIC &&
!layout.counter.empty()));
+}
+
+
void GuiParagraph::saveSession(QSettings & settings) const
{
Dialog::saveSession(settings);
diff --git a/src/frontends/qt/GuiParagraph.h b/src/frontends/qt/GuiParagraph.h
index 230390edd0..70af673ace 100644
--- a/src/frontends/qt/GuiParagraph.h
+++ b/src/frontends/qt/GuiParagraph.h
@@ -59,6 +59,8 @@ private:
///
bool hasLabelwidth() const;
///
+ bool hasNumbering() const;
+ ///
LyXAlignment alignPossible() const;
///
void setButtons(bool const in_sync);
@@ -70,6 +72,8 @@ private Q_SLOTS:
void on_synchronizedViewCB_stateChanged(int state);
///
void on_linespacing_activated(int);
+ ///
+ void on_setCounterCO_activated(int);
/// Apply changes
void on_buttonBox_clicked(QAbstractButton * button);
diff --git a/src/frontends/qt/ui/ParagraphUi.ui
b/src/frontends/qt/ui/ParagraphUi.ui
index 298e0942cb..9b67943a6a 100644
--- a/src/frontends/qt/ui/ParagraphUi.ui
+++ b/src/frontends/qt/ui/ParagraphUi.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>487</width>
- <height>303</height>
+ <height>316</height>
</rect>
</property>
<property name="focusPolicy">
@@ -196,13 +196,83 @@
</widget>
</item>
<item row="2" column="0">
+ <widget class="QGroupBox" name="numberingGB">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="title">
+ <string>Numbering</string>
+ </property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <property name="leftMargin">
+ <number>9</number>
+ </property>
+ <property name="topMargin">
+ <number>9</number>
+ </property>
+ <property name="rightMargin">
+ <number>9</number>
+ </property>
+ <property name="bottomMargin">
+ <number>9</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <item row="0" column="1">
+ <widget class="QSpinBox" name="setCounterSB">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimum">
+ <number>-2147483647</number>
+ </property>
+ <property name="maximum">
+ <number>2147483647</number>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QComboBox" name="setCounterCO">
+ <item>
+ <property name="text">
+ <string>Default</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Restart</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Resume</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Custom</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="3" column="0">
<widget class="QCheckBox" name="noindentCB">
<property name="text">
<string>&Do not indent paragraph</string>
</property>
</widget>
</item>
- <item row="3" column="0" colspan="3">
+ <item row="4" column="0" colspan="3">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
diff --git a/src/output_latex.cpp b/src/output_latex.cpp
index 9fdc901727..d014d2a391 100644
--- a/src/output_latex.cpp
+++ b/src/output_latex.cpp
@@ -278,10 +278,24 @@ static TeXEnvironmentData prepareEnvironment(Buffer const
& buf,
if (style.isEnvironment() && !style.latexname().empty()) {
os << "\\begin{" << from_ascii(style.latexname()) << '}';
- if (!style.latexargs().empty()) {
+ Layout::LaTeXArgMap latexargs = style.latexargs();
+ // add resume* option to enumerate lists
+ if (style.latextype == LATEX_ITEM_ENVIRONMENT
+ && style.labeltype == LABEL_ENUMERATE
+ && !style.counter.empty()
+ && pit->params().counter() == "resume"
+ // add resume* option only for first item in
environment
+ // (otherwise resuming is default anyway)
+ && (priorpit->layout() != pit->layout()
+ || priorpit->getDepth() !=
pit->getDepth()))
+ latexargs["1"].presetarg =
+ from_ascii("resume*")
+ +
from_ascii(latexargs["1"].presetarg.empty() ? "" : ", ")
+ + latexargs["1"].presetarg;
+ if (!latexargs.empty()) {
OutputParams rp = runparams;
rp.local_font = &pit->getFirstFontSettings(bparams);
- latexArgInsets(paragraphs, pit, os, rp,
style.latexargs());
+ latexArgInsets(paragraphs, pit, os, rp, latexargs);
}
if (style.latextype == LATEX_LIST_ENVIRONMENT) {
os << '{'
@@ -301,6 +315,17 @@ static TeXEnvironmentData prepareEnvironment(Buffer const
& buf,
|| style.latextype == LATEX_LIST_ENVIRONMENT) {
OutputParams rp = runparams;
rp.local_font = &pit->getFirstFontSettings(bparams);
+ // Layout::LaTeXArgMap listpreamble =
style.listpreamble();
+ // if (!style.counter.empty() &&
pit->params().counter() == "resume"
+ // // add resume* option only for first item in
environment
+ // // (otherwise resuming is default anyway)
+ // && (priorpit->layout() != pit->layout()
+ // || priorpit->getDepth() !=
pit->getDepth()))
+ // listpreamble["listpreamble:1"].presetarg +=
+ //
from_ascii(listpreamble["listpreamble:1"].presetarg.empty() ? "" : ", ")
+ // + from_ascii("resume*");
+ // latexArgInsets(paragraphs, pit, os, rp, listpreamble,
+ // "listpreamble:");
latexArgInsets(paragraphs, pit, os, rp,
style.listpreamble(),
"listpreamble:");
}
@@ -1188,6 +1213,45 @@ void TeXOnePar(Buffer const & buf,
os <<
from_ascii(par.params().spacing().writeEnvirBegin(useSetSpace))
<< '\n';
}
+ docstring const & parcounter = par.params().counter();
+ Counters & cnts = bparams.documentClass().counters();
+ if (!style.counter.empty() // does the layout have a
counter?
+ // nothing needs to be done for "resume"
because it is default
+ && (parcounter.empty() || parcounter ==
"restart"
+ || parcounter == "reset" ||
isStrInt(to_ascii(parcounter)))) {
+ docstring counter = style.counter;
+ if (style.latextype == LATEX_ITEM_ENVIRONMENT) {
+ switch (par.itemdepth) {
+ case 2:
+ counter += 'i';
+ // fall through
+ case 1:
+ counter += 'i';
+ // fall through
+ case 0:
+ counter += 'i';
+ break;
+ case 3:
+ counter += "iv";
+ break;
+ default:
+ // not a valid enumdepth...
+ break;
+ }
+ }
+ if (!parcounter.empty()
+ || (cnts.initialValue(counter) != 0
+ && (priorpar->layout() !=
par.layout()
+ || priorpar->getDepth()
!= par.getDepth()))) {
+ os << "\\setcounter{" << counter <<
"}{";
+ if (parcounter.empty() || parcounter ==
"restart")
+ os <<
convert<docstring>(cnts.initialValue(counter));
+ else if
(isStrInt(to_ascii(parcounter))) {
+ os << parcounter;
+ }
+ os << "}\n";
+ }
+ }
if (style.isCommand()) {
os << '\n';
diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp
index 042f314bc8..beb0f7051f 100644
--- a/src/tex2lyx/text.cpp
+++ b/src/tex2lyx/text.cpp
@@ -3793,6 +3793,11 @@ void parse_text(Parser & p, ostream & os, unsigned
flags, bool outer,
continue;
}
+ // FIXME: not sure whether anything has to be done here
+ // if (t.cs() == "setcounter") {
+ // ???
+ // }
+
if (t.cs() == "appendix" && !context.in_list_preamble) {
context.add_par_extra_stuff("\\start_of_appendix\n");
// We need to start a new paragraph. Otherwise the
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs