Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:
> The following patch introduces LabelString for counters. This
> labelstring will be used in several places:
Here is the updated version of the patch, the shortcoming have been
resolved and the layout files have been updated. For example floats
and footnotes are now correctly numbered by chapter for book and
report classes.
I updated the documentation too.
Note that the rest of the layut files should be updated. I do not
think they are broken by the patch, but they can be simplified.
JMarc
Add support for \thecounter variables in labels.
* src/Counters.cpp (Counter::labelString/labelStringAppendix): new
accessors for two new variables
(Counter::setMaster): removed
(Counter::Counter): add a version with arguments.
(Counters::newCounter): add relevant arguments; allow to redefine
an existing counter.
(Counters::reset): reset the current float float.
(Counters::theCounter): return a representation of a given counter
using its labelstring or by default \themaster.\arabic{counter}.
Handle appendix too.
(Counters::counterLabel): add support for macros of the form
\thecounter.
* src/TextClass.cpp (readCounters): also read LabelString and
LabelStringAppendix.
* src/Paragraph.cpp (expandLabel): if the labelstring is e,pty,
use \thecounter instead; when processing @layout@ tokens, pass the
process_appendix boolean.
* src/buffer_funcs.cpp (setLabel):
* src/insets/InsetFoot.cpp (updateLabels):
* src/insets/InsetCaption.cpp (updateLabels): use
Counters::theCounter.
* numarticle.inc:
* numreport.inc:
* stdcounter.inc:
* stdsections.inc:
* stdstarsections.inc:
* stdclass.inc:
* scrbook.layout:
* amsmath.inc: adapt: remove most of the LabelString in layouts,
add the necessary stuff to counters.
* lib/doc/Customization.lyx: document the new stuff.
svndiff
Index: src/TextClass.cpp
===================================================================
--- src/TextClass.cpp (révision 19595)
+++ src/TextClass.cpp (copie de travail)
@@ -212,12 +212,12 @@ bool TextClass::read(FileName const & fi
if (!merge)
LYXERR(Debug::TCLASS) << "Reading textclass "
- << to_utf8(makeDisplayPath(filename.absFilename()))
- << endl;
+ << to_utf8(makeDisplayPath(filename.absFilename()))
+ << endl;
else
LYXERR(Debug::TCLASS) << "Reading input file "
- << to_utf8(makeDisplayPath(filename.absFilename()))
- << endl;
+ << to_utf8(makeDisplayPath(filename.absFilename()))
+ << endl;
Lexer lexrc(textClassTags,
sizeof(textClassTags) / sizeof(textClassTags[0]));
@@ -894,6 +894,8 @@ void TextClass::readFloat(Lexer & lexrc)
enum CounterTags {
CT_NAME = 1,
CT_WITHIN,
+ CT_LABELSTRING,
+ CT_LABELSTRING_APPENDIX,
CT_END
};
@@ -901,6 +903,8 @@ void TextClass::readCounter(Lexer & lexr
{
keyword_item counterTags[] = {
{ "end", CT_END },
+ { "labelstring", CT_LABELSTRING },
+ { "labelstringappendix", CT_LABELSTRING_APPENDIX },
{ "name", CT_NAME },
{ "within", CT_WITHIN }
};
@@ -909,6 +913,8 @@ void TextClass::readCounter(Lexer & lexr
docstring name;
docstring within;
+ docstring labelstring;
+ docstring labelstring_appendix;
bool getout = false;
while (!getout && lexrc.isOK()) {
@@ -922,14 +928,31 @@ void TextClass::readCounter(Lexer & lexr
switch (static_cast<CounterTags>(le)) {
case CT_NAME:
lexrc.next();
- name = from_ascii(lexrc.getString());
+ name = lexrc.getDocString();
+ if (ctrs_->hasCounter(name))
+ LYXERR(Debug::TCLASS)
+ << "Reading existing counter "
+ << to_utf8(name) << endl;
+ else
+ LYXERR(Debug::TCLASS)
+ << "Reading new counter "
+ << to_utf8(name) << endl;
break;
case CT_WITHIN:
lexrc.next();
- within = from_ascii(lexrc.getString());
+ within = lexrc.getDocString();
if (within == "none")
within.erase();
break;
+ case CT_LABELSTRING:
+ lexrc.next();
+ labelstring = lexrc.getDocString();
+ labelstring_appendix = labelstring;
+ break;
+ case CT_LABELSTRING_APPENDIX:
+ lexrc.next();
+ labelstring_appendix = lexrc.getDocString();
+ break;
case CT_END:
getout = true;
break;
@@ -937,12 +960,9 @@ void TextClass::readCounter(Lexer & lexr
}
// Here if have a full counter if getout == true
- if (getout) {
- if (within.empty())
- ctrs_->newCounter(name);
- else
- ctrs_->newCounter(name, within);
- }
+ if (getout)
+ ctrs_->newCounter(name, within,
+ labelstring, labelstring_appendix);
lexrc.popTable();
}
Index: src/insets/InsetCaption.cpp
===================================================================
--- src/insets/InsetCaption.cpp (révision 19595)
+++ src/insets/InsetCaption.cpp (copie de travail)
@@ -36,7 +36,6 @@
#include "frontends/Painter.h"
#include "support/lstrings.h"
-#include "support/convert.h"
#include <sstream>
@@ -306,7 +305,7 @@ void InsetCaption::updateLabels(Buffer c
cnts.step(from_utf8(type));
full_label_ = bformat(from_ascii("%1$s %2$s:"),
name,
- convert<docstring>(cnts.value(from_utf8(type))));
+ cnts.theCounter(from_utf8(type)));
} else
full_label_ = bformat(from_ascii("%1$s #:"), name);
}
Index: src/insets/InsetFoot.cpp
===================================================================
--- src/insets/InsetFoot.cpp (révision 19595)
+++ src/insets/InsetFoot.cpp (copie de travail)
@@ -23,7 +23,6 @@
#include "OutputParams.h"
#include "ParIterator.h"
-#include "support/convert.h"
#include "support/std_ostream.h"
#include "support/lstrings.h"
@@ -69,7 +68,7 @@ void InsetFoot::updateLabels(Buffer cons
//FIXME: the counter should format itself.
setLabel(support::bformat(from_ascii("%1$s %2$s"),
getLayout(buf.params()).labelstring,
- convert<docstring>(cnts.value(foot))));
+ cnts.theCounter(foot)));
}
InsetCollapsable::updateLabels(buf, it);
Index: src/buffer_funcs.cpp
===================================================================
--- src/buffer_funcs.cpp (révision 19595)
+++ src/buffer_funcs.cpp (copie de travail)
@@ -42,11 +42,8 @@
#include "frontends/alert.h"
#include "insets/InsetBibitem.h"
-#include "insets/InsetCaption.h"
#include "insets/InsetInclude.h"
-#include "insets/InsetTabular.h"
-#include "support/convert.h"
#include "support/filetools.h"
#include "support/fs_extras.h"
#include "support/lyxlib.h"
@@ -538,7 +535,7 @@ void setLabel(Buffer const & buf, ParIte
counters.step(from_utf8(type));
full_label = bformat(from_ascii("%1$s %2$s:"),
name,
- convert<docstring>(counters.value(from_utf8(type))));
+ counters.theCounter(from_utf8(type)));
} else
full_label = bformat(from_ascii("%1$s #:"), name);
}
Index: src/Counters.cpp
===================================================================
--- src/Counters.cpp (révision 19595)
+++ src/Counters.cpp (copie de travail)
@@ -27,9 +27,9 @@ using std::endl;
using std::ostringstream;
using std::string;
-
namespace lyx {
+using support::lowercase;
Counter::Counter()
{
@@ -37,6 +37,14 @@ Counter::Counter()
}
+Counter::Counter(docstring const & mc, docstring const & ls,
+ docstring const & lsa)
+ : master_(mc), labelstring_(ls), labelstringappendix_(lsa)
+{
+ reset();
+}
+
+
void Counter::set(int v)
{
value_ = v;
@@ -73,50 +81,30 @@ docstring const & Counter::master() cons
}
-void Counter::setMaster(docstring const & m)
+docstring const & Counter::labelString() const
{
- master_ = m;
+ return labelstring_;
}
-void Counters::newCounter(docstring const & newc)
+docstring const & Counter::labelStringAppendix() const
{
- // First check if newc already exist
- CounterList::iterator const cit = counterList.find(newc);
- // if already exist give warning and return
- if (cit != counterList.end()) {
- lyxerr << "New counter already exists: "
- << to_utf8(newc)
- << endl;
- return;
- }
- counterList[newc];
+ return labelstringappendix_;
}
void Counters::newCounter(docstring const & newc,
- docstring const & masterc)
+ docstring const & masterc,
+ docstring const & ls,
+ docstring const & lsa)
{
- // First check if newc already exists
- CounterList::iterator const cit = counterList.find(newc);
- // if already existant give warning and return
- if (cit != counterList.end()) {
- lyxerr << "New counter already exists: "
- << to_utf8(newc)
- << endl;
- return;
- }
- // then check if masterc exists
- CounterList::iterator const it = counterList.find(masterc);
- // if not give warning and return
- if (it == counterList.end()) {
+ if (!masterc.empty() && !hasCounter(masterc)) {
lyxerr << "Master counter does not exist: "
<< to_utf8(masterc)
<< endl;
return;
}
-
- counterList[newc].setMaster(masterc);
+ counterList[newc] = Counter(masterc, ls, lsa);
}
@@ -185,6 +173,7 @@ void Counters::step(docstring const & ct
void Counters::reset()
{
appendix_ = false;
+ current_float_.erase();
CounterList::iterator it = counterList.begin();
CounterList::iterator const end = counterList.end();
for (; it != end; ++it) {
@@ -351,12 +340,47 @@ docstring Counters::labelItem(docstring
}
+docstring Counters::theCounter(docstring const & counter)
+{
+ if (!hasCounter(counter))
+ return from_ascii("??");
+
+ Counter const & c = counterList[counter];
+ docstring ls = appendix() ? c.labelStringAppendix() : c.labelString();
+
+ if (ls.empty()) {
+ if (!c.master().empty())
+ ls = from_ascii("\\the") + c.master() + from_ascii(".");
+ ls += from_ascii("\\arabic{") + counter + "}";
+ }
+ return counterLabel(ls);
+}
+
+
docstring Counters::counterLabel(docstring const & format)
{
docstring label = format;
+
+ // FIXME: Using regexps would be better, but we compile boost without
+ // wide regexps currently.
+
+ while (true) {
+ //lyxerr << "label=" << to_utf8(label) << endl;
+ size_t const i = label.find(from_ascii("\\the"), 0);
+ if (i == docstring::npos)
+ break;
+ size_t j = i + 4;
+ size_t k = j;
+ while (k < label.size() && lowercase(label[k]) >= 'a'
+ && lowercase(label[k]) <= 'z')
+ ++k;
+ docstring counter = label.substr(j, k - j);
+ docstring repl = theCounter(counter);
+ label.replace(i, k - j + 4, repl);
+ }
+
while (true) {
- // FIXME: Using boost::regex or boost::spirit would make
- // FIXME: this code a lot simpler... (Lgb)
+ //lyxerr << "label=" << to_utf8(label) << endl;
size_t const i = label.find('\\', 0);
if (i == docstring::npos)
@@ -372,10 +396,8 @@ docstring Counters::counterLabel(docstri
docstring const rep = labelItem(counter, numbertype);
label = docstring(label, 0, i) + rep
+ docstring(label, k + 1, docstring::npos);
- //lyxerr << " : " << " (" << counter << ","
- // << numbertype << ") -> " << label << endl;
}
- //lyxerr << "counterLabel: " << format << " -> " << label << endl;
+ //lyxerr << "DONE! label=" << to_utf8(label) << endl;
return label;
}
Index: src/Counters.h
===================================================================
--- src/Counters.h (révision 19595)
+++ src/Counters.h (copie de travail)
@@ -28,6 +28,9 @@ public:
///
Counter();
///
+ Counter(docstring const & mc, docstring const & ls,
+ docstring const & lsa);
+ ///
void set(int v);
///
void addto(int v);
@@ -39,15 +42,24 @@ public:
void reset();
/// Returns the master counter of this counter
docstring const & master() const;
- /// sets the master counter for this counter
- void setMaster(docstring const & m);
+ /// Returns a LaTeX-like string to format the counter, similar
+ /// to LaTeX' \c \thesubsection.
+ docstring const & labelString() const;
+ /// Returns a LaTeX-like string to format the counter in
+ /// appendix, similar to LaTeX' \c \thesubsection.
+ docstring const & labelStringAppendix() const;
private:
///
int value_;
/// contains master counter name; master counter is the counter
/// that, if stepped (incremented) zeroes this counter. E.g.
- /// "subparagraph"'s master is "paragraph".
+ /// "subsection"'s master is "section".
docstring master_;
+ // Contains a LaTeX-like string to format the counter, similar
+ // to LaTeX' \c \thesubsection.
+ docstring labelstring_;
+ // The same as labelstring_, but in appendices.
+ docstring labelstringappendix_;
};
@@ -57,9 +69,11 @@ class Counters {
public:
/// Add a new counter to array.
void newCounter(docstring const & newc);
- /// Add new counter having oldc as its master.
+ /// Add new counter having oldc as its master and ls as its label.
void newCounter(docstring const & newc,
- docstring const & oldc);
+ docstring const & masterc,
+ docstring const & ls,
+ docstring const & lsa);
///
bool hasCounter(docstring const & c) const;
///
@@ -81,6 +95,8 @@ public:
/// the &to array of counters. Empty string matches all.
void copy(Counters & from, Counters & to,
docstring const & match = docstring());
+ /// returns the string representation of the counter.
+ docstring theCounter(docstring const & c);
/// A complete expanded label, like 2.1.4 for a subsubsection
/// according to the given format
docstring counterLabel(docstring const & format);
@@ -96,7 +112,7 @@ private:
/// A counter label's single item, 1 for subsection number in
/// the 2.1.4 subsubsection number label.
docstring labelItem(docstring const & ctr,
- docstring const & numbertype);
+ docstring const & numbertype);
/// Maps counter (layout) names to actual counters.
typedef std::map<docstring, Counter> CounterList;
/// Instantiate.
Index: src/Paragraph.cpp
===================================================================
--- src/Paragraph.cpp (révision 19595)
+++ src/Paragraph.cpp (copie de travail)
@@ -1663,6 +1663,10 @@ docstring Paragraph::expandLabel(Layout_
else
fmt = translateIfPossible(layout->labelstring(), bparams);
+ if (fmt.empty() && layout->labeltype == LABEL_COUNTER
+ && !layout->counter.empty())
+ fmt = "\\the" + layout->counter;
+
// handle 'inherited level parts' in 'fmt',
// i.e. the stuff between '@' in '@[EMAIL PROTECTED]'
size_t const i = fmt.find('@', 0);
@@ -1670,8 +1674,10 @@ docstring Paragraph::expandLabel(Layout_
size_t const j = fmt.find('@', i + 1);
if (j != docstring::npos) {
docstring parent(fmt, i + 1, j - i - 1);
- docstring label = expandLabel(tclass[parent], bparams);
- fmt = docstring(fmt, 0, i) + label + docstring(fmt, j + 1, docstring::npos);
+ docstring label = expandLabel(tclass[parent], bparams,
+ process_appendix);
+ fmt = docstring(fmt, 0, i) + label
+ + docstring(fmt, j + 1, docstring::npos);
}
}
Index: lib/layouts/numarticle.inc
===================================================================
--- lib/layouts/numarticle.inc (révision 19595)
+++ lib/layouts/numarticle.inc (copie de travail)
@@ -2,54 +2,15 @@
# This include file contains label definitions for an article-like numbering.
Format 4
-Style Part
- LabelType Counter
- LabelCounter part
- LabelString "Part \Roman{part}"
- TocLevel 0
-End
-
-Style Section
- LabelType Counter
- LabelCounter section
- LabelString "\arabic{section}"
+# appendix applies to sections.
+Counter
+ Name section
+ Within "none"
+ LabelString "\arabic{section}"
LabelStringAppendix "\Alph{section}"
- TocLevel 1
-End
-
-
-Style Subsection
- LabelType Counter
- LabelCounter subsection
- LabelString "@[EMAIL PROTECTED]"
- LabelStringAppendix "@[EMAIL PROTECTED]"
- TocLevel 2
End
-Style Subsubsection
- LabelType Counter
- LabelCounter subsubsection
- LabelString "@[EMAIL PROTECTED]"
- LabelStringAppendix "@[EMAIL PROTECTED]"
- TocLevel 3
-End
-
-Style Paragraph
- LabelType Counter
- LabelCounter paragraph
- LabelString "@[EMAIL PROTECTED]"
- LabelStringAppendix "@[EMAIL PROTECTED]"
- TocLevel 4
-End
-
-Style Subparagraph
- LabelType Counter
- LabelCounter subparagraph
- LabelString "@[EMAIL PROTECTED]"
- LabelStringAppendix "@[EMAIL PROTECTED]"
- TocLevel 5
-End
Index: lib/layouts/scrbook.layout
===================================================================
--- lib/layouts/scrbook.layout (révision 19595)
+++ lib/layouts/scrbook.layout (copie de travail)
@@ -14,8 +14,7 @@ NoStyle Abstract
Style Chapter
- LabelString "\arabic{chapter}"
- LabelStringAppendix "\Alph{chapter}"
+ LabelString "\thechapter"
End
Index: lib/layouts/stdcounters.inc
===================================================================
--- lib/layouts/stdcounters.inc (révision 19595)
+++ lib/layouts/stdcounters.inc (copie de travail)
@@ -5,8 +5,9 @@
Format 4
-Counter
- Name part
+Counter
+ Name part
+ LabelString "\Roman{part}"
End
Counter
@@ -74,11 +75,11 @@ Counter
End
Counter
- Name equation
+ Name listing
End
Counter
- Name listing
+ Name equation
End
Counter
Index: lib/layouts/stdstarsections.inc
===================================================================
--- lib/layouts/stdstarsections.inc (révision 19595)
+++ lib/layouts/stdstarsections.inc (copie de travail)
@@ -15,6 +15,7 @@ Style Part*
Margin Static
LatexName part*
LabelType No_Label
+ LabelCounter ""
End
@@ -23,6 +24,7 @@ Style Chapter*
Margin Static
LatexName chapter*
LabelType No_Label
+ LabelCounter ""
OptionalArgs 0
End
@@ -32,6 +34,7 @@ Style Section*
Margin Static
LatexName section*
LabelType No_Label
+ LabelCounter ""
OptionalArgs 0
End
@@ -41,6 +44,7 @@ Style Subsection*
Margin Static
LatexName subsection*
LabelType No_Label
+ LabelCounter ""
OptionalArgs 0
End
@@ -50,6 +54,7 @@ Style Subsubsection*
Margin Static
LatexName subsubsection*
LabelType No_Label
+ LabelCounter ""
OptionalArgs 0
End
@@ -59,6 +64,7 @@ Style Paragraph*
Margin Static
LatexName paragraph*
LabelType No_Label
+ LabelCounter ""
OptionalArgs 0
End
@@ -68,5 +74,6 @@ Style Subparagraph*
Margin Static
LatexName subparagraph*
LabelType No_Label
+ LabelCounter ""
OptionalArgs 0
End
Index: lib/layouts/stdsections.inc
===================================================================
--- lib/layouts/stdsections.inc (révision 19595)
+++ lib/layouts/stdsections.inc (copie de travail)
@@ -10,6 +10,10 @@
Format 4
Style Part
Margin Dynamic
+ LabelString "Part \thepart"
+ LabelType Counter
+ TocLevel 0
+ LabelCounter part
LatexType Command
LatexName part
NeedProtect 1
@@ -30,6 +34,11 @@ End
Style Chapter
Margin Static
+ LabelString "Chapter \thechapter"
+ LabelStringAppendix "Appendix \thechapter"
+ LabelType Counter
+ LabelCounter chapter
+ TocLevel 0
LatexType Command
LatexName chapter
NeedProtect 1
@@ -50,6 +59,9 @@ End
Style Section
Margin Dynamic
+ LabelType Counter
+ LabelCounter section
+ TocLevel 1
LatexType Command
LatexName section
NeedProtect 1
@@ -71,6 +83,8 @@ End
Style Subsection
CopyStyle Section
+ LabelCounter subsection
+ TocLevel 2
LatexName subsection
TopSep 0.9
BottomSep 0.5
@@ -84,6 +98,8 @@ End
Style Subsubsection
CopyStyle Subsection
+ LabelCounter subsubsection
+ TocLevel 3
LatexName subsubsection
TopSep 0.7
BottomSep 0.4
@@ -96,6 +112,8 @@ End
Style Paragraph
CopyStyle Subsubsection
+ LabelCounter paragraph
+ TocLevel 4
LatexName paragraph
TopSep 0.4
BottomSep 0
@@ -104,6 +122,8 @@ End
Style Subparagraph
CopyStyle Paragraph
+ LabelCounter subparagraph
+ TocLevel 5
LatexName subparagraph
NextNoIndent 0
LeftMargin MM
Index: lib/layouts/stdclass.inc
===================================================================
--- lib/layouts/stdclass.inc (révision 19595)
+++ lib/layouts/stdclass.inc (copie de travail)
@@ -37,6 +37,8 @@ Style Standard
End
+Input stdfloats.inc
+Input stdcounters.inc
Input stdinsets.inc
Input stdlists.inc
Input stdsections.inc
@@ -45,5 +47,3 @@ Input stdtitle.inc
Input stdstruct.inc
Input lyxmacros.inc
Input stdlayouts.inc
-Input stdfloats.inc
-Input stdcounters.inc
Index: lib/layouts/amsmaths.inc
===================================================================
--- lib/layouts/amsmaths.inc (révision 19595)
+++ lib/layouts/amsmaths.inc (copie de travail)
@@ -76,7 +76,7 @@ Style Theorem
AlignPossible Block, Left
LabelType Counter
LabelCounter theorem
- LabelString "Theorem @[EMAIL PROTECTED]"
+ LabelString "Theorem \thetheorem."
Font
Shape Italic
Size Normal
@@ -103,7 +103,7 @@ End
Style Corollary
CopyStyle Theorem
LatexName cor
- LabelString "Corollary @[EMAIL PROTECTED]"
+ LabelString "Corollary \thetheorem."
Preamble
\theoremstyle{plain}
\newtheorem{cor}[thm]{Corollary}
@@ -125,7 +125,7 @@ End
Style Lemma
CopyStyle Theorem
LatexName lem
- LabelString "Lemma @[EMAIL PROTECTED]"
+ LabelString "Lemma \thetheorem."
Preamble
\theoremstyle{plain}
\newtheorem{lem}[thm]{Lemma}
@@ -147,7 +147,7 @@ End
Style Proposition
CopyStyle Theorem
LatexName prop
- LabelString "Proposition @[EMAIL PROTECTED]"
+ LabelString "Proposition \thetheorem."
Preamble
\theoremstyle{plain}
\newtheorem{prop}[thm]{Proposition}
@@ -169,7 +169,7 @@ End
Style Conjecture
CopyStyle Theorem
LatexName conjecture
- LabelString "Conjecture @[EMAIL PROTECTED]"
+ LabelString "Conjecture \thetheorem."
Preamble
\theoremstyle{plain}
\newtheorem{conjecture}[thm]{Conjecture}
@@ -191,7 +191,7 @@ End
Style Criterion
CopyStyle Theorem
LatexName criterion
- LabelString "Criterion @[EMAIL PROTECTED]"
+ LabelString "Criterion \thetheorem."
Preamble
\theoremstyle{plain}
\newtheorem{criterion}[thm]{Criterion}
@@ -202,7 +202,7 @@ End
Style Algorithm
CopyStyle Theorem
LatexName algorithm
- LabelString "Algorithm @[EMAIL PROTECTED]"
+ LabelString "Algorithm \thetheorem."
Preamble
\theoremstyle{plain}
\newtheorem{algorithm}[thm]{Algorithm}
@@ -213,7 +213,7 @@ End
Style Fact
CopyStyle Theorem
LatexName fact
- LabelString "Fact @[EMAIL PROTECTED]"
+ LabelString "Fact \thetheorem."
Preamble
\theoremstyle{plain}
\newtheorem{fact}[thm]{Fact}
@@ -235,7 +235,7 @@ End
Style Axiom
CopyStyle Theorem
LatexName ax
- LabelString "Axiom @[EMAIL PROTECTED]"
+ LabelString "Axiom \thetheorem."
Preamble
\theoremstyle{plain}
\newtheorem{ax}[thm]{Axiom}
@@ -246,7 +246,7 @@ End
Style Definition
CopyStyle Theorem
LatexName defn
- LabelString "Definition @[EMAIL PROTECTED]"
+ LabelString "Definition \thetheorem."
Font
Shape Up
EndFont
@@ -276,7 +276,7 @@ End
Style Example
CopyStyle Definition
LatexName example
- LabelString "Example @[EMAIL PROTECTED]"
+ LabelString "Example \thetheorem."
Preamble
\theoremstyle{definition}
\newtheorem{example}[thm]{Example}
@@ -298,7 +298,7 @@ End
Style Condition
CopyStyle Definition
LatexName condition
- LabelString "Condition @[EMAIL PROTECTED]"
+ LabelString "Condition \thetheorem."
Preamble
\theoremstyle{definition}
\newtheorem{condition}[thm]{Condition}
@@ -320,7 +320,7 @@ End
Style Problem
CopyStyle Definition
LatexName problem
- LabelString "Problem @[EMAIL PROTECTED]"
+ LabelString "Problem \thetheorem."
Preamble
\theoremstyle{definition}
\newtheorem{problem}[thm]{Problem}
@@ -342,7 +342,7 @@ End
Style Exercise
CopyStyle Definition
LatexName xca
- LabelString "Exercise @[EMAIL PROTECTED]"
+ LabelString "Exercise \thetheorem."
Preamble
\theoremstyle{definition}
%%Delete [section] for sequential numbering
@@ -365,7 +365,7 @@ End
Style Remark
CopyStyle Theorem
LatexName rem
- LabelString "Remark @[EMAIL PROTECTED]"
+ LabelString "Remark \thetheorem."
Font
Shape Up
Size Normal
@@ -396,7 +396,7 @@ End
Style Claim
CopyStyle Remark
LatexName claim
- LabelString "Claim @[EMAIL PROTECTED]"
+ LabelString "Claim \thetheorem."
Preamble
\theoremstyle{remark}
\newtheorem{claim}[thm]{Claim}
@@ -418,7 +418,7 @@ End
Style Note
CopyStyle Remark
LatexName note
- LabelString "Note @[EMAIL PROTECTED]"
+ LabelString "Note \thetheorem."
Preamble
\theoremstyle{remark}
\newtheorem{note}[thm]{Note}
@@ -440,7 +440,7 @@ End
Style Notation
CopyStyle Remark
LatexName notation
- LabelString "Notation @[EMAIL PROTECTED]"
+ LabelString "Notation \thetheorem."
Preamble
\theoremstyle{remark}
\newtheorem{notation}[thm]{Notation}
@@ -462,7 +462,7 @@ End
Style Summary
CopyStyle Remark
LatexName summary
- LabelString "Summary @[EMAIL PROTECTED]"
+ LabelString "Summary \thetheorem."
Preamble
\theoremstyle{remark}
\newtheorem{summary}[thm]{Summary}
@@ -473,7 +473,7 @@ End
Style Acknowledgement
CopyStyle Remark
LatexName acknowledgement
- LabelString "Acknowledgement @[EMAIL PROTECTED]"
+ LabelString "Acknowledgement \thetheorem."
Preamble
\theoremstyle{remark}
\newtheorem{acknowledgement}[thm]{Acknowledgement}
@@ -495,7 +495,7 @@ End
Style Case
CopyStyle Remark
LatexName case
- LabelString "Case @[EMAIL PROTECTED]"
+ LabelString "Case \thetheorem."
Preamble
\theoremstyle{remark}
\newtheorem{case}{Case} %%Numbering of Cases not keyed to sections
@@ -506,7 +506,7 @@ End
Style Conclusion
CopyStyle Remark
LatexName conclusion
- LabelString "Conclusion @[EMAIL PROTECTED]"
+ LabelString "Conclusion \thetheorem."
Preamble
\theoremstyle{remark}
\newtheorem{conclusion}[thm]{Conclusion}
Index: lib/layouts/numreport.inc
===================================================================
--- lib/layouts/numreport.inc (révision 19595)
+++ lib/layouts/numreport.inc (copie de travail)
@@ -2,24 +2,46 @@
# This include file contains label definitions for a report-like numbering.
Format 4
-Input numarticle.inc
Style Part
TocLevel -1
End
+Counter
+ Name chapter
+ Within ""
+ LabelString "\arabic{chapter}"
+ LabelStringAppendix "\Alph{chapter}"
+End
+
+Counter
+ Name section
+ Within chapter
+ LabelString ""
+End
-Style Chapter
- LabelType Counter
- LabelCounter chapter
- LabelString "Chapter \arabic{chapter}"
- LabelStringAppendix "Appendix \Alph{chapter}"
- TocLevel 0
+Counter
+ Name figure
+ Within chapter
End
+Counter
+ Name table
+ Within chapter
+End
-Style Section
- LabelString "\arabic{chapter}.\arabic{section}"
- LabelStringAppendix "\Alph{chapter}.\arabic{section}"
+Counter
+ Name algorithm
+ Within chapter
End
+Counter
+ Name listing
+ Within chapter
+End
+
+Counter
+ Name footnote
+ Within chapter
+ LabelString "\arabic{footnote}"
+End
Index: lib/doc/Customization.lyx
===================================================================
--- lib/doc/Customization.lyx (révision 19595)
+++ lib/doc/Customization.lyx (copie de travail)
@@ -1,5 +1,5 @@
-#LyX 1.5.0svn created this file. For more info see http://www.lyx.org/
-\lyxformat 276
+#LyX 1.6.0svn created this file. For more info see http://www.lyx.org/
+\lyxformat 278
\begin_document
\begin_header
\textclass book
@@ -39,10 +39,8 @@
\paperpagestyle headings
\tracking_changes false
\output_changes false
-\author ""
-\author ""
-\author ""
-\author ""
+\author ""
+\author ""
\end_header
\begin_body
@@ -7426,7 +7424,7 @@ Settings
LabelCounter
\family default
\series default
- is set, this string can be contain special formatting commands as explained
+ is set, this string can be contain the special formatting commands described
in Section\InsetSpace ~
\begin_inset LatexCommand ref
@@ -7435,6 +7433,34 @@ reference "sec:counter"
\end_inset
.
+ For the sake of backwards compatibility, the string
+\family typewriter
+@
+\emph on
+style-name
+\emph default
+@
+\family default
+ will be replaced by the expanded
+\family typewriter
+LabelString
+\family default
+ of style
+\family typewriter
+\emph on
+style-name
+\family default
+\emph default
+.
+ This feature is now obsolete and should be replaced by the mechanisms of
+ Section\InsetSpace ~
+
+\begin_inset LatexCommand ref
+reference "sec:counter"
+
+\end_inset
+
+.
\end_layout
\begin_layout Description
@@ -8459,9 +8485,7 @@ Input stdcounters.inc
\end_layout
\begin_layout Standard
-The definition of counters is presently a bit primitive in LyX, since many
- things are still hardcoded.
- The following two parameters can be used:
+The following parameters can be used:
\end_layout
\begin_layout Description
@@ -8483,7 +8507,7 @@ string
\begin_inset Quotes erd
\end_inset
-] The name of the counter
+] The name of the counter.
\end_layout
\begin_layout Description
@@ -8506,48 +8530,75 @@ string
\end_inset
] If this is set to the name of another counter, the present counter will
- be reset everytime the other one is increased (is that unclear enough?).
-\end_layout
-
-\begin_layout Standard
-When a counter has been associated to a style, it is possible to use some
- special constructs in
+ be reset everytime the other one is increased.
+ For example,
\family typewriter
-LabelSt
+subsection
\family default
-r
+ is numbered inside
\family typewriter
-ing
+section
\family default
- and
+.
+\end_layout
+
+\begin_layout Description
+
+\family typewriter
+\series medium
+LabelString [string=""]
+\family default
+\series default
+ when this is defined, this string defines how the counter is displayed.
+ Setting this value resets
\family typewriter
LabelStringAppendix
\family default
-:
+ to the same value.
+ The following special constructs can be used in the string:
\end_layout
+\begin_deeper
\begin_layout Itemize
\family typewriter
-@
-\emph on
-style-name
-\emph default
-@
+
+\backslash
+thecounter
\family default
- will be replaced the expanded
+ will be replaced by the expansion of the
\family typewriter
LabelString
\family default
- of style
+ (or
\family typewriter
-\emph on
-style-name
+LabelStringAppendix
+\family default
+) of the counter
+\family typewriter
+counter
\family default
-\emph default
.
- This is used for example to define the label of a subsection in terms of
- the label of a section.
+ If these are empty, a default value is constructed as follows: if the counter
+ has a master counter
+\family typewriter
+master
+\family default
+, the string
+\family typewriter
+
+\backslash
+themaster.
+\backslash
+arabic{counter}
+\family default
+ is used; otherwise the string
+\family typewriter
+
+\backslash
+arabic{counter}
+\family default
+ is used.
\end_layout
\begin_layout Itemize
@@ -8684,6 +8735,21 @@ hebrew
\end_layout
\end_deeper
+\end_deeper
+\begin_layout Description
+
+\family typewriter
+\series medium
+LabelStringAppendix [string=""]
+\family default
+\series default
+ the same as
+\family typewriter
+LabelString
+\family default
+, for use in appendix.
+\end_layout
+
\begin_layout Subsection
Font description
\end_layout