File format change.
-----------------------
+2015-01-09 Jürgen Spitzmüller <spitz@lyx.org>
+ * Format incremented to 480:
+ Add self-defined Question* and Question lemma types to
+ theorems-ams-extended-bytype module.
+
2014-08-31 Jürgen Spitzmüller <spitz@lyx.org>
* Format incremented to 479
Support for beamer lemma environment.
# - Acknowledgement
# - Conclusion
# - Assumption
+# - Question
# We need separate counters for each theorem-like style.
Counter criterion
End
Counter assumption
End
+Counter question
+End
Style Criterion
EndBabelPreamble
End
+Style Question
+ CopyStyle Theorem
+ DependsOn Theorem
+ LatexName question
+ LabelString "Question \thequestion."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem{question}{\protect\questionname}
+ EndPreamble
+ LangPreamble
+ \providecommand{\questionname}{_(Question)}
+ EndLangPreamble
+ BabelPreamble
+ \addto\captions$$lang{\renewcommand{\questionname}{_(Question)}}
+ EndBabelPreamble
+ LabelCounter question
+End
+
+Style Question*
+ CopyStyle Theorem*
+ LatexName question*
+ LabelString "Question."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem*{question*}{\protect\questionname}
+ EndPreamble
+ LangPreamble
+ \providecommand{\questionname}{_(Question)}
+ EndLangPreamble
+ BabelPreamble
+ \addto\captions$$lang{\renewcommand{\questionname}{_(Question)}}
+ EndBabelPreamble
+End
+
Input theorems-refprefix.inc
IfStyle Assumption
RefPrefix assu
End
+
+
+IfStyle Question
+ RefPrefix que
+End
("1_6", range(277,346), minor_versions("1.6" , 10)),
("2_0", range(346,414), minor_versions("2.0", 8)),
("2_1", range(414,475), minor_versions("2.1", 0)),
- ("2_2", range(475,480), minor_versions("2.2", 0))
+ ("2_2", range(475,481), minor_versions("2.2", 0))
]
####################################################################
i = j
+
+
+def revert_question_env(document):
+ """
+ Reverts question and question* environments of
+ theorems-ams-extended-bytype module to ERT
+ """
+
+ # Do we use theorems-ams-extended-bytype module?
+ have_mod = False
+ mods = document.get_module_list()
+ for mod in mods:
+ if mod == "theorems-ams-extended-bytype":
+ have_mod = True
+ continue
+
+ if not have_mod:
+ return
+
+ consecutive = False
+ i = 0
+ while True:
+ i = find_token(document.body, "\\begin_layout Question", i)
+ if i == -1:
+ return
+
+ starred = document.body[i] == "\\begin_layout Question*"
+
+ j = find_end_of_layout(document.body, i)
+ if j == -1:
+ document.warning("Malformed LyX document: Can't find end of Question layout")
+ i += 1
+ continue
+
+ # if this is not a consecutive env, add start command
+ begcmd = []
+ if not consecutive:
+ if starred:
+ begcmd = put_cmd_in_ert("\\begin{question*}")
+ else:
+ begcmd = put_cmd_in_ert("\\begin{question}")
+
+ # has this a consecutive theorem of same type?
+ consecutive = False
+ if starred:
+ consecutive = document.body[j + 2] == "\\begin_layout Question*"
+ else:
+ consecutive = document.body[j + 2] == "\\begin_layout Question"
+
+ # if this is not followed by a consecutive env, add end command
+ if not consecutive:
+ if starred:
+ document.body[j : j + 1] = put_cmd_in_ert("\\end{question*}") + ["\\end_layout"]
+ else:
+ document.body[j : j + 1] = put_cmd_in_ert("\\end{question}") + ["\\end_layout"]
+
+ document.body[i : i + 1] = ["\\begin_layout Standard", ""] + begcmd
+
+ add_to_preamble(document, "\\providecommand{\questionname}{Question}")
+
+ if starred:
+ add_to_preamble(document, "\\theoremstyle{plain}\n" \
+ "\\newtheorem*{question*}{\\protect\\questionname}")
+ else:
+ add_to_preamble(document, "\\theoremstyle{plain}\n" \
+ "\\newtheorem{question}{\\protect\\questionname}")
+
+ i = j
+
##
# Conversion hub
[476, []],
[477, []],
[478, []],
- [479, []]
+ [479, []],
+ [480, []]
]
revert = [
+ [479, [revert_question_env]],
[478, [revert_beamer_lemma]],
[477, [revert_xarrow]],
[476, [revert_swissgerman]],
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
-#define LYX_FORMAT_LYX 479 // spitz: beamer Lemma layout
-#define LYX_FORMAT_TEX2LYX 479
+#define LYX_FORMAT_LYX 480 // spitz: question and question* environments
+#define LYX_FORMAT_TEX2LYX 480
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER