Better fix for bug 1476 (following an idea by Jean-Marc).

Don't go into an endless loop if layout2layout cannot produce the desired file format.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28529 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2009-02-17 20:25:56 +00:00
parent ce09b10450
commit 9aad4bc27f
17 changed files with 771 additions and 166 deletions

View File

@ -108,9 +108,9 @@ End
\papercolumns 1 \papercolumns 1
\papersides 2 \papersides 2
\paperpagestyle headings \paperpagestyle headings
\tracking_changes false \tracking_changes true
\output_changes false \output_changes false
\author "" \author "Georg Baum,,,"
\author "" \author ""
\end_header \end_header
@ -6881,7 +6881,23 @@ int
] This tag was introduced with LyX 1.4.0 (layout files of LyX 1.3.x and earlier ] This tag was introduced with LyX 1.4.0 (layout files of LyX 1.3.x and earlier
don't have an explicit file format). don't have an explicit file format).
The file format that is documented here is format 12. The file format that is documented here is format 1
\change_deleted 0 1234611237
2
\change_inserted 0 1234611237
4
\change_unchanged
.
\change_inserted 0 1234613411
\end_layout
\begin_layout Description
\change_inserted 0 1234613417
FIXME: Format 13 is missing!
\change_unchanged
\end_layout \end_layout
\begin_layout Subsection \begin_layout Subsection
@ -8906,7 +8922,13 @@ FreeSpacing
status collapsed status collapsed
\begin_layout Plain Layout \begin_layout Plain Layout
I18NPreamble
\change_inserted 0 1234613251
Babel
\change_deleted 0 1234611266
I18N
\change_unchanged
Preamble
\end_layout \end_layout
\end_inset \end_inset
@ -8918,7 +8940,13 @@ I18NPreamble
status collapsed status collapsed
\begin_layout Plain Layout \begin_layout Plain Layout
I18NPreamble
\change_inserted 0 1234613436
Babel
\change_deleted 0 1234611275
I18N
\change_unchanged
Preamble
\end_layout \end_layout
\end_inset \end_inset
@ -8933,7 +8961,13 @@ I18NPreamble
status collapsed status collapsed
\begin_layout Plain Layout \begin_layout Plain Layout
EndI18NPreamble End
\change_deleted 0 1234611280
I18N
\change_inserted 0 1234613262
Babel
\change_unchanged
Preamble
\end_layout \end_layout
\end_inset \end_inset
@ -8983,8 +9017,72 @@ _()
replaces its argument by the translation of the argument to the current replaces its argument by the translation of the argument to the current
language. language.
\change_inserted 0 1234611470
\end_layout \end_layout
\begin_layout Standard
\change_inserted 0 1234615134
This preamble snippet will only be used if the document contains more than
one language and the babel package is used.
\change_unchanged
\end_layout
\end_deeper
\begin_layout Description
\change_inserted 0 1234614203
\begin_inset Flex CharStyle:Code
status collapsed
\begin_layout Plain Layout
\change_inserted 0 1234614202
LangPreamble
\end_layout
\end_inset
Like
\begin_inset Flex CharStyle:Code
status collapsed
\begin_layout Plain Layout
\change_inserted 0 1234614202
BabelPreamble
\end_layout
\end_inset
, but this preamble snippet occurs independently from the babel package,
and only for the document language.
Must end with
\begin_inset Quotes eld
\end_inset
\begin_inset Flex CharStyle:Code
status collapsed
\begin_layout Plain Layout
\change_inserted 0 1234614202
EndLangPreamble
\end_layout
\end_inset
\begin_inset Quotes erd
\end_inset
.
\end_layout
\begin_deeper
\begin_layout Standard \begin_layout Standard
If the style defines text that appears in the typeset document, it may use If the style defines text that appears in the typeset document, it may use
@ -8992,12 +9090,38 @@ If the style defines text that appears in the typeset document, it may use
status collapsed status collapsed
\begin_layout Plain Layout \begin_layout Plain Layout
I18NPreamble
\change_inserted 0 1234611302
Lang
\change_deleted 0 1234611306
I18N
\change_unchanged
Preamble
\end_layout \end_layout
\end_inset \end_inset
to support non-english and even multilanguage documents correctly.
\change_inserted 0 1234611823
and
\change_unchanged
\change_inserted 0 1234611832
\begin_inset Flex CharStyle:Code
status collapsed
\begin_layout Plain Layout
\change_inserted 0 1234611838
BabelPreamble
\end_layout
\end_inset
\change_unchanged
to support non-english and even multilanguage documents correctly.
The following excerpt (from the The following excerpt (from the
\begin_inset Flex CharStyle:Code \begin_inset Flex CharStyle:Code
status collapsed status collapsed
@ -9017,6 +9141,8 @@ Preamble
\begin_layout LyX-Code \begin_layout LyX-Code
\change_deleted 0 1234612061
\backslash \backslash
providecommand{ providecommand{
\backslash \backslash
@ -9044,11 +9170,47 @@ EndPreamble
\end_layout \end_layout
\begin_layout LyX-Code \begin_layout LyX-Code
I18nPreamble
\change_inserted 0 1234612037
LangPreamble
\end_layout \end_layout
\begin_layout LyX-Code \begin_layout LyX-Code
\change_inserted 0 1234612045
\backslash
providecommand{
\backslash
claimname}{_(Claim)}
\end_layout
\begin_layout LyX-Code
\change_inserted 0 1234611897
\end_layout
\begin_layout LyX-Code
\change_inserted 0 1234612050
EndLangPreamble
\end_layout
\begin_layout LyX-Code
\change_inserted 0 1234611892
Babel
\change_deleted 0 1234611847
I18n
\change_unchanged
Preamble
\end_layout
\begin_layout LyX-Code
\change_deleted 0 1234612079
\backslash \backslash
AtBeginDocument{ AtBeginDocument{
\backslash \backslash
@ -9072,17 +9234,29 @@ captions$$lang{
\backslash \backslash
renewcommand{ renewcommand{
\backslash \backslash
claimname}{_(Claim)}}% claimname}{_(Claim)}}
\change_deleted 0 1234612086
%
\end_layout \end_layout
\begin_layout LyX-Code \begin_layout LyX-Code
\change_deleted 0 1234612089
\backslash \backslash
fi} fi}
\change_unchanged
\end_layout \end_layout
\begin_layout LyX-Code \begin_layout LyX-Code
EndI18nPreamble End
\change_inserted 0 1234611859
Babel
\change_deleted 0 1234611856
I18n
\change_unchanged
Preamble
\end_layout \end_layout
\begin_layout Standard \begin_layout Standard
@ -9099,14 +9273,26 @@ claimname
\end_inset \end_inset
in the standard preamble. in the
\change_inserted 0 1234612144
language
\change_deleted 0 1234612146
standard
\change_unchanged
preamble.
This command holds the name of the theorem that will appear in the output. This command holds the name of the theorem that will appear in the output.
The The
\begin_inset Flex CharStyle:Code \begin_inset Flex CharStyle:Code
status collapsed status collapsed
\begin_layout Plain Layout \begin_layout Plain Layout
I18NPreamble
\change_inserted 0 1234612157
Babel
\change_deleted 0 1234612155
I18N
\change_unchanged
Preamble
\end_layout \end_layout
\end_inset \end_inset
@ -9123,7 +9309,13 @@ claimname
\end_inset \end_inset
for each used language. for each used language
\change_inserted 0 1234622073
in multilanguage documents
\change_unchanged
.
\change_deleted 0 1234612171
The The
\begin_inset Flex CharStyle:Code \begin_inset Flex CharStyle:Code
status collapsed status collapsed
@ -9153,6 +9345,8 @@ AtBeginDocument
\end_inset \end_inset
. .
\change_unchanged
\end_layout \end_layout
\end_deeper \end_deeper

View File

@ -14,7 +14,7 @@
# Tinkered with Sep. '07 by Paul Rubin <rubin@msu.edu> # Tinkered with Sep. '07 by Paul Rubin <rubin@msu.edu>
# Modularized Jan 08 by Richard Heck <rgheck@comcast.net> # Modularized Jan 08 by Richard Heck <rgheck@comcast.net>
Format 11 Format 14
Requires amsmath Requires amsmath
@ -39,8 +39,14 @@ Style Criterion
LabelString "Criterion \thetheorem." LabelString "Criterion \thetheorem."
Preamble Preamble
\theoremstyle{plain} \theoremstyle{plain}
\newtheorem{criterion}[thm]{Criterion} \newtheorem{criterion}[thm]{\protect\criterionname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\criterionname}{_(Criterion)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\criterionname}{_(Criterion)}}
EndBabelPreamble
End End
Style Criterion* Style Criterion*
@ -49,8 +55,14 @@ Style Criterion*
LabelString "Criterion." LabelString "Criterion."
Preamble Preamble
\theoremstyle{plain} \theoremstyle{plain}
\newtheorem*{criterion*}{Criterion} \newtheorem*{criterion*}{\protect\criterionname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\criterionname}{_(Criterion)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\criterionname}{_(Criterion)}}
EndBabelPreamble
End End
@ -61,8 +73,14 @@ Style Algorithm
LabelString "Algorithm \thetheorem." LabelString "Algorithm \thetheorem."
Preamble Preamble
\theoremstyle{plain} \theoremstyle{plain}
\newtheorem{algorithm}[thm]{Algorithm} \newtheorem{algorithm}[thm]{\protect\algorithmname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\algorithmname}{_(Algorithm)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\algorithmname}{_(Algorithm)}}
EndBabelPreamble
End End
@ -72,8 +90,14 @@ Style Algorithm*
LabelString "Algorithm." LabelString "Algorithm."
Preamble Preamble
\theoremstyle{plain} \theoremstyle{plain}
\newtheorem*{algorithm*}{Algorithm} \newtheorem*{algorithm*}{\protect\algorithmname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\algorithmname}{_(Algorithm)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\algorithmname}{_(Algorithm)}}
EndBabelPreamble
End End
@ -84,8 +108,14 @@ Style Axiom
LabelString "Axiom \thetheorem." LabelString "Axiom \thetheorem."
Preamble Preamble
\theoremstyle{plain} \theoremstyle{plain}
\newtheorem{ax}[thm]{Axiom} \newtheorem{ax}[thm]{\protect\axiomname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\axiomname}{_(Axiom)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\axiomname}{_(Axiom)}}
EndBabelPreamble
End End
@ -95,8 +125,14 @@ Style Axiom*
LabelString "Axiom." LabelString "Axiom."
Preamble Preamble
\theoremstyle{plain} \theoremstyle{plain}
\newtheorem*{ax*}{Axiom} \newtheorem*{ax*}{\protect\axiomname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\axiomname}{_(Axiom)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\axiomname}{_(Axiom)}}
EndBabelPreamble
End End
@ -106,8 +142,14 @@ Style Condition
LabelString "Condition \thetheorem." LabelString "Condition \thetheorem."
Preamble Preamble
\theoremstyle{definition} \theoremstyle{definition}
\newtheorem{condition}[thm]{Condition} \newtheorem{condition}[thm]{\protect\conditionname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\conditionname}{_(Condition)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\conditionname}{_(Condition)}}
EndBabelPreamble
End End
@ -117,8 +159,14 @@ Style Condition*
LabelString "Condition." LabelString "Condition."
Preamble Preamble
\theoremstyle{definition} \theoremstyle{definition}
\newtheorem*{condition*}{Condition} \newtheorem*{condition*}{\protect\conditionname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\conditionname}{_(Condition)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\conditionname}{_(Condition)}}
EndBabelPreamble
End End
@ -128,8 +176,14 @@ Style Note
LabelString "Note \thetheorem." LabelString "Note \thetheorem."
Preamble Preamble
\theoremstyle{remark} \theoremstyle{remark}
\newtheorem{note}[thm]{Note} \newtheorem{note}[thm]{\protect\notename}
EndPreamble EndPreamble
LangPreamble
\providecommand{\notename}{_(Note)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\notename}{_(Note)}}
EndBabelPreamble
End End
@ -139,8 +193,14 @@ Style Note*
LabelString "Note." LabelString "Note."
Preamble Preamble
\theoremstyle{remark} \theoremstyle{remark}
\newtheorem*{note*}{Note} \newtheorem*{note*}{\protect\notename}
EndPreamble EndPreamble
LangPreamble
\providecommand{\notename}{_(Note)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\notename}{_(Note)}}
EndBabelPreamble
End End
@ -150,8 +210,14 @@ Style Notation
LabelString "Notation \thetheorem." LabelString "Notation \thetheorem."
Preamble Preamble
\theoremstyle{remark} \theoremstyle{remark}
\newtheorem{notation}[thm]{Notation} \newtheorem{notation}[thm]{\protect\notationname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\notationname}{_(Notation)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\notationname}{_(Notation)}}
EndBabelPreamble
End End
@ -161,8 +227,14 @@ Style Notation*
LabelString "Notation." LabelString "Notation."
Preamble Preamble
\theoremstyle{remark} \theoremstyle{remark}
\newtheorem*{notation*}{Notation} \newtheorem*{notation*}{\protect\notationname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\notationname}{_(Notation)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\notationname}{_(Notation)}}
EndBabelPreamble
End End
@ -172,8 +244,14 @@ Style Summary
LabelString "Summary \thetheorem." LabelString "Summary \thetheorem."
Preamble Preamble
\theoremstyle{remark} \theoremstyle{remark}
\newtheorem{summary}[thm]{Summary} \newtheorem{summary}[thm]{\protect\summaryname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\summaryname}{_(Summary)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\summaryname}{_(Summary)}}
EndBabelPreamble
End End
@ -183,8 +261,14 @@ Style Summary*
LabelString "Summary." LabelString "Summary."
Preamble Preamble
\theoremstyle{remark} \theoremstyle{remark}
\newtheorem*{summary*}{Summary} \newtheorem*{summary*}{\protect\summaryname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\summaryname}{_(Summary)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\summaryname}{_(Summary)}}
EndBabelPreamble
End End
@ -194,8 +278,14 @@ Style Acknowledgement
LabelString "Acknowledgement \thetheorem." LabelString "Acknowledgement \thetheorem."
Preamble Preamble
\theoremstyle{remark} \theoremstyle{remark}
\newtheorem{acknowledgement}[thm]{Acknowledgement} \newtheorem{acknowledgement}[thm]{\protect\acknowledgementname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\acknowledgementname}{_(Acknowledgement)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\acknowledgementname}{_(Acknowledgement)}}
EndBabelPreamble
End End
@ -205,8 +295,14 @@ Style Acknowledgement*
LabelString "Acknowledgement." LabelString "Acknowledgement."
Preamble Preamble
\theoremstyle{remark} \theoremstyle{remark}
\newtheorem*{acknowledgement*}{Acknowledgement} \newtheorem*{acknowledgement*}{\protect\acknowledgementname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\acknowledgementname}{_(Acknowledgement)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\acknowledgementname}{_(Acknowledgement)}}
EndBabelPreamble
End End
@ -216,8 +312,14 @@ Style Conclusion
LabelString "Conclusion \thetheorem." LabelString "Conclusion \thetheorem."
Preamble Preamble
\theoremstyle{remark} \theoremstyle{remark}
\newtheorem{conclusion}[thm]{Conclusion} \newtheorem{conclusion}[thm]{\protect\conclusionname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\conclusionname}{_(Conclusion)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\conclusionname}{_(Conclusion)}}
EndBabelPreamble
End End
@ -227,8 +329,14 @@ Style Conclusion*
LabelString "Conclusion." LabelString "Conclusion."
Preamble Preamble
\theoremstyle{remark} \theoremstyle{remark}
\newtheorem*{conclusion*}{Conclusion} \newtheorem*{conclusion*}{\protect\conclusionname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\conclusionname}{_(Conclusion)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\conclusionname}{_(Conclusion)}}
EndBabelPreamble
End End
@ -239,8 +347,14 @@ Style Assumption
LabelString "Assumption \thetheorem." LabelString "Assumption \thetheorem."
Preamble Preamble
\theoremstyle{plain} \theoremstyle{plain}
\newtheorem{assumption}[thm]{Assumption} \newtheorem{assumption}[thm]{\protect\assumptionname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\assumptionname}{_(Assumption)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\assumptionname}{_(Assumption)}}
EndBabelPreamble
End End
@ -250,8 +364,14 @@ Style Assumption*
LabelString "Assumption." LabelString "Assumption."
Preamble Preamble
\theoremstyle{plain} \theoremstyle{plain}
\newtheorem*{assumption*}{Assumption} \newtheorem*{assumption*}{\protect\assumptionname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\assumptionname}{_(Assumption)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\assumptionname}{_(Assumption)}}
EndBabelPreamble
End End
Style Question Style Question
@ -261,8 +381,14 @@ Style Question
LabelString "Question \thetheorem." LabelString "Question \thetheorem."
Preamble Preamble
\theoremstyle{plain} \theoremstyle{plain}
\newtheorem{question}[thm]{Question} \newtheorem{question}[thm]{\protect\questionname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\questionname}{_(Question)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\questionname}{_(Question)}}
EndBabelPreamble
End End
Style Question* Style Question*
@ -271,6 +397,12 @@ Style Question*
LabelString "Question." LabelString "Question."
Preamble Preamble
\theoremstyle{plain} \theoremstyle{plain}
\newtheorem*{question*}{Question} \newtheorem*{question*}{\protect\questionname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\questionname}{_(Question)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\questionname}{_(Question)}}
EndBabelPreamble
End End

View File

@ -19,7 +19,7 @@
# - Proof # - Proof
# - Case (regular only -- defined as an enumeration) # - Case (regular only -- defined as an enumeration)
Format 12 Format 14
Style Theorem Style Theorem
Category Theorem Category Theorem
@ -49,13 +49,15 @@ Style Theorem
Series Bold Series Bold
EndFont EndFont
Preamble Preamble
\providecommand{\theoremname}{Theorem}
\theoremstyle{plain} \theoremstyle{plain}
\newtheorem{thm}{\protect\theoremname} \newtheorem{thm}{\protect\theoremname}
EndPreamble EndPreamble
I18nPreamble LangPreamble
\AtBeginDocument{\ifx\LdfInit\undefined\relax\else\addto\captions$$lang{\renewcommand{\theoremname}{_(Theorem)}}\fi} \providecommand{\theoremname}{_(Theorem)}
EndI18nPreamble EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\theoremname}{_(Theorem)}}
EndBabelPreamble
Requires amsthm Requires amsthm
End End
@ -66,13 +68,15 @@ Style Corollary
LatexName cor LatexName cor
LabelString "Corollary \thetheorem." LabelString "Corollary \thetheorem."
Preamble Preamble
\providecommand{\corollaryname}{Corollary}
\theoremstyle{plain} \theoremstyle{plain}
\newtheorem{cor}[thm]{\protect\corollaryname} \newtheorem{cor}[thm]{\protect\corollaryname}
EndPreamble EndPreamble
I18nPreamble LangPreamble
\AtBeginDocument{\ifx\LdfInit\undefined\relax\else\addto\captions$$lang{\renewcommand{\corollaryname}{_(Corollary)}}\fi} \providecommand{\corollaryname}{_(Corollary)}
EndI18nPreamble EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\corollaryname}{_(Corollary)}}
EndBabelPreamble
End End
@ -82,13 +86,15 @@ Style Lemma
LatexName lem LatexName lem
LabelString "Lemma \thetheorem." LabelString "Lemma \thetheorem."
Preamble Preamble
\providecommand{\lemmaname}{Lemma}
\theoremstyle{plain} \theoremstyle{plain}
\newtheorem{lem}[thm]{\protect\lemmaname} \newtheorem{lem}[thm]{\protect\lemmaname}
EndPreamble EndPreamble
I18nPreamble LangPreamble
\AtBeginDocument{\ifx\LdfInit\undefined\relax\else\addto\captions$$lang{\renewcommand{\lemmaname}{_(Lemma)}}\fi} \providecommand{\lemmaname}{_(Lemma)}
EndI18nPreamble EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\lemmaname}{_(Lemma)}}
EndBabelPreamble
End End
@ -98,13 +104,15 @@ Style Proposition
LatexName prop LatexName prop
LabelString "Proposition \thetheorem." LabelString "Proposition \thetheorem."
Preamble Preamble
\providecommand{\propositionname}{Proposition}
\theoremstyle{plain} \theoremstyle{plain}
\newtheorem{prop}[thm]{\protect\propositionname} \newtheorem{prop}[thm]{\protect\propositionname}
EndPreamble EndPreamble
I18nPreamble LangPreamble
\AtBeginDocument{\ifx\LdfInit\undefined\relax\else\addto\captions$$lang{\renewcommand{\propositionname}{_(Proposition)}}\fi} \providecommand{\propositionname}{_(Proposition)}
EndI18nPreamble EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\propositionname}{_(Proposition)}}
EndBabelPreamble
End End
@ -114,13 +122,15 @@ Style Conjecture
LatexName conjecture LatexName conjecture
LabelString "Conjecture \thetheorem." LabelString "Conjecture \thetheorem."
Preamble Preamble
\providecommand{\conjecturename}{Conjecture}
\theoremstyle{plain} \theoremstyle{plain}
\newtheorem{conjecture}[thm]{\protect\conjecturename} \newtheorem{conjecture}[thm]{\protect\conjecturename}
EndPreamble EndPreamble
I18nPreamble LangPreamble
\AtBeginDocument{\ifx\LdfInit\undefined\relax\else\addto\captions$$lang{\renewcommand{\conjecturename}{_(Conjecture)}}\fi} \providecommand{\conjecturename}{_(Conjecture)}
EndI18nPreamble EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\conjecturename}{_(Conjecture)}}
EndBabelPreamble
End End
@ -130,13 +140,15 @@ Style Fact
LatexName fact LatexName fact
LabelString "Fact \thetheorem." LabelString "Fact \thetheorem."
Preamble Preamble
\providecommand{\factname}{Fact}
\theoremstyle{plain} \theoremstyle{plain}
\newtheorem{fact}[thm]{\protect\factname} \newtheorem{fact}[thm]{\protect\factname}
EndPreamble EndPreamble
I18nPreamble LangPreamble
\AtBeginDocument{\ifx\LdfInit\undefined\relax\else\addto\captions$$lang{\renewcommand{\factname}{_(Fact)}}\fi} \providecommand{\factname}{_(Fact)}
EndI18nPreamble EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\factname}{_(Fact)}}
EndBabelPreamble
End End
@ -153,13 +165,15 @@ Style Definition
Series Bold Series Bold
EndFont EndFont
Preamble Preamble
\providecommand{\definitionname}{Definition}
\theoremstyle{definition} \theoremstyle{definition}
\newtheorem{defn}[thm]{\protect\definitionname} \newtheorem{defn}[thm]{\protect\definitionname}
EndPreamble EndPreamble
I18nPreamble LangPreamble
\AtBeginDocument{\ifx\LdfInit\undefined\relax\else\addto\captions$$lang{\renewcommand{\definitionname}{_(Definition)}}\fi} \providecommand{\definitionname}{_(Definition)}
EndI18nPreamble EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\definitionname}{_(Definition)}}
EndBabelPreamble
End End
@ -168,13 +182,15 @@ Style Example
LatexName example LatexName example
LabelString "Example \thetheorem." LabelString "Example \thetheorem."
Preamble Preamble
\providecommand{\examplename}{Example}
\theoremstyle{definition} \theoremstyle{definition}
\newtheorem{example}[thm]{\protect\examplename} \newtheorem{example}[thm]{\protect\examplename}
EndPreamble EndPreamble
I18nPreamble LangPreamble
\AtBeginDocument{\ifx\LdfInit\undefined\relax\else\addto\captions$$lang{\renewcommand{\examplename}{_(Example)}}\fi} \providecommand{\examplename}{_(Example)}
EndI18nPreamble EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\examplename}{_(Example)}}
EndBabelPreamble
End End
@ -183,13 +199,15 @@ Style Problem
LatexName problem LatexName problem
LabelString "Problem \thetheorem." LabelString "Problem \thetheorem."
Preamble Preamble
\providecommand{\problemname}{Problem}
\theoremstyle{definition} \theoremstyle{definition}
\newtheorem{problem}[thm]{\protect\problemname} \newtheorem{problem}[thm]{\protect\problemname}
EndPreamble EndPreamble
I18nPreamble LangPreamble
\AtBeginDocument{\ifx\LdfInit\undefined\relax\else\addto\captions$$lang{\renewcommand{\problemname}{_(Problem)}}\fi} \providecommand{\problemname}{_(Problem)}
EndI18nPreamble EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\problemname}{_(Problem)}}
EndBabelPreamble
End End
@ -198,13 +216,15 @@ Style Exercise
LatexName xca LatexName xca
LabelString "Exercise \thetheorem." LabelString "Exercise \thetheorem."
Preamble Preamble
\providecommand{\exercisename}{Exercise}
\theoremstyle{definition} \theoremstyle{definition}
\newtheorem{xca}[thm]{\protect\exercisename} \newtheorem{xca}[thm]{\protect\exercisename}
EndPreamble EndPreamble
I18nPreamble LangPreamble
\AtBeginDocument{\ifx\LdfInit\undefined\relax\else\addto\captions$$lang{\renewcommand{\exercisename}{_(Exercise)}}\fi} \providecommand{\exercisename}{_(Exercise)}
EndI18nPreamble EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\exercisename}{_(Exercise)}}
EndBabelPreamble
End End
@ -222,13 +242,15 @@ Style Remark
Shape Italic Shape Italic
EndFont EndFont
Preamble Preamble
\providecommand{\remarkname}{Remark}
\theoremstyle{remark} \theoremstyle{remark}
\newtheorem{rem}[thm]{\protect\remarkname} \newtheorem{rem}[thm]{\protect\remarkname}
EndPreamble EndPreamble
I18nPreamble LangPreamble
\AtBeginDocument{\ifx\LdfInit\undefined\relax\else\addto\captions$$lang{\renewcommand{\remarkname}{_(Remark)}}\fi} \providecommand{\remarkname}{_(Remark)}
EndI18nPreamble EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\remarkname}{_(Remark)}}
EndBabelPreamble
End End
@ -237,13 +259,15 @@ Style Claim
LatexName claim LatexName claim
LabelString "Claim \thetheorem." LabelString "Claim \thetheorem."
Preamble Preamble
\providecommand{\claimname}{Claim}
\theoremstyle{remark} \theoremstyle{remark}
\newtheorem{claim}[thm]{\protect\claimname} \newtheorem{claim}[thm]{\protect\claimname}
EndPreamble EndPreamble
I18nPreamble LangPreamble
\AtBeginDocument{\ifx\LdfInit\undefined\relax\else\addto\captions$$lang{\renewcommand{\claimname}{_(Claim)}}\fi} \providecommand{\claimname}{_(Claim)}
EndI18nPreamble EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\claimname}{_(Claim)}}
EndBabelPreamble
End End
@ -270,7 +294,6 @@ Style Case
Shape Italic Shape Italic
EndFont EndFont
Preamble Preamble
\providecommand{\casename}{Case}
\newcounter{casectr} \newcounter{casectr}
\newenvironment{caseenv} \newenvironment{caseenv}
{\begin{list}{{\itshape\ \protect\casename} \arabic{casectr}.}{% {\begin{list}{{\itshape\ \protect\casename} \arabic{casectr}.}{%
@ -283,7 +306,10 @@ Style Case
\usecounter{casectr}} \usecounter{casectr}}
{\end{list}} {\end{list}}
EndPreamble EndPreamble
I18nPreamble LangPreamble
\AtBeginDocument{\ifx\LdfInit\undefined\relax\else\addto\captions$$lang{\renewcommand{\casename}{_(Case)}}\fi} \providecommand{\casename}{_(Case)}
EndI18nPreamble EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\casename}{_(Case)}}
EndBabelPreamble
End End

View File

@ -8,7 +8,7 @@
# Author: Richard Heck <rgheck@comcast.net> # Author: Richard Heck <rgheck@comcast.net>
Format 11 Format 14
Counter theorem Counter theorem
Within chapter Within chapter
@ -17,9 +17,15 @@ End
Style Theorem Style Theorem
Preamble Preamble
\ifx\thechapter\undefined \ifx\thechapter\undefined
\newtheorem{thm}{Theorem} \newtheorem{thm}{\protect\theoremname}
\else \else
\newtheorem{thm}{Theorem}[chapter] \newtheorem{thm}{\protect\theoremname}[chapter]
\fi \fi
EndPreamble EndPreamble
LangPreamble
\providecommand{\theoremname}{_(Theorem)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\theoremname}{_(Theorem)}}
EndBabelPreamble
End End

View File

@ -7,7 +7,7 @@
# Author: Richard Heck <rgheck@comcast.net> # Author: Richard Heck <rgheck@comcast.net>
Format 11 Format 14
Counter theorem Counter theorem
Within section Within section
@ -15,6 +15,12 @@ End
Style Theorem Style Theorem
Preamble Preamble
\newtheorem{thm}{Theorem}[section] \newtheorem{thm}{\protect\theoremname}[section]
EndPreamble EndPreamble
LangPreamble
\providecommand{\theoremname}{_(Theorem)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\theoremname}{_(Theorem)}}
EndBabelPreamble
End End

View File

@ -18,7 +18,7 @@
# - Claim # - Claim
# - Proof # - Proof
Format 11 Format 14
Style Theorem* Style Theorem*
Category Theorem Category Theorem
@ -48,8 +48,14 @@ Style Theorem*
EndFont EndFont
Preamble Preamble
\theoremstyle{plain} \theoremstyle{plain}
\newtheorem*{thm*}{Theorem} \newtheorem*{thm*}{\protect\theoremname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\theoremname}{_(Theorem)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\theoremname}{_(Theorem)}}
EndBabelPreamble
Requires amsthm Requires amsthm
End End
@ -60,9 +66,14 @@ Style Corollary*
LabelString "Corollary." LabelString "Corollary."
Preamble Preamble
\theoremstyle{plain} \theoremstyle{plain}
\newtheorem*{cor*}{Corollary} \newtheorem*{cor*}{\protect\corollaryname}
EndPreamble EndPreamble
Requires amsthm LangPreamble
\providecommand{\corollaryname}{_(Corollary)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\corollaryname}{_(Corollary)}}
EndBabelPreamble
End End
@ -72,9 +83,14 @@ Style Lemma*
LabelString "Lemma." LabelString "Lemma."
Preamble Preamble
\theoremstyle{plain} \theoremstyle{plain}
\newtheorem*{lem*}{Lemma} \newtheorem*{lem*}{\protect\lemmaname}
EndPreamble EndPreamble
Requires amsthm LangPreamble
\providecommand{\lemmaname}{_(Lemma)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\lemmaname}{_(Lemma)}}
EndBabelPreamble
End End
@ -84,9 +100,14 @@ Style Proposition*
LabelString "Proposition." LabelString "Proposition."
Preamble Preamble
\theoremstyle{plain} \theoremstyle{plain}
\newtheorem*{prop*}{Proposition} \newtheorem*{prop*}{\protect\propositionname}
EndPreamble EndPreamble
Requires amsthm LangPreamble
\providecommand{\propositionname}{_(Proposition)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\propositionname}{_(Proposition)}}
EndBabelPreamble
End End
@ -96,9 +117,14 @@ Style Conjecture*
LabelString "Conjecture." LabelString "Conjecture."
Preamble Preamble
\theoremstyle{plain} \theoremstyle{plain}
\newtheorem*{conjecture*}{Conjecture} \newtheorem*{conjecture*}{\protect\conjecturename}
EndPreamble EndPreamble
Requires amsthm LangPreamble
\providecommand{\conjecturename}{_(Conjecture)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\conjecturename}{_(Conjecture)}}
EndBabelPreamble
End End
@ -108,9 +134,14 @@ Style Fact*
LabelString "Fact." LabelString "Fact."
Preamble Preamble
\theoremstyle{plain} \theoremstyle{plain}
\newtheorem*{fact*}{Fact} \newtheorem*{fact*}{\protect\factname}
EndPreamble EndPreamble
Requires amsthm LangPreamble
\providecommand{\factname}{_(Fact)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\factname}{_(Fact)}}
EndBabelPreamble
End End
@ -128,9 +159,14 @@ Style Definition*
EndFont EndFont
Preamble Preamble
\theoremstyle{definition} \theoremstyle{definition}
\newtheorem*{defn*}{Definition} \newtheorem*{defn*}{\protect\definitionname}
EndPreamble EndPreamble
Requires amsthm LangPreamble
\providecommand{\definitionname}{_(Definition)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\definitionname}{_(Definition)}}
EndBabelPreamble
End End
@ -140,9 +176,14 @@ Style Example*
LabelString "Example." LabelString "Example."
Preamble Preamble
\theoremstyle{definition} \theoremstyle{definition}
\newtheorem*{example*}{Example} \newtheorem*{example*}{\protect\examplename}
EndPreamble EndPreamble
Requires amsthm LangPreamble
\providecommand{\examplename}{_(Example)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\examplename}{_(Example)}}
EndBabelPreamble
End End
@ -152,9 +193,14 @@ Style Problem*
LabelString "Problem." LabelString "Problem."
Preamble Preamble
\theoremstyle{definition} \theoremstyle{definition}
\newtheorem*{problem*}{Problem} \newtheorem*{problem*}{\protect\problemname}
EndPreamble EndPreamble
Requires amsthm LangPreamble
\providecommand{\problemname}{_(Problem)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\problemname}{_(Problem)}}
EndBabelPreamble
End End
@ -164,9 +210,14 @@ Style Exercise*
LabelString "Exercise." LabelString "Exercise."
Preamble Preamble
\theoremstyle{definition} \theoremstyle{definition}
\newtheorem*{xca*}{Exercise} \newtheorem*{xca*}{\protect\exercisename}
EndPreamble EndPreamble
Requires amsthm LangPreamble
\providecommand{\exercisename}{_(Exercise)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\exercisename}{_(Exercise)}}
EndBabelPreamble
End End
@ -184,9 +235,14 @@ Style Remark*
EndFont EndFont
Preamble Preamble
\theoremstyle{remark} \theoremstyle{remark}
\newtheorem*{rem*}{Remark} \newtheorem*{rem*}{\protect\remarkname}
EndPreamble EndPreamble
Requires amsthm LangPreamble
\providecommand{\remarkname}{_(Remark)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\remarkname}{_(Remark)}}
EndBabelPreamble
End End
@ -196,8 +252,13 @@ Style Claim*
LabelString "Claim." LabelString "Claim."
Preamble Preamble
\theoremstyle{remark} \theoremstyle{remark}
\newtheorem*{claim*}{Claim} \newtheorem*{claim*}{\protect\claimname}
EndPreamble EndPreamble
Requires amsthm LangPreamble
\providecommand{\claimname}{_(Claim)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\claimname}{_(Claim)}}
EndBabelPreamble
End End

View File

@ -8,7 +8,7 @@
# Author: Richard Heck <rgheck@comcast.net> # Author: Richard Heck <rgheck@comcast.net>
Format 11 Format 14
Counter theorem Counter theorem
End End
@ -20,7 +20,7 @@ Input theorems-proof.inc
Style Proof Style Proof
Preamble Preamble
\ifx\proof\undefined\ \ifx\proof\undefined\
\newenvironment{proof}[1][\proofname]{\par \newenvironment{proof}[1][\protect\proofname]{\par
\normalfont\topsep6\p@\@plus6\p@\relax \normalfont\topsep6\p@\@plus6\p@\relax
\trivlist \trivlist
\itemindent\parindent \itemindent\parindent
@ -30,7 +30,12 @@ Style Proof
}{% }{%
\endtrivlist\@endpefalse \endtrivlist\@endpefalse
} }
\providecommand{\proofname}{Proof}
\fi \fi
EndPreamble EndPreamble
LangPreamble
\providecommand{\proofname}{_(Proof)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\proofname}{_(Proof)}}
EndBabelPreamble
End End

View File

@ -19,7 +19,7 @@
# - Proof # - Proof
# - Case (regular only -- defined as an enumeration) # - Case (regular only -- defined as an enumeration)
Format 11 Format 14
Style Theorem Style Theorem
Category Theorem Category Theorem
@ -49,8 +49,14 @@ Style Theorem
Series Bold Series Bold
EndFont EndFont
Preamble Preamble
\newtheorem{thm}{Theorem} \newtheorem{thm}{\protect\theoremname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\theoremname}{_(Theorem)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\theoremname}{_(Theorem)}}
EndBabelPreamble
Requires amsthm Requires amsthm
End End
@ -61,8 +67,14 @@ Style Corollary
LatexName cor LatexName cor
LabelString "Corollary \thetheorem." LabelString "Corollary \thetheorem."
Preamble Preamble
\newtheorem{cor}[thm]{Corollary} \newtheorem{cor}[thm]{\protect\corollaryname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\corollaryname}{_(Corollary)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\corollaryname}{_(Corollary)}}
EndBabelPreamble
End End
@ -72,8 +84,14 @@ Style Lemma
LatexName lem LatexName lem
LabelString "Lemma \thetheorem." LabelString "Lemma \thetheorem."
Preamble Preamble
\newtheorem{lem}[thm]{Lemma} \newtheorem{lem}[thm]{\protect\lemmaname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\lemmaname}{_(Lemma)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\lemmaname}{_(Lemma)}}
EndBabelPreamble
End End
@ -83,8 +101,14 @@ Style Proposition
LatexName prop LatexName prop
LabelString "Proposition \thetheorem." LabelString "Proposition \thetheorem."
Preamble Preamble
\newtheorem{prop}[thm]{Proposition} \newtheorem{prop}[thm]{\protect\propositionname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\propositionname}{_(Proposition)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\propositionname}{_(Proposition)}}
EndBabelPreamble
End End
@ -94,8 +118,14 @@ Style Conjecture
LatexName conjecture LatexName conjecture
LabelString "Conjecture \thetheorem." LabelString "Conjecture \thetheorem."
Preamble Preamble
\newtheorem{conjecture}[thm]{Conjecture} \newtheorem{conjecture}[thm]{\protect\conjecturename}
EndPreamble EndPreamble
LangPreamble
\providecommand{\conjecturename}{_(Conjecture)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\conjecturename}{_(Conjecture)}}
EndBabelPreamble
End End
@ -105,8 +135,14 @@ Style Fact
LatexName fact LatexName fact
LabelString "Fact \thetheorem." LabelString "Fact \thetheorem."
Preamble Preamble
\newtheorem{fact}[thm]{Fact} \newtheorem{fact}[thm]{\protect\factname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\factname}{_(Fact)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\factname}{_(Fact)}}
EndBabelPreamble
End End
@ -124,8 +160,14 @@ Style Definition
EndFont EndFont
Preamble Preamble
\theoremstyle{definition} \theoremstyle{definition}
\newtheorem{defn}[thm]{Definition} \newtheorem{defn}[thm]{\protect\definitionname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\definitionname}{_(Definition)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\definitionname}{_(Definition)}}
EndBabelPreamble
End End
@ -135,9 +177,14 @@ Style Example
LabelString "Example \thetheorem." LabelString "Example \thetheorem."
Preamble Preamble
\theoremstyle{definition} \theoremstyle{definition}
\newtheorem{example}[thm]{Example} \newtheorem{example}[thm]{\protect\examplename}
EndPreamble EndPreamble
Requires amsthm LangPreamble
\providecommand{\examplename}{_(Example)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\examplename}{_(Example)}}
EndBabelPreamble
End End
@ -147,9 +194,14 @@ Style Problem
LabelString "Problem \thetheorem." LabelString "Problem \thetheorem."
Preamble Preamble
\theoremstyle{definition} \theoremstyle{definition}
\newtheorem{problem}[thm]{Problem} \newtheorem{problem}[thm]{\protect\problemname}
EndPreamble EndPreamble
Requires amsthm LangPreamble
\providecommand{\problemname}{_(Problem)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\problemname}{_(Problem)}}
EndBabelPreamble
End End
@ -159,9 +211,14 @@ Style Exercise
LabelString "Exercise \thetheorem." LabelString "Exercise \thetheorem."
Preamble Preamble
\theoremstyle{definition} \theoremstyle{definition}
\newtheorem{xca}[thm]{Exercise} \newtheorem{xca}[thm]{\protect\exercisename}
EndPreamble EndPreamble
Requires amsthm LangPreamble
\providecommand{\exercisename}{_(Exercise)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\exercisename}{_(Exercise)}}
EndBabelPreamble
End End
@ -180,8 +237,14 @@ Style Remark
EndFont EndFont
Preamble Preamble
\theoremstyle{remark} \theoremstyle{remark}
\newtheorem{rem}[thm]{Remark} \newtheorem{rem}[thm]{\protect\remarkname}
EndPreamble EndPreamble
LangPreamble
\providecommand{\remarkname}{_(Remark)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\remarkname}{_(Remark)}}
EndBabelPreamble
End End
@ -191,9 +254,14 @@ Style Claim
LabelString "Claim \thetheorem." LabelString "Claim \thetheorem."
Preamble Preamble
\theoremstyle{remark} \theoremstyle{remark}
\newtheorem{claim}[thm]{Claim} \newtheorem{claim}[thm]{\protect\claimname}
EndPreamble EndPreamble
Requires amsthm LangPreamble
\providecommand{\claimname}{_(Claim)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\claimname}{_(Claim)}}
EndBabelPreamble
End End
@ -212,7 +280,7 @@ Style Case
Preamble Preamble
\newcounter{casectr} \newcounter{casectr}
\newenvironment{caseenv} \newenvironment{caseenv}
{\begin{list}{{\itshape\ Case} \arabic{casectr}.}{% {\begin{list}{{\itshape\ \protect\casename} \arabic{casectr}.}{%
\setlength{\leftmargin}{\labelwidth} \setlength{\leftmargin}{\labelwidth}
\addtolength{\leftmargin}{\parskip} \addtolength{\leftmargin}{\parskip}
\setlength{\itemindent}{\listparindent} \setlength{\itemindent}{\listparindent}
@ -222,4 +290,10 @@ Style Case
\usecounter{casectr}} \usecounter{casectr}}
{\end{list}} {\end{list}}
EndPreamble EndPreamble
LangPreamble
\providecommand{\casename}{_(Case)}
EndLangPreamble
BabelPreamble
\addto\captions$$lang{\renewcommand{\casename}{_(Case)}}
EndBabelPreamble
End End

View File

@ -45,7 +45,10 @@ import os, re, string, sys
# Incremented to format 13, 5 February 2009 by rgh # Incremented to format 13, 5 February 2009 by rgh
# Add InToc tag for InsetLayout # Add InToc tag for InsetLayout
currentFormat = 13 # Incremented to format 14, 14 February 2009 by gb
# Rename I18NPreamble to BabelPreamble and add LangPreamble
currentFormat = 14
def usage(prog_name): def usage(prog_name):
@ -112,6 +115,10 @@ def convert(lines):
re_Format = re.compile(r'^(\s*)(Format)(\s+)(\S+)', re.IGNORECASE) re_Format = re.compile(r'^(\s*)(Format)(\s+)(\S+)', re.IGNORECASE)
re_Preamble = re.compile(r'^(\s*)Preamble', re.IGNORECASE) re_Preamble = re.compile(r'^(\s*)Preamble', re.IGNORECASE)
re_EndPreamble = re.compile(r'^(\s*)EndPreamble', re.IGNORECASE) re_EndPreamble = re.compile(r'^(\s*)EndPreamble', re.IGNORECASE)
re_LangPreamble = re.compile(r'^(\s*)LangPreamble', re.IGNORECASE)
re_EndLangPreamble = re.compile(r'^(\s*)EndLangPreamble', re.IGNORECASE)
re_BabelPreamble = re.compile(r'^(\s*)BabelPreamble', re.IGNORECASE)
re_EndBabelPreamble = re.compile(r'^(\s*)EndBabelPreamble', re.IGNORECASE)
re_MaxCounter = re.compile(r'^(\s*)(MaxCounter)(\s+)(\S+)', re.IGNORECASE) re_MaxCounter = re.compile(r'^(\s*)(MaxCounter)(\s+)(\S+)', re.IGNORECASE)
re_LabelType = re.compile(r'^(\s*)(LabelType)(\s+)(\S+)', re.IGNORECASE) re_LabelType = re.compile(r'^(\s*)(LabelType)(\s+)(\S+)', re.IGNORECASE)
re_LabelString = re.compile(r'^(\s*)(LabelString)(\s+)(("[^"]+")|(\S+))', re.IGNORECASE) re_LabelString = re.compile(r'^(\s*)(LabelString)(\s+)(("[^"]+")|(\S+))', re.IGNORECASE)
@ -127,6 +134,8 @@ def convert(lines):
re_AMSMathsPlain = re.compile(r'^\s*Input amsmaths-plain.inc\s*') re_AMSMathsPlain = re.compile(r'^\s*Input amsmaths-plain.inc\s*')
re_AMSMathsSeq = re.compile(r'^\s*Input amsmaths-seq.inc\s*') re_AMSMathsSeq = re.compile(r'^\s*Input amsmaths-seq.inc\s*')
re_TocLevel = re.compile(r'^(\s*)(TocLevel)(\s+)(\S+)', re.IGNORECASE) re_TocLevel = re.compile(r'^(\s*)(TocLevel)(\s+)(\S+)', re.IGNORECASE)
re_I18nPreamble = re.compile(r'^(\s*)I18nPreamble', re.IGNORECASE)
re_EndI18nPreamble = re.compile(r'^(\s*)EndI18nPreamble', re.IGNORECASE)
# counters for sectioning styles (hardcoded in 1.3) # counters for sectioning styles (hardcoded in 1.3)
counters = {"part" : "\\Roman{part}", counters = {"part" : "\\Roman{part}",
@ -204,6 +213,30 @@ def convert(lines):
while i < len(lines) and not re_EndPreamble.match(lines[i]): while i < len(lines) and not re_EndPreamble.match(lines[i]):
i += 1 i += 1
continue continue
if re_LangPreamble.match(lines[i]):
i += 1
while i < len(lines) and not re_EndLangPreamble.match(lines[i]):
i += 1
continue
if re_BabelPreamble.match(lines[i]):
i += 1
while i < len(lines) and not re_EndBabelPreamble.match(lines[i]):
i += 1
continue
# Rename I18NPreamble to BabelPreamble
if format == 13:
match = re_I18nPreamble.match(lines[i])
if match:
lines[i] = match.group(1) + "BabelPreamble"
i += 1
match = re_EndI18nPreamble.match(lines[i])
while i < len(lines) and not match:
i += 1
match = re_EndI18nPreamble.match(lines[i])
lines[i] = match.group(1) + "EndBabelPreamble"
i += 1
continue
# These just involved new features, not any changes to old ones # These just involved new features, not any changes to old ones
if format == 11 or format == 12: if format == 11 or format == 12:

View File

@ -84,8 +84,8 @@ def layouts_l10n(input_files, output, base):
InsetLayout = re.compile(r'^InsetLayout\s+(.*)') InsetLayout = re.compile(r'^InsetLayout\s+(.*)')
DescBegin = re.compile(r'#+\s*DescriptionBegin\s*$') DescBegin = re.compile(r'#+\s*DescriptionBegin\s*$')
DescEnd = re.compile(r'#+\s*DescriptionEnd\s*$') DescEnd = re.compile(r'#+\s*DescriptionEnd\s*$')
I18nPreamble = re.compile(r'\s*I18nPreamble\s*$') I18nPreamble = re.compile(r'\s*(Lang)|(Babel)Preamble\s*$')
EndI18nPreamble = re.compile(r'\s*EndI18nPreamble\s*$') EndI18nPreamble = re.compile(r'\s*End(Lang)|(Babel)Preamble\s*$')
I18nString = re.compile(r'_\(([^\)]+)\)') I18nString = re.compile(r'_\(([^\)]+)\)')
for src in input_files: for src in input_files:

View File

@ -1419,6 +1419,10 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
lyxpreamble += from_utf8(features.getBabelOptions()) + '\n'; lyxpreamble += from_utf8(features.getBabelOptions()) + '\n';
} }
docstring const i18npreamble = features.getTClassI18nPreamble(use_babel);
if (!i18npreamble.empty())
lyxpreamble += i18npreamble + '\n';
int const nlines = int const nlines =
int(count(lyxpreamble.begin(), lyxpreamble.end(), '\n')); int(count(lyxpreamble.begin(), lyxpreamble.end(), '\n'));
for (int j = 0; j != nlines; ++j) { for (int j = 0; j != nlines; ++j) {

View File

@ -870,18 +870,42 @@ docstring const LaTeXFeatures::getTClassPreamble() const
tcpreamble << tclass.preamble(); tcpreamble << tclass.preamble();
list<docstring>::const_iterator cit = usedLayouts_.begin();
list<docstring>::const_iterator end = usedLayouts_.end();
for (; cit != end; ++cit)
tcpreamble << tclass[*cit].preamble();
return tcpreamble.str();
}
docstring const LaTeXFeatures::getTClassI18nPreamble(bool use_babel) const
{
DocumentClass const & tclass = params_.documentClass();
// collect preamble snippets in a set to prevent multiple identical
// commands (would happen if e.g. both theorem and theorem* are used)
set<docstring> snippets;
typedef LanguageList::const_iterator lang_it; typedef LanguageList::const_iterator lang_it;
lang_it const lbeg = UsedLanguages_.begin(); lang_it const lbeg = UsedLanguages_.begin();
lang_it const lend = UsedLanguages_.end(); lang_it const lend = UsedLanguages_.end();
list<docstring>::const_iterator cit = usedLayouts_.begin(); list<docstring>::const_iterator cit = usedLayouts_.begin();
list<docstring>::const_iterator end = usedLayouts_.end(); list<docstring>::const_iterator end = usedLayouts_.end();
for (; cit != end; ++cit) { for (; cit != end; ++cit) {
tcpreamble << tclass[*cit].preamble(); // language dependent commands (once per document)
tcpreamble << tclass[*cit].i18npreamble(buffer().language()); snippets.insert(tclass[*cit].langpreamble(buffer().language()));
// commands for language changing (for multilanguage documents)
if (use_babel && !UsedLanguages_.empty()) {
snippets.insert(tclass[*cit].babelpreamble(buffer().language()));
for (lang_it lit = lbeg; lit != lend; ++lit) for (lang_it lit = lbeg; lit != lend; ++lit)
tcpreamble << tclass[*cit].i18npreamble(*lit); snippets.insert(tclass[*cit].babelpreamble(*lit));
}
} }
odocstringstream tcpreamble;
set<docstring>::const_iterator const send = snippets.end();
set<docstring>::const_iterator it = snippets.begin();
for (; it != send; ++it)
tcpreamble << *it;
return tcpreamble.str(); return tcpreamble.str();
} }

View File

@ -56,6 +56,8 @@ public:
std::string const getBabelOptions() const; std::string const getBabelOptions() const;
/// The definitions needed by the document's textclass /// The definitions needed by the document's textclass
docstring const getTClassPreamble() const; docstring const getTClassPreamble() const;
/// The language dependent definitions needed by the document's textclass
docstring const getTClassI18nPreamble(bool use_babel) const;
/// The sgml definitions needed by the document (docbook) /// The sgml definitions needed by the document (docbook)
docstring const getLyXSGMLEntities() const; docstring const getLyXSGMLEntities() const;
/// The SGML Required to include the files added with includeFile(); /// The SGML Required to include the files added with includeFile();

View File

@ -56,7 +56,6 @@ enum LayoutTags {
LT_FREE_SPACING, LT_FREE_SPACING,
LT_PASS_THRU, LT_PASS_THRU,
//LT_HEADINGS, //LT_HEADINGS,
LT_I18NPREAMBLE,
LT_ITEMSEP, LT_ITEMSEP,
LT_KEEPEMPTY, LT_KEEPEMPTY,
LT_LABEL_BOTTOMSEP, LT_LABEL_BOTTOMSEP,
@ -83,6 +82,8 @@ enum LayoutTags {
LT_PARSKIP, LT_PARSKIP,
//LT_PLAIN, //LT_PLAIN,
LT_PREAMBLE, LT_PREAMBLE,
LT_LANGPREAMBLE,
LT_BABELPREAMBLE,
LT_REQUIRES, LT_REQUIRES,
LT_RIGHTMARGIN, LT_RIGHTMARGIN,
LT_SPACING, LT_SPACING,
@ -138,6 +139,7 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
LexerKeyword layoutTags[] = { LexerKeyword layoutTags[] = {
{ "align", LT_ALIGN }, { "align", LT_ALIGN },
{ "alignpossible", LT_ALIGNPOSSIBLE }, { "alignpossible", LT_ALIGNPOSSIBLE },
{ "babelpreamble", LT_BABELPREAMBLE },
{ "bottomsep", LT_BOTTOMSEP }, { "bottomsep", LT_BOTTOMSEP },
{ "category", LT_CATEGORY }, { "category", LT_CATEGORY },
{ "commanddepth", LT_COMMANDDEPTH }, { "commanddepth", LT_COMMANDDEPTH },
@ -150,7 +152,6 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
{ "fill_top", LT_FILL_TOP }, { "fill_top", LT_FILL_TOP },
{ "font", LT_FONT }, { "font", LT_FONT },
{ "freespacing", LT_FREE_SPACING }, { "freespacing", LT_FREE_SPACING },
{ "i18npreamble", LT_I18NPREAMBLE },
{ "innertag", LT_INNERTAG }, { "innertag", LT_INNERTAG },
{ "intitle", LT_INTITLE }, { "intitle", LT_INTITLE },
{ "itemsep", LT_ITEMSEP }, { "itemsep", LT_ITEMSEP },
@ -165,6 +166,7 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
{ "labelstringappendix", LT_LABELSTRING_APPENDIX }, { "labelstringappendix", LT_LABELSTRING_APPENDIX },
{ "labeltag", LT_LABELTAG }, { "labeltag", LT_LABELTAG },
{ "labeltype", LT_LABELTYPE }, { "labeltype", LT_LABELTYPE },
{ "langpreamble", LT_LANGPREAMBLE },
{ "latexname", LT_LATEXNAME }, { "latexname", LT_LATEXNAME },
{ "latexparam", LT_LATEXPARAM }, { "latexparam", LT_LATEXPARAM },
{ "latextype", LT_LATEXTYPE }, { "latextype", LT_LATEXTYPE },
@ -336,8 +338,12 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
preamble_ = from_utf8(lex.getLongString("EndPreamble")); preamble_ = from_utf8(lex.getLongString("EndPreamble"));
break; break;
case LT_I18NPREAMBLE: case LT_LANGPREAMBLE:
i18npreamble_ = from_utf8(lex.getLongString("EndI18NPreamble")); langpreamble_ = from_utf8(lex.getLongString("EndLangPreamble"));
break;
case LT_BABELPREAMBLE:
babelpreamble_ = from_utf8(lex.getLongString("EndBabelPreamble"));
break; break;
case LT_LABELTYPE: case LT_LABELTYPE:
@ -774,12 +780,15 @@ docstring const & Layout::depends_on() const
} }
docstring const Layout::i18npreamble(Language const * lang) const namespace {
docstring const i18npreamble(Language const * lang, docstring const & templ)
{ {
if (i18npreamble_.empty()) if (templ.empty())
return i18npreamble_; return templ;
string preamble = subst(to_utf8(i18npreamble_), "$$lang",
lang->babel()); string preamble = subst(to_utf8(templ), "$$lang", lang->babel());
#ifdef TEX2LYX #ifdef TEX2LYX
// tex2lyx does not have getMessages() // tex2lyx does not have getMessages()
LASSERT(false, /**/); LASSERT(false, /**/);
@ -805,6 +814,20 @@ docstring const Layout::i18npreamble(Language const * lang) const
return from_utf8(preamble); return from_utf8(preamble);
} }
}
docstring const Layout::langpreamble(Language const * lang) const
{
return i18npreamble(lang, langpreamble_);
}
docstring const Layout::babelpreamble(Language const * lang) const
{
return i18npreamble(lang, babelpreamble_);
}
bool Layout::operator==(Layout const & rhs) const bool Layout::operator==(Layout const & rhs) const
{ {

View File

@ -92,7 +92,10 @@ public:
docstring const & preamble() const { return preamble_; } docstring const & preamble() const { return preamble_; }
/// Get language dependent macro definitions needed for this layout /// Get language dependent macro definitions needed for this layout
/// for language \p lang /// for language \p lang
docstring const i18npreamble(Language const * lang) const; docstring const langpreamble(Language const * lang) const;
/// Get language and babel dependent macro definitions needed for
/// this layout for language \p lang
docstring const babelpreamble(Language const * lang) const;
/// ///
std::set<std::string> const & requires() const { return requires_; } std::set<std::string> const & requires() const { return requires_; }
/// ///
@ -271,7 +274,9 @@ private:
/// Macro definitions needed for this layout /// Macro definitions needed for this layout
docstring preamble_; docstring preamble_;
/// Language dependent macro definitions needed for this layout /// Language dependent macro definitions needed for this layout
docstring i18npreamble_; docstring langpreamble_;
/// Language and babel dependent macro definitions needed for this layout
docstring babelpreamble_;
/// Packages needed for this layout /// Packages needed for this layout
std::set<std::string> requires_; std::set<std::string> requires_;
}; };

View File

@ -62,7 +62,7 @@ private:
}; };
// Keep the changes documented in the Customization manual. // Keep the changes documented in the Customization manual.
int const FORMAT = 13; int const FORMAT = 14;
bool layout2layout(FileName const & filename, FileName const & tempfile) bool layout2layout(FileName const & filename, FileName const & tempfile)
@ -232,17 +232,18 @@ bool TextClass::convertLayoutFormat(support::FileName const & filename, ReadType
FileName const tempfile = FileName::tempName("convert_layout"); FileName const tempfile = FileName::tempName("convert_layout");
bool success = layout2layout(filename, tempfile); bool success = layout2layout(filename, tempfile);
if (success) if (success)
success = read(tempfile, rt); success = readWithoutConv(tempfile, rt) == OK;
tempfile.removeFile(); tempfile.removeFile();
return success; return success;
} }
bool TextClass::read(FileName const & filename, ReadType rt)
TextClass::ReturnValues TextClass::readWithoutConv(FileName const & filename, ReadType rt)
{ {
if (!filename.isReadableFile()) { if (!filename.isReadableFile()) {
lyxerr << "Cannot read layout file `" << filename << "'." lyxerr << "Cannot read layout file `" << filename << "'."
<< endl; << endl;
return false; return ERROR;
} }
LYXERR(Debug::TCLASS, "Reading " + translateRT(rt) + ": " + LYXERR(Debug::TCLASS, "Reading " + translateRT(rt) + ": " +
@ -261,6 +262,13 @@ bool TextClass::read(FileName const & filename, ReadType rt)
LYXERR(Debug::TCLASS, "Finished reading " + translateRT(rt) + ": " + LYXERR(Debug::TCLASS, "Finished reading " + translateRT(rt) + ": " +
to_utf8(makeDisplayPath(filename.absFilename()))); to_utf8(makeDisplayPath(filename.absFilename())));
return retval;
}
bool TextClass::read(FileName const & filename, ReadType rt)
{
ReturnValues const retval = readWithoutConv(filename, rt);
if (retval != FORMAT_MISMATCH) if (retval != FORMAT_MISMATCH)
return retval == OK; return retval == OK;

View File

@ -298,6 +298,8 @@ private:
bool deleteLayout(docstring const &); bool deleteLayout(docstring const &);
/// ///
bool convertLayoutFormat(support::FileName const &, ReadType); bool convertLayoutFormat(support::FileName const &, ReadType);
/// Reads the layout file without running layout2layout.
ReturnValues readWithoutConv(support::FileName const & filename, ReadType rt);
/// \return true for success. /// \return true for success.
bool readStyle(Lexer &, Layout &) const; bool readStyle(Lexer &, Layout &) const;
/// ///