Le 12/12/2015 16:38, Richard Heck a écrit :
On 12/12/2015 02:54 AM, Georg Baum wrote:
I would not store the translated result in TextClass. This makes it too easy
to use it incorrectly, for example if something is displayed in the work
area it should be translated using the buffer language. In general
translateIfPossible() is the correct funtion to use, but I'd call it when
the outliner data is collected.

Ok, I move it to TocBackend.


I'll guess that there may also be a need at some point to compare this
string to some other one, and we don't want to compare translated
strings.

I am not sure, as we already have the toc type for that.

We also might want to use it for output purposes, e.g., in
plaintext or XHTML, and then we might need a different translation, or
none. So I agree with Georg: Just store the raw string here, and
translate it when a translation is needed.

Ok.



  +               case LT_ADDTOTOC:
  +                       lex >> toc_type_;
  +                       if (toc_type_ != "0" && toc_type_ != "false")
  +                               add_to_toc_ = true;
  +                       break;
This looks fragile. If you want to make it possible to switch off
add_to_toc_ even if it has been set before, then the else branch is missing.

Yes, thanks for catching that.

If you do not want to make this possible, then I don't see the need for this
special treatment and would always set add_to_toc_ to true. If somebody does
not want to have a toc entry then he simply should not write a toc type in
his layout. The special code is mixing namespaces btw, it would not be
possible to create a to type "false".

We do need something like this. It should be possible to include some
layout code that activates a TOC for some inset, and then later override
that.

As Richard said.

But it is probably better to use an empty string, as we do
elsewhere.

Yes, good idea.

So then we could have:
     add_to_toc_ = !toc_type_.empty();


The attached patches take these comments into account. OK to push?


Guillaume
>From b615e0c6a2da03173ddd75a89c13ee086a738ec6 Mon Sep 17 00:00:00 2001
From: Guillaume Munch <g...@lyx.org>
Date: Tue, 3 Nov 2015 11:47:25 -0500
Subject: [PATCH 1/2] Layout format update: AddToToc, IsTocCaption,
 OutlinerName

Preliminary work for addressing #7790. Thanks to Richard for providing initial
files this is based on.

Adding to TextClass:
    OutlinerName <string> <string>
    (the second string is translated)
e.g.:
    OutlinerName thm "Definitions & Theorems"

Adding to Layout:
    AddToToc <string>     (default "", means no)
    IsTocCaption <bool>   (default 0)
e.g.:
    AddToToc thm
    IsTocCaption 1

Adding to InsetLayout:
    AddToToc <string>     (default "", means no)
    IsTocCaption <bool>   (default 0)
e.g.:
    AddToToc literate

Adding to inset arguments:
    IsTocCaption <bool>   (default 0)
---
 lib/scripts/layout2layout.py | 11 ++++++++++-
 po/lyx_pot.py                |  7 +++++++
 src/Layout.cpp               | 19 +++++++++++++++++++
 src/Layout.h                 | 14 ++++++++++++++
 src/TextClass.cpp            | 43 +++++++++++++++++++++++++++++++++++++++++--
 src/TextClass.h              |  6 ++++++
 src/TocBackend.cpp           |  8 ++++++++
 src/TocBackend.h             |  2 ++
 src/insets/InsetLayout.cpp   | 17 ++++++++++++++++-
 src/insets/InsetLayout.h     | 12 ++++++++++++
 10 files changed, 135 insertions(+), 4 deletions(-)

diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py
index 48a1e03..a87c300 100644
--- a/lib/scripts/layout2layout.py
+++ b/lib/scripts/layout2layout.py
@@ -193,6 +193,11 @@ import os, re, string, sys
 # New Layout tag "ProvideStyle"
 # Change "IfStyle" to "ModifyStyle"
 
+# Incremented to format 59, 22 November 2015 by gm
+# New Tag "OutlinerName"
+# New Layout tags "AddToToc", "IsTocCaption"
+# New Layout argument tag "IsTocCaption"
+
 # Do not forget to document format change in Customization
 # Manual (section "Declaring a new text class").
 
@@ -200,7 +205,7 @@ import os, re, string, sys
 # development/tools/updatelayouts.py script to update all
 # layout files to the new format.
 
-currentFormat = 58
+currentFormat = 59
 
 
 def usage(prog_name):
@@ -425,6 +430,10 @@ def convert(lines):
                 i += 1
             continue
 
+        if format == 58:
+            # nothing to do.
+            i += 1
+            continue
 
         if format == 57:
             match = re_IfStyle.match(lines[i])
diff --git a/po/lyx_pot.py b/po/lyx_pot.py
index c92939c..432a126 100755
--- a/po/lyx_pot.py
+++ b/po/lyx_pot.py
@@ -84,6 +84,7 @@ def layouts_l10n(input_files, output, base, layouttranslations):
     # match LabelString, EndLabelString, LabelStringAppendix and maybe others but no comments
     LabelString = re.compile(r'^[^#]*LabelString\S*\s+(.*\S)\s*$', re.IGNORECASE)
     MenuString = re.compile(r'^[^#]*MenuString\S*\s+(.*\S)\s*$', re.IGNORECASE)
+    OutlinerName = re.compile(r'^[^#]*OutlinerName\s+(\S+|\"[^\"]*\")\s+(\S+|\"[^\"]*\")\s*$', re.IGNORECASE)
     Tooltip = re.compile(r'^\s*Tooltip\S*\s+(.*\S)\s*$', re.IGNORECASE)
     GuiName = re.compile(r'^\s*GuiName\s+(.*\S)\s*$', re.IGNORECASE)
     ListName = re.compile(r'^\s*ListName\s+(.*\S)\s*$', re.IGNORECASE)
@@ -250,6 +251,12 @@ def layouts_l10n(input_files, output, base, layouttranslations):
                 if not layouttranslations:
                     writeString(out, src, base, lineno, string)
                 continue
+            res = OutlinerName.search(line)
+            if res != None:
+                string = res.group(2)
+                if not layouttranslations:
+                    writeString(out, src, base, lineno, string)
+                continue
             res = Tooltip.search(line)
             if res != None:
                 string = res.group(1)
diff --git a/src/Layout.cpp b/src/Layout.cpp
index 0fdb341..db8c317 100644
--- a/src/Layout.cpp
+++ b/src/Layout.cpp
@@ -108,12 +108,15 @@ enum LayoutTags {
 	LT_RIGHTDELIM,
 	LT_FORCELOCAL,
 	LT_TOGGLE_INDENT,
+	LT_ADDTOTOC,
+	LT_ISTOCCAPTION,
 	LT_INTITLE // keep this last!
 };
 
 /////////////////////
 
 Layout::Layout()
+	: add_to_toc_(false), is_toc_caption_(false)
 {
 	unknown_ = false;
 	margintype = MARGIN_STATIC;
@@ -180,6 +183,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
 {
 	// This table is sorted alphabetically [asierra 30March96]
 	LexerKeyword layoutTags[] = {
+		{ "addtotoc",       LT_ADDTOTOC },
 		{ "align",          LT_ALIGN },
 		{ "alignpossible",  LT_ALIGNPOSSIBLE },
 		{ "argument",       LT_ARGUMENT },
@@ -209,6 +213,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
 		{ "innertag",       LT_INNERTAG },
 		{ "inpreamble",     LT_INPREAMBLE },
 		{ "intitle",        LT_INTITLE },
+		{ "istoccaption",   LT_ISTOCCAPTION },
 		{ "itemcommand",    LT_ITEMCOMMAND },
 		{ "itemsep",        LT_ITEMSEP },
 		{ "itemtag",        LT_ITEMTAG },
@@ -638,6 +643,16 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
 		case LT_FORCELOCAL:
 			lex >> forcelocal;
 			break;
+
+		case LT_ADDTOTOC:
+			lex >> toc_type_;
+			add_to_toc_ = !toc_type_.empty();
+			break;
+
+		case LT_ISTOCCAPTION:
+			lex >> is_toc_caption_;
+			break;
+
 		}
 	}
 	lex.popTable();
@@ -951,6 +966,7 @@ void Layout::readArgument(Lexer & lex)
 	bool finished = false;
 	arg.font = inherit_font;
 	arg.labelfont = inherit_font;
+	arg.is_toc_caption = false;
 	string id;
 	lex >> id;
 	bool const itemarg = prefixIs(id, "item:");
@@ -1011,6 +1027,9 @@ void Layout::readArgument(Lexer & lex)
 		} else if (tok == "passthruchars") {
 			lex.next();
 			arg.pass_thru_chars = lex.getDocString();
+		} else if (tok == "istoccaption") {
+			lex.next();
+			arg.is_toc_caption = lex.getBool();
 		} else {
 			lex.printError("Unknown tag");
 			error = true;
diff --git a/src/Layout.h b/src/Layout.h
index 091e319..273a361 100644
--- a/src/Layout.h
+++ b/src/Layout.h
@@ -106,6 +106,7 @@ public:
 		bool autoinsert;
 		bool insertcotext;
 		docstring pass_thru_chars;
+		bool is_toc_caption;
 	};
 	///
 	typedef std::map<std::string, latexarg> LaTeXArgMap;
@@ -203,6 +204,12 @@ public:
 			|| labeltype == LABEL_CENTERED
 		  || labeltype == LABEL_BIBLIO;
 	}
+	///
+	bool addToToc() const { return add_to_toc_; }
+	///
+	std::string tocType() const { return toc_type_; }
+	///
+	bool isTocCaption() const { return is_toc_caption_; }
 
 	///
 	bool operator==(Layout const &) const;
@@ -459,8 +466,15 @@ private:
 	LaTeXArgMap postcommandargs_;
 	///
 	LaTeXArgMap itemargs_;
+	///
+	bool add_to_toc_;
+	///
+	std::string toc_type_;
+	///
+	bool is_toc_caption_;
 };
 
+
 } // namespace lyx
 
 #endif
diff --git a/src/TextClass.cpp b/src/TextClass.cpp
index 0ee74a7..c6f3ee0 100644
--- a/src/TextClass.cpp
+++ b/src/TextClass.cpp
@@ -61,7 +61,7 @@ namespace lyx {
 // You should also run the development/tools/updatelayouts.py script,
 // to update the format of all of our layout files.
 //
-int const LAYOUT_FORMAT = 58; // rgh: ProvideStyle
+int const LAYOUT_FORMAT = 59; //gm: OutlinerName, AddToToc, IsTocCaption
 
 namespace {
 
@@ -213,7 +213,8 @@ enum TextClassTags {
 	TC_CITEENGINETYPE,
 	TC_CITEFORMAT,
 	TC_DEFAULTBIBLIO,
-	TC_FULLAUTHORLIST
+	TC_FULLAUTHORLIST,
+	TC_OUTLINERNAME
 };
 
 
@@ -249,6 +250,7 @@ LexerKeyword textClassTags[] = {
 	{ "nofloat",           TC_NOFLOAT },
 	{ "noinsetlayout",     TC_NOINSETLAYOUT },
 	{ "nostyle",           TC_NOSTYLE },
+	{ "outlinername",      TC_OUTLINERNAME },
 	{ "outputformat",      TC_OUTPUTFORMAT },
 	{ "outputtype",        TC_OUTPUTTYPE },
 	{ "packageoptions",    TC_PKGOPTS },
@@ -801,6 +803,10 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt)
 				floatlist_.erase(nofloat);
 			}
 			break;
+
+		case TC_OUTLINERNAME:
+			error = !readOutlinerName(lexrc);
+			break;
 		} // end of switch
 
 		// Note that this is triggered the first time through the loop unless
@@ -1295,6 +1301,39 @@ bool TextClass::readFloat(Lexer & lexrc)
 }
 
 
+bool TextClass::readOutlinerName(Lexer & lexrc)
+{
+	std::string type;
+	docstring name;
+	if (lexrc.next())
+		type = lexrc.getString();
+	else {
+		lexrc.printError("No type given for OutlinerName: `$$Token'.");
+		return false;
+	}
+	if (lexrc.next())
+		name = lexrc.getDocString();
+	else {
+		lexrc.printError("No name given for OutlinerName: `$$Token'.");
+		return false;
+	}
+	outliner_names_[type] = name;
+    return true;
+}
+
+
+docstring TextClass::outlinerName(std::string const & type) const
+{
+	std::map<std::string,docstring>::const_iterator const it
+		= outliner_names_.find(type);
+	if (it == outliner_names_.end()) {
+		LYXERR0("Missing OutlinerName for " << type << "!");
+		return from_utf8(type);
+	} else
+		return it->second;
+}
+
+
 string const & TextClass::prerequisites(string const & sep) const
 {
 	if (contains(prerequisites_, ',')) {
diff --git a/src/TextClass.h b/src/TextClass.h
index 0a075dd..94fe003 100644
--- a/src/TextClass.h
+++ b/src/TextClass.h
@@ -199,6 +199,8 @@ public:
 	OutputType outputType() const { return outputType_; }
 	/// Can be latex, docbook ... (the name of a format)
 	std::string outputFormat() const { return outputFormat_; }
+	///
+	docstring outlinerName(std::string const & type) const;
 protected:
 	/// Protect construction
 	TextClass();
@@ -327,6 +329,8 @@ protected:
 	bool cite_full_author_list_;
 	/// The possible citation styles
 	std::map<CiteEngineType, std::vector<CitationStyle> > cite_styles_;
+	///
+	std::map<std::string, docstring> outliner_names_;
 private:
 	///////////////////////////////////////////////////////////////////
 	// helper routines for reading layout files
@@ -359,6 +363,8 @@ private:
 	int readCiteEngineType(Lexer &) const;
 	///
 	bool readCiteFormat(Lexer &);
+	///
+	bool readOutlinerName(Lexer &);
 };
 
 
diff --git a/src/TocBackend.cpp b/src/TocBackend.cpp
index e47ca9b..e325788 100644
--- a/src/TocBackend.cpp
+++ b/src/TocBackend.cpp
@@ -31,6 +31,7 @@
 #include "support/convert.h"
 #include "support/debug.h"
 #include "support/docstream.h"
+#include "support/gettext.h"
 #include "support/lassert.h"
 #include "support/lstrings.h"
 
@@ -358,4 +359,11 @@ void TocBackend::writePlaintextTocList(string const & type,
 }
 
 
+docstring TocBackend::outlinerName(std::string const & type) const
+{
+	return translateIfPossible(
+	    buffer_->params().documentClass().outlinerName(type));
+}
+
+
 } // namespace lyx
diff --git a/src/TocBackend.h b/src/TocBackend.h
index e18f1bc..d5dfae4 100644
--- a/src/TocBackend.h
+++ b/src/TocBackend.h
@@ -221,6 +221,8 @@ public:
 	///
 	void writePlaintextTocList(std::string const & type,
 	        odocstringstream & os, size_t max_length) const;
+	///
+	docstring outlinerName(std::string const & type) const;
 
 private:
 	///
diff --git a/src/insets/InsetLayout.cpp b/src/insets/InsetLayout.cpp
index 9e03fcb..7291a60 100644
--- a/src/insets/InsetLayout.cpp
+++ b/src/insets/InsetLayout.cpp
@@ -44,7 +44,7 @@ InsetLayout::InsetLayout() :
 	freespacing_(false), keepempty_(false), forceltr_(false),
 	forceownlines_(false), needprotect_(false), intoc_(false),
 	spellcheck_(true), resetsfont_(false), display_(true),
-	forcelocalfontswitch_(false)
+	forcelocalfontswitch_(false), add_to_toc_(false), is_toc_caption_(false)
 {
 	labelfont_.setColor(Color_error);
 }
@@ -80,6 +80,7 @@ InsetLayout::InsetLaTeXType translateLaTeXType(std::string const & str)
 bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
 {
 	enum {
+		IL_ADDTOTOC,
 		IL_ARGUMENT,
 		IL_BABELPREAMBLE,
 		IL_BGCOLOR,
@@ -106,6 +107,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
 		IL_HTMLSTYLE,
 		IL_HTMLPREAMBLE,
 		IL_INTOC,
+		IL_ISTOCCAPTION,
 		IL_LABELFONT,
 		IL_LABELSTRING,
 		IL_LANGPREAMBLE,
@@ -133,6 +135,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
 
 
 	LexerKeyword elementTags[] = {
+		{ "addtotoc", IL_ADDTOTOC },
 		{ "argument", IL_ARGUMENT },
 		{ "babelpreamble", IL_BABELPREAMBLE },
 		{ "bgcolor", IL_BGCOLOR },
@@ -160,6 +163,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
 		{ "htmlstyle", IL_HTMLSTYLE },
 		{ "htmltag", IL_HTMLTAG },
 		{ "intoc", IL_INTOC },
+		{ "istoccaption", IL_ISTOCCAPTION },
 		{ "keepempty", IL_KEEPEMPTY },
 		{ "labelfont", IL_LABELFONT },
 		{ "labelstring", IL_LABELSTRING },
@@ -454,6 +458,13 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
 		case IL_DISPLAY:
 			lex >> display_;
 			break;
+		case IL_ADDTOTOC:
+			lex >> toc_type_;
+			add_to_toc_ = !toc_type_.empty();
+			break;
+		case IL_ISTOCCAPTION:
+			lex >> is_toc_caption_;
+			break;
 		case IL_END:
 			getout = true;
 			break;
@@ -569,6 +580,7 @@ void InsetLayout::readArgument(Lexer & lex)
 	bool finished = false;
 	arg.font = inherit_font;
 	arg.labelfont = inherit_font;
+	arg.is_toc_caption = false;
 	string nr;
 	lex >> nr;
 	bool const postcmd = prefixIs(nr, "post:");
@@ -630,6 +642,9 @@ void InsetLayout::readArgument(Lexer & lex)
 		} else if (tok == "passthruchars") {
 			lex.next();
 			arg.pass_thru_chars = lex.getDocString();
+		} else if (tok == "istoccaption") {
+			lex.next();
+			arg.is_toc_caption = lex.getBool();
 		} else {
 			lex.printError("Unknown tag");
 			error = true;
diff --git a/src/insets/InsetLayout.h b/src/insets/InsetLayout.h
index 9589fad..c1bbe5c 100644
--- a/src/insets/InsetLayout.h
+++ b/src/insets/InsetLayout.h
@@ -181,6 +181,12 @@ public:
 	bool forcelocalfontswitch() const { return forcelocalfontswitch_; }
 	///
 	docstring const & obsoleted_by() const { return obsoleted_by_; }
+	///
+	bool addToToc() const { return add_to_toc_; }
+	///
+	std::string tocType() const { return toc_type_; }
+	///
+	bool isTocCaption() const { return is_toc_caption_; }
 private:
 	///
 	void makeDefaultCSS() const;
@@ -296,6 +302,12 @@ private:
 	Layout::LaTeXArgMap latexargs_;
 	///
 	Layout::LaTeXArgMap postcommandargs_;
+	///
+	bool add_to_toc_;
+	///
+	std::string toc_type_;
+	///
+	bool is_toc_caption_;
 };
 
 ///
-- 
2.1.4

>From f68e64de5a4c5bccd2ec418737256d1fe9924e3d Mon Sep 17 00:00:00 2001
From: Guillaume Munch <g...@lyx.org>
Date: Wed, 18 Nov 2015 01:35:14 +0000
Subject: [PATCH 2/2] Set AddToToc for custom insets

* Fixme
* Todonotes
* Literate programming (sweave, knitr)
* Theorems
---
 lib/layouts/fixme.module                  |  9 ++++++++-
 lib/layouts/litinsets.inc                 |  7 ++++++-
 lib/layouts/theorems-ams-bytype.inc       |  7 ++++++-
 lib/layouts/theorems-ams.inc              | 21 +++++++++++++--------
 lib/layouts/theorems-starred.inc          |  7 ++++++-
 lib/layouts/theorems-without-preamble.inc |  9 ++++++++-
 lib/layouts/theorems.inc                  | 21 +++++++++++++--------
 lib/layouts/todonotes.module              |  6 +++++-
 8 files changed, 65 insertions(+), 22 deletions(-)

diff --git a/lib/layouts/fixme.module b/lib/layouts/fixme.module
index 73eb1c1..9f91cc4 100644
--- a/lib/layouts/fixme.module
+++ b/lib/layouts/fixme.module
@@ -12,7 +12,9 @@
 # Authors: Mark Edgington <edgi...@gmail.com>
 #          Jürgen Spitzmüller <sp...@lyx.org>
 
-Format 58
+Format 59
+
+OutlinerName fixme "Fixme"
 
 #
 # List of FIXMEs
@@ -59,6 +61,8 @@ InsetLayout Flex:Fixme_Note
           Size                Small
         EndFont
         MultiPar              false
+        AddToToc              fixme
+        IsTocCaption          1
         Argument 1
           LabelString         "Options"
           MenuString          "Fixme Note Options|s"
@@ -103,6 +107,7 @@ InsetLayout Flex:Fixme_Note_(Targeted)
           LabelString         "Note"
           Mandatory            1
           MenuString          "Fixme Note|x"
+          IsTocCaption        1
           Tooltip             "Insert the FIXME note here"
           AutoInsert          1
         EndArgument
@@ -144,6 +149,7 @@ InsetLayout Flex:Fixme_Note_(Multipar)
         Argument 2
           LabelString         "Summary"
           Mandatory            1
+          IsTocCaption        1
           MenuString          "Fixme Summary"
           Tooltip             "Insert a summary of the FIXME note here"
           AutoInsert          1
@@ -184,6 +190,7 @@ InsetLayout Flex:Fixme_Note_(Multipar_Targeted)
         EndArgument
         Argument 2
           LabelString         "Summary"
+          IsTocCaption        1
           Mandatory            1
           MenuString          "Fixme Summary"
           Tooltip             "Insert a summary of the FIXME note here"
diff --git a/lib/layouts/litinsets.inc b/lib/layouts/litinsets.inc
index b781650..259c986 100644
--- a/lib/layouts/litinsets.inc
+++ b/lib/layouts/litinsets.inc
@@ -6,12 +6,14 @@
 # Note that this file is included in sweave.module,
 # knitr.module and noweb.module.
 
-Format 58
+Format 59
 
 Counter chunk
     PrettyFormat "Chunk ##"
 End
 
+OutlinerName literate "Literate programming"
+
 InsetLayout "Flex:Chunk"
     LabelString          "Chunk"
     LatexType            none
@@ -36,12 +38,15 @@ InsetLayout "Flex:Chunk"
     Spellcheck            0
     FreeSpacing           true
     ForceLTR              true
+    AddToToc              literate
+    IsTocCaption          0
     Argument 1
             Mandatory     1
             LabelString   "Options"
             Tooltip       "Options"
             LeftDelim     <<
             RightDelim    >>=<br/>
+			IsTocCaption  1
     EndArgument
     ResetsFont            false
     ForceOwnlines         true
diff --git a/lib/layouts/theorems-ams-bytype.inc b/lib/layouts/theorems-ams-bytype.inc
index 6e94ac3..5ba3156 100644
--- a/lib/layouts/theorems-ams-bytype.inc
+++ b/lib/layouts/theorems-ams-bytype.inc
@@ -22,7 +22,7 @@
 # - Case (by inclusion)
 
 # We need separate counters for each theorem-like style.
-Format 58
+Format 59
 Counter theorem
 End
 Counter corollary
@@ -50,6 +50,8 @@ End
 Counter claim
 End
 
+OutlinerName thm "Definitions & Theorems"
+
 Style Theorem
 	Category              Reasoning
 	Margin                First_Dynamic
@@ -57,9 +59,12 @@ Style Theorem
 	LatexName             thm
 	NextNoIndent          1
 	ResetArgs             1
+	AddToToc              thm
+	IsTocCaption          1
 	Argument 1
 		LabelString    "Additional Theorem Text"
 		Tooltip        "Additional text appended to the theorem header"
+		IsTocCaption      1
 	EndArgument
 	LabelSep              xx
 	ParIndent             MMM
diff --git a/lib/layouts/theorems-ams.inc b/lib/layouts/theorems-ams.inc
index 01a2d77..fa05b49 100644
--- a/lib/layouts/theorems-ams.inc
+++ b/lib/layouts/theorems-ams.inc
@@ -20,7 +20,9 @@
 # - Proof
 # - Case (by inclusion)
 
-Format 58
+Format 59
+
+OutlinerName thm "Definitions & Theorems"
 
 Style Theorem
 	Category              Reasoning
@@ -29,9 +31,12 @@ Style Theorem
 	LatexName             thm
 	NextNoIndent          1
 	ResetArgs             1
+	AddToToc              thm
+	IsTocCaption          1
 	Argument 1
 		LabelString    "Additional Theorem Text"
 		Tooltip        "Additional text appended to the theorem header"
+		IsTocCaption      1
 	EndArgument
 	LabelSep              xx
 	ParIndent             MMM
@@ -69,7 +74,7 @@ End
 
 Style Corollary
 	CopyStyle             Theorem
-	DependsOn	      Theorem
+	DependsOn             Theorem
 	LatexName             cor
 	LabelString           "Corollary \thetheorem."
 	Preamble
@@ -87,7 +92,7 @@ End
 
 Style Lemma
 	CopyStyle             Theorem
-	DependsOn	      Theorem
+	DependsOn             Theorem
 	LatexName             lem
 	LabelString           "Lemma \thetheorem."
 	Preamble
@@ -105,7 +110,7 @@ End
 
 Style Proposition
 	CopyStyle             Theorem
-	DependsOn	      Theorem
+	DependsOn             Theorem
 	LatexName             prop
 	LabelString           "Proposition \thetheorem."
 	Preamble
@@ -123,7 +128,7 @@ End
 
 Style Conjecture
 	CopyStyle             Theorem
-	DependsOn	      Theorem
+	DependsOn             Theorem
 	LatexName             conjecture
 	LabelString           "Conjecture \thetheorem."
 	Preamble
@@ -141,7 +146,7 @@ End
 
 Style Fact
 	CopyStyle             Theorem
-	DependsOn	      Theorem
+	DependsOn             Theorem
 	LatexName             fact
 	LabelString           "Fact \thetheorem."
 	Preamble
@@ -159,7 +164,7 @@ End
 
 Style Definition
 	CopyStyle             Theorem
-	DependsOn	      Theorem
+	DependsOn             Theorem
 	LatexName             defn
 	LabelString           "Definition \thetheorem."
 	Font
@@ -252,7 +257,7 @@ End
 
 Style Remark
 	CopyStyle             Theorem
-	DependsOn	      Theorem
+	DependsOn             Theorem
 	LatexName             rem
 	LabelString           "Remark \thetheorem."
 	Font
diff --git a/lib/layouts/theorems-starred.inc b/lib/layouts/theorems-starred.inc
index e45af63..e2a7aa7 100644
--- a/lib/layouts/theorems-starred.inc
+++ b/lib/layouts/theorems-starred.inc
@@ -19,7 +19,9 @@
 # - Claim
 # - Proof
 
-Format 58
+Format 59
+
+OutlinerName thm "Definitions & Theorems"
 
 Style Theorem*
 	Category              Reasoning
@@ -30,9 +32,12 @@ Style Theorem*
 	LabelString           "Theorem."
 	NextNoIndent          1
 	ResetArgs             1
+	AddToToc              thm
+	IsTocCaption          1
 	Argument 1
 		LabelString    "Additional Theorem Text"
 		Tooltip        "Additional text appended to the theorem header"
+		IsTocCaption      1
 	EndArgument
 	LabelSep              xx
 	ParIndent             MMM
diff --git a/lib/layouts/theorems-without-preamble.inc b/lib/layouts/theorems-without-preamble.inc
index 9e6931e..c6d8f6c 100644
--- a/lib/layouts/theorems-without-preamble.inc
+++ b/lib/layouts/theorems-without-preamble.inc
@@ -26,8 +26,9 @@
 # - Note
 
 
-Format 58
+Format 59
 
+OutlinerName thm "Definitions & Theorems"
 
 Counter		theorem
 End
@@ -37,9 +38,12 @@ Style Theorem
 	LatexType	Environment
 	LatexName	theorem
 	NextNoIndent	1
+	AddToToc              thm
+	IsTocCaption          1
 	Argument 1
 	  LabelString	"Name/Title"
 	  Tooltip	"Alternative optional name or title"
+	  IsTocCaption      1
 	EndArgument
 	LabelSep	xx
 	ParIndent	MMM
@@ -259,6 +263,8 @@ Style Prob
 	LabelFont
 	  Series	Bold
 	EndFont
+	AddToToc	thm
+	IsTocCaption	true
 End
 
 
@@ -288,6 +294,7 @@ Style Sol
 	  Mandatory	1
 	  LabelString	"Label of Problem"
 	  Tooltip	"Label of the corresponding problem"
+	  InToc
 	EndArgument
 End
 
diff --git a/lib/layouts/theorems.inc b/lib/layouts/theorems.inc
index e3cb13e..1034a05 100644
--- a/lib/layouts/theorems.inc
+++ b/lib/layouts/theorems.inc
@@ -20,7 +20,9 @@
 # - Claim
 # - Case (by inclusion)
 
-Format 58
+Format 59
+
+OutlinerName thm "Definitions & Theorems"
 
 Style Theorem
 	Category              Reasoning
@@ -29,9 +31,12 @@ Style Theorem
 	LatexName             thm
 	NextNoIndent          1
 	ResetArgs             1
+	AddToToc              thm
+	IsTocCaption          1
 	Argument 1
 		LabelString    "Additional Theorem Text"
 		Tooltip        "Additional text appended to the theorem header"
+		IsTocCaption      1
 	EndArgument
 	LabelSep              xx
 	ParIndent             MMM
@@ -69,7 +74,7 @@ End
 
 Style Corollary
 	CopyStyle             Theorem
-	DependsOn	      Theorem
+	DependsOn             Theorem
 	LatexName             cor
 	LabelString           "Corollary \thetheorem."
 	Preamble
@@ -87,7 +92,7 @@ End
 
 Style Lemma
 	CopyStyle             Theorem
-	DependsOn	      Theorem
+	DependsOn             Theorem
 	LatexName             lem
 	LabelString           "Lemma \thetheorem."
 	Preamble
@@ -105,7 +110,7 @@ End
 
 Style Proposition
 	CopyStyle             Theorem
-	DependsOn	      Theorem
+	DependsOn             Theorem
 	LatexName             prop
 	LabelString           "Proposition \thetheorem."
 	Preamble
@@ -123,7 +128,7 @@ End
 
 Style Conjecture
 	CopyStyle             Theorem
-	DependsOn	      Theorem
+	DependsOn             Theorem
 	LatexName             conjecture
 	LabelString           "Conjecture \thetheorem."
 	Preamble
@@ -141,7 +146,7 @@ End
 
 Style Fact
 	CopyStyle             Theorem
-	DependsOn	      Theorem
+	DependsOn             Theorem
 	LatexName             fact
 	LabelString           "Fact \thetheorem."
 	Preamble
@@ -159,7 +164,7 @@ End
 
 Style Definition
 	CopyStyle             Theorem
-	DependsOn	      Theorem
+	DependsOn             Theorem
 	LatexName             defn
 	LabelString           "Definition \thetheorem."
 	Font
@@ -252,7 +257,7 @@ End
 
 Style Remark
 	CopyStyle             Theorem
-	DependsOn	      Theorem
+	DependsOn             Theorem
 	LatexName             rem
 	LabelString           "Remark \thetheorem."
 	Font
diff --git a/lib/layouts/todonotes.module b/lib/layouts/todonotes.module
index 0787882..f1bc731 100644
--- a/lib/layouts/todonotes.module
+++ b/lib/layouts/todonotes.module
@@ -8,7 +8,9 @@
 # Authors: Stephen <stephen4mailingli...@googlemail.com>
 #          Jürgen Spitzmüller <sp...@lyx.org>
 
-Format 58
+Format 59
+
+OutlinerName todonotes "TODO"
 
 #
 # List of TODOs
@@ -67,6 +69,8 @@ InsetLayout Flex:TODO_Note_(Margin)
 	MultiPar	true
 	LatexType	command
 	LatexName	todo
+	AddToToc      todonotes
+	IsTocCaption  1
 	Argument 1
 		LabelString	"Options"
 		MenuString	"TODO Note Options|s"
-- 
2.1.4

Reply via email to