commit 11c7ec5931d9de21a21212317322c66c5d1014ed
Author: Juergen Spitzmueller <[email protected]>
Date: Sat Apr 26 09:24:03 2025 +0200
Support zref references to theorems unknown to the package
We provide out own definitions here.
---
lib/doc/Customization.lyx | 110 ++++++++++++++++++++-
lib/doc/de/Customization.lyx | 58 +++++++++++
lib/layouts/theorems-ams-bytype.inc | 8 ++
lib/layouts/theorems-ams-chap-bytype.inc | 6 ++
lib/layouts/theorems-ams-extended-bytype.module | 16 +++
.../theorems-ams-extended-chap-bytype.module | 16 +++
lib/layouts/theorems-ams-extended.module | 16 +++
lib/layouts/theorems-ams.inc | 8 ++
lib/layouts/theorems-bytype.inc | 8 ++
lib/layouts/theorems.inc | 8 ++
lib/scripts/layout2layout.py | 3 +-
po/lyx_pot.py | 14 +++
src/LaTeXFeatures.cpp | 35 ++++++-
src/LaTeXFeatures.h | 3 +
src/Layout.cpp | 16 +++
src/Layout.h | 8 ++
16 files changed, 330 insertions(+), 3 deletions(-)
diff --git a/lib/doc/Customization.lyx b/lib/doc/Customization.lyx
index 9b69bfee17..5e45337483 100644
--- a/lib/doc/Customization.lyx
+++ b/lib/doc/Customization.lyx
@@ -16824,6 +16824,8 @@ status collapsed
\change_inserted -712698321 1745588508
TheoremName
+\change_unchanged
+
\end_layout
\end_inset
@@ -16853,6 +16855,8 @@ status collapsed
\backslash
newtheorem
+\change_unchanged
+
\end_layout
\end_inset
@@ -16862,7 +16866,7 @@ newtheorem
\begin_layout Description
-\change_inserted -712698321 1745589464
+\change_inserted -712698321 1745643919
\begin_inset Flex Code
status collapsed
@@ -16870,6 +16874,8 @@ status collapsed
\change_inserted -712698321 1745588706
TheoremLaTeXName
+\change_unchanged
+
\end_layout
\end_inset
@@ -16882,6 +16888,8 @@ status collapsed
\change_inserted -712698321 1745588713
TheoremName
+\change_unchanged
+
\end_layout
\end_inset
@@ -16914,6 +16922,8 @@ status collapsed
\backslash
newtheorem
+\change_unchanged
+
\end_layout
\end_inset
@@ -16923,6 +16933,82 @@ newtheorem
\begin_layout Description
+\change_inserted -712698321 1745644962
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1745643926
+TheoremCrossRefName
+\end_layout
+
+\end_inset
+
+ The name used in the label of formatted cross-references to this theorem.
+ This is uses in cases where the cross-references package does not provide a
definition for a given theorem type.
+ Please always use the spelling with initial capitalization (e.
+\begin_inset space \thinspace{}
+\end_inset
+
+g.,
+
+\begin_inset Quotes eld
+\end_inset
+
+Theorem
+\begin_inset Quotes erd
+\end_inset
+
+).
+\end_layout
+
+\begin_layout Description
+
+\change_inserted -712698321 1745645040
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1745645504
+TheoremCrossRefPluralName
+\end_layout
+
+\end_inset
+
+ The plural form of
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1745644987
+TheoremCrossRefName
+\end_layout
+
+\end_inset
+
+ (e.
+\begin_inset space \thinspace{}
+\end_inset
+
+g.,
+
+\begin_inset Quotes eld
+\end_inset
+
+Criteria
+\begin_inset Quotes erd
+\end_inset
+
+).
+\change_unchanged
+
+\end_layout
+
+\begin_layout Description
+
\change_inserted -712698321 1745589135
\begin_inset Flex Code
status collapsed
@@ -16931,6 +17017,8 @@ status collapsed
\change_inserted -712698321 1745588892
TheoremZRefName
+\change_unchanged
+
\end_layout
\end_inset
@@ -16943,6 +17031,8 @@ status collapsed
\change_inserted -712698321 1745588888
TheoremName
+\change_unchanged
+
\end_layout
\end_inset
@@ -16979,6 +17069,8 @@ status collapsed
\change_inserted -712698321 1745589130
zref-clever
+\change_unchanged
+
\end_layout
\end_inset
@@ -16998,6 +17090,8 @@ status collapsed
\change_inserted -712698321 1745588591
TheoremCounter
+\change_unchanged
+
\end_layout
\end_inset
@@ -17028,6 +17122,8 @@ status collapsed
\backslash
newtheorem
+\change_unchanged
+
\end_layout
\end_inset
@@ -17051,6 +17147,8 @@ status collapsed
\backslash
newtheorem*
+\change_unchanged
+
\end_layout
\end_inset
@@ -17068,6 +17166,8 @@ status collapsed
\change_inserted -712698321 1745588776
TheoremParentCounter
+\change_unchanged
+
\end_layout
\end_inset
@@ -17080,6 +17180,8 @@ status collapsed
\change_inserted -712698321 1745588668
TheoremName
+\change_unchanged
+
\end_layout
\end_inset
@@ -17095,6 +17197,8 @@ status collapsed
\backslash
newtheorem
+\change_unchanged
+
\end_layout
\end_inset
@@ -17128,6 +17232,8 @@ status collapsed
\change_inserted -712698321 1745588834
TheoremStyle
+\change_unchanged
+
\end_layout
\end_inset
@@ -17140,6 +17246,8 @@ status collapsed
\change_inserted -712698321 1745588829
TheoremName
+\change_unchanged
+
\end_layout
\end_inset
diff --git a/lib/doc/de/Customization.lyx b/lib/doc/de/Customization.lyx
index 61a71a971d..1044fb14dc 100644
--- a/lib/doc/de/Customization.lyx
+++ b/lib/doc/de/Customization.lyx
@@ -15428,6 +15428,64 @@ newtheorem
\begin_inset Flex Code
status collapsed
+\begin_layout Plain Layout
+TheoremCrossRefName
+\end_layout
+
+\end_inset
+
+ Der Name,
+ der in der Marke formatierter Querverweise zu diesem Theorem verwendet wird.
+ Dies wird nur in den Fällen verwendet,
+ in denen das entsprechende Querverweis-Paket keine Definition für dieses
spezifische Theorem bietet.
+ Verwenden Sie hier stets Anfangsgroßschreibung (bspw.
+
+\begin_inset Quotes gld
+\end_inset
+
+Theorem
+\begin_inset Quotes grd
+\end_inset
+
+).
+\end_layout
+
+\begin_layout Description
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+TheoremCrossRefPluralName
+\end_layout
+
+\end_inset
+
+ Die Pluralform von
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+TheoremCrossRefName
+\end_layout
+
+\end_inset
+
+ (bspw.
+
+\begin_inset Quotes eld
+\end_inset
+
+Criteria
+\begin_inset Quotes erd
+\end_inset
+
+).
+\end_layout
+
+\begin_layout Description
+\begin_inset Flex Code
+status collapsed
+
\begin_layout Plain Layout
TheoremZRefName
\end_layout
diff --git a/lib/layouts/theorems-ams-bytype.inc
b/lib/layouts/theorems-ams-bytype.inc
index 633d250267..a3bbf37fdb 100644
--- a/lib/layouts/theorems-ams-bytype.inc
+++ b/lib/layouts/theorems-ams-bytype.inc
@@ -150,6 +150,8 @@ Style Conjecture
LabelString "Conjecture \theconjecture."
TheoremName conjecture
TheoremLaTeXName conjecturename
+ TheoremCrossRefName Conjecture
+ TheoremCrossRefPluralName Conjectures
TheoremZRefName none
LangPreamble
\providecommand{\conjecturename}{_(Conjecture)}
@@ -172,6 +174,8 @@ Style Fact
LabelString "Fact \thefact."
TheoremName fact
TheoremLaTeXName factname
+ TheoremCrossRefName Fact
+ TheoremCrossRefPluralName Facts
TheoremZRefName none
LangPreamble
\providecommand{\factname}{_(Fact)}
@@ -245,6 +249,8 @@ Style Problem
TheoremName problem
TheoremStyle definition
TheoremLaTeXName problemname
+ TheoremCrossRefName Problem
+ TheoremCrossRefPluralName Problems
TheoremZRefName none
LangPreamble
\providecommand{\problemname}{_(Problem)}
@@ -345,6 +351,8 @@ Style Claim
TheoremName claim
TheoremStyle remark
TheoremLaTeXName claimname
+ TheoremCrossRefName Claim
+ TheoremCrossRefPluralName Claims
TheoremZRefName none
LangPreamble
\providecommand{\claimname}{_(Claim)}
diff --git a/lib/layouts/theorems-ams-chap-bytype.inc
b/lib/layouts/theorems-ams-chap-bytype.inc
index 2e21b18e0d..edd76d85b9 100644
--- a/lib/layouts/theorems-ams-chap-bytype.inc
+++ b/lib/layouts/theorems-ams-chap-bytype.inc
@@ -220,6 +220,8 @@ Style Fact
TheoremName fact
TheoremLaTeXName factname
TheoremParentCounter chapter
+ TheoremCrossRefName Fact
+ TheoremCrossRefPluralName Facts
TheoremZRefName none
LangPreamble
\providecommand{\factname}{_(Fact)}
@@ -296,6 +298,8 @@ Style Problem
TheoremStyle definition
TheoremLaTeXName problemname
TheoremParentCounter chapter
+ TheoremCrossRefName Problem
+ TheoremCrossRefPluralName Problems
TheoremZRefName none
LangPreamble
\providecommand{\problemname}{_(Problem)}
@@ -400,6 +404,8 @@ Style Claim
TheoremStyle remark
TheoremLaTeXName claimname
TheoremParentCounter chapter
+ TheoremCrossRefName Claim
+ TheoremCrossRefPluralName Claims
TheoremZRefName none
LangPreamble
\providecommand{\claimname}{_(Claim)}
diff --git a/lib/layouts/theorems-ams-extended-bytype.module
b/lib/layouts/theorems-ams-extended-bytype.module
index 6abb4d594a..8a82d41c1f 100644
--- a/lib/layouts/theorems-ams-extended-bytype.module
+++ b/lib/layouts/theorems-ams-extended-bytype.module
@@ -43,6 +43,8 @@ Style Criterion
LabelString "Criterion \thecriterion."
TheoremName criterion
TheoremLaTeXName criterionname
+ TheoremCrossRefName Criterion
+ TheoremCrossRefPluralName Criteria
TheoremZRefName none
LangPreamble
\providecommand{\criterionname}{_(Criterion)}
@@ -120,6 +122,8 @@ Style Axiom
LabelString "Axiom \theaxiom."
TheoremName ax
TheoremLaTeXName axiomname
+ TheoremCrossRefName Axiom
+ TheoremCrossRefPluralName Axioms
TheoremZRefName none
LangPreamble
\providecommand{\axiomname}{_(Axiom)}
@@ -160,6 +164,8 @@ Style Condition
TheoremName condition
TheoremStyle definition
TheoremLaTeXName conditionname
+ TheoremCrossRefName Condition
+ TheoremCrossRefPluralName Conditions
TheoremZRefName none
LangPreamble
\providecommand{\conditionname}{_(Condition)}
@@ -239,6 +245,8 @@ Style Notation
TheoremName notation
TheoremStyle remark
TheoremLaTeXName notationname
+ TheoremCrossRefName Notation
+ TheoremCrossRefPluralName Notations
TheoremZRefName none
LangPreamble
\providecommand{\notationname}{_(Notation)}
@@ -280,6 +288,8 @@ Style Summary
TheoremName summary
TheoremStyle remark
TheoremLaTeXName summaryname
+ TheoremCrossRefName Summary
+ TheoremCrossRefPluralName Summaries
TheoremZRefName none
LangPreamble
\providecommand{\summaryname}{_(Summary)}
@@ -321,6 +331,8 @@ Style Conclusion
TheoremName conclusion
TheoremStyle remark
TheoremLaTeXName conclusionname
+ TheoremCrossRefName Conclusion
+ TheoremCrossRefPluralName Conclusions
TheoremZRefName none
LangPreamble
\providecommand{\conclusionname}{_(Conclusion)}
@@ -361,6 +373,8 @@ Style Assumption
LabelString "Assumption \theassumption."
TheoremName assumption
TheoremLaTeXName assumptionname
+ TheoremCrossRefName Assumption
+ TheoremCrossRefPluralName Assumptions
TheoremZRefName none
LangPreamble
\providecommand{\assumptionname}{_(Assumption)}
@@ -400,6 +414,8 @@ Style Question
LabelString "Question \thequestion."
TheoremName question
TheoremLaTeXName questionname
+ TheoremCrossRefName Question
+ TheoremCrossRefPluralName Questions
TheoremZRefName none
LangPreamble
\providecommand{\questionname}{_(Question)}
diff --git a/lib/layouts/theorems-ams-extended-chap-bytype.module
b/lib/layouts/theorems-ams-extended-chap-bytype.module
index 00994b3f88..e46f0b837b 100644
--- a/lib/layouts/theorems-ams-extended-chap-bytype.module
+++ b/lib/layouts/theorems-ams-extended-chap-bytype.module
@@ -78,6 +78,8 @@ Style Criterion
TheoremName criterion
TheoremLaTeXName criterionname
TheoremParentCounter chapter
+ TheoremCrossRefName Criterion
+ TheoremCrossRefPluralName Criteria
TheoremZRefName none
LangPreamble
\providecommand{\criterionname}{_(Criterion)}
@@ -158,6 +160,8 @@ Style Axiom
TheoremName ax
TheoremLaTeXName axiomname
TheoremParentCounter chapter
+ TheoremCrossRefName Axiom
+ TheoremCrossRefPluralName Axioms
TheoremZRefName none
LangPreamble
\providecommand{\axiomname}{_(Axiom)}
@@ -199,6 +203,8 @@ Style Condition
TheoremStyle definition
TheoremLaTeXName conditionname
TheoremParentCounter chapter
+ TheoremCrossRefName Condition
+ TheoremCrossRefPluralName Conditions
TheoremZRefName none
LangPreamble
\providecommand{\conditionname}{_(Condition)}
@@ -280,6 +286,8 @@ Style Notation
TheoremStyle remark
TheoremLaTeXName notationname
TheoremParentCounter chapter
+ TheoremCrossRefName Notation
+ TheoremCrossRefPluralName Notations
TheoremZRefName none
LangPreamble
\providecommand{\notationname}{_(Notation)}
@@ -322,6 +330,8 @@ Style Summary
TheoremStyle remark
TheoremLaTeXName summaryname
TheoremParentCounter chapter
+ TheoremCrossRefName Summary
+ TheoremCrossRefPluralName Summaries
TheoremZRefName none
LangPreamble
\providecommand{\summaryname}{_(Summary)}
@@ -364,6 +374,8 @@ Style Conclusion
TheoremStyle remark
TheoremLaTeXName conclusionname
TheoremParentCounter chapter
+ TheoremCrossRefName Conclusion
+ TheoremCrossRefPluralName Conclusions
TheoremZRefName none
LangPreamble
\providecommand{\conclusionname}{_(Conclusion)}
@@ -405,6 +417,8 @@ Style Assumption
TheoremName assumption
TheoremLaTeXName assumptionname
TheoremParentCounter chapter
+ TheoremCrossRefName Assumption
+ TheoremCrossRefPluralName Assumptions
TheoremZRefName none
LangPreamble
\providecommand{\assumptionname}{_(Assumption)}
@@ -445,6 +459,8 @@ Style Question
TheoremName question
TheoremLaTeXName questionname
TheoremParentCounter chapter
+ TheoremCrossRefName Question
+ TheoremCrossRefPluralName Questions
TheoremZRefName none
LangPreamble
\providecommand{\questionname}{_(Question)}
diff --git a/lib/layouts/theorems-ams-extended.module
b/lib/layouts/theorems-ams-extended.module
index fb048e3390..f75db1122c 100644
--- a/lib/layouts/theorems-ams-extended.module
+++ b/lib/layouts/theorems-ams-extended.module
@@ -40,6 +40,8 @@ Style Criterion
TheoremName criterion
TheoremCounter thm
TheoremLaTeXName criterionname
+ TheoremCrossRefName Criterion
+ TheoremCrossRefPluralName Criteria
TheoremZRefName none
LangPreamble
\providecommand{\criterionname}{_(Criterion)}
@@ -119,6 +121,8 @@ Style Axiom
TheoremName ax
TheoremCounter thm
TheoremLaTeXName axiomname
+ TheoremCrossRefName Axiom
+ TheoremCrossRefPluralName Axioms
TheoremZRefName none
LangPreamble
\providecommand{\axiomname}{_(Axiom)}
@@ -159,6 +163,8 @@ Style Condition
TheoremCounter thm
TheoremStyle definition
TheoremLaTeXName conditionname
+ TheoremCrossRefName Condition
+ TheoremCrossRefPluralName Conditions
TheoremZRefName none
LangPreamble
\providecommand{\conditionname}{_(Condition)}
@@ -238,6 +244,8 @@ Style Notation
TheoremCounter thm
TheoremStyle remark
TheoremLaTeXName notationname
+ TheoremCrossRefName Notation
+ TheoremCrossRefPluralName Notations
TheoremZRefName none
LangPreamble
\providecommand{\notationname}{_(Notation)}
@@ -279,6 +287,8 @@ Style Summary
TheoremCounter thm
TheoremStyle remark
TheoremLaTeXName summaryname
+ TheoremCrossRefName Summary
+ TheoremCrossRefPluralName Summaries
TheoremZRefName none
LangPreamble
\providecommand{\summaryname}{_(Summary)}
@@ -320,6 +330,8 @@ Style Conclusion
TheoremCounter thm
TheoremStyle remark
TheoremLaTeXName conclusionname
+ TheoremCrossRefName Conclusion
+ TheoremCrossRefPluralName Conclusions
TheoremZRefName none
LangPreamble
\providecommand{\conclusionname}{_(Conclusion)}
@@ -361,6 +373,8 @@ Style Assumption
TheoremName assumption
TheoremCounter thm
TheoremLaTeXName assumptionname
+ TheoremCrossRefName Assumption
+ TheoremCrossRefPluralName Assumptions
TheoremZRefName none
LangPreamble
\providecommand{\assumptionname}{_(Assumption)}
@@ -400,6 +414,8 @@ Style Question
TheoremName question
TheoremCounter thm
TheoremLaTeXName questionname
+ TheoremCrossRefName Question
+ TheoremCrossRefPluralName Questions
TheoremZRefName none
LangPreamble
\providecommand{\questionname}{_(Question)}
diff --git a/lib/layouts/theorems-ams.inc b/lib/layouts/theorems-ams.inc
index be8f31e471..0c825ec68d 100644
--- a/lib/layouts/theorems-ams.inc
+++ b/lib/layouts/theorems-ams.inc
@@ -152,6 +152,8 @@ Style Conjecture
TheoremName conjecture
TheoremCounter thm
TheoremLaTeXName conjecturename
+ TheoremCrossRefName Conjecture
+ TheoremCrossRefPluralName Conjectures
TheoremZRefName none
LangPreamble
\providecommand{\conjecturename}{_(Conjecture)}
@@ -175,6 +177,8 @@ Style Fact
TheoremName fact
TheoremCounter thm
TheoremLaTeXName factname
+ TheoremCrossRefName Fact
+ TheoremCrossRefPluralName Facts
TheoremZRefName none
LangPreamble
\providecommand{\factname}{_(Fact)}
@@ -249,6 +253,8 @@ Style Problem
TheoremStyle definition
TheoremCounter thm
TheoremLaTeXName problemname
+ TheoremCrossRefName Problem
+ TheoremCrossRefPluralName Problems
TheoremZRefName none
LangPreamble
\providecommand{\problemname}{_(Problem)}
@@ -350,6 +356,8 @@ Style Claim
TheoremStyle remark
TheoremCounter thm
TheoremLaTeXName claimname
+ TheoremCrossRefName Claim
+ TheoremCrossRefPluralName Claims
TheoremZRefName none
LangPreamble
\providecommand{\claimname}{_(Claim)}
diff --git a/lib/layouts/theorems-bytype.inc b/lib/layouts/theorems-bytype.inc
index 70e5579494..e148e8b24d 100644
--- a/lib/layouts/theorems-bytype.inc
+++ b/lib/layouts/theorems-bytype.inc
@@ -144,6 +144,8 @@ Style Conjecture
LabelString "Conjecture \theconjecture."
TheoremName conjecture
TheoremLaTeXName conjecturename
+ TheoremCrossRefName Conjecture
+ TheoremCrossRefPluralName Conjectures
TheoremZRefName none
LangPreamble
\providecommand{\conjecturename}{_(Conjecture)}
@@ -166,6 +168,8 @@ Style Fact
LabelString "Fact \thefact."
TheoremName fact
TheoremLaTeXName factname
+ TheoremCrossRefName Fact
+ TheoremCrossRefPluralName Facts
TheoremZRefName none
LangPreamble
\providecommand{\factname}{_(Fact)}
@@ -239,6 +243,8 @@ Style Problem
TheoremName problem
TheoremStyle definition
TheoremLaTeXName problemname
+ TheoremCrossRefName Problem
+ TheoremCrossRefPluralName Problems
TheoremZRefName none
LangPreamble
\providecommand{\problemname}{_(Problem)}
@@ -339,6 +345,8 @@ Style Claim
TheoremName claim
TheoremStyle remark
TheoremLaTeXName claimname
+ TheoremCrossRefName Claim
+ TheoremCrossRefPluralName Claims
TheoremZRefName none
LangPreamble
\providecommand{\claimname}{_(Claim)}
diff --git a/lib/layouts/theorems.inc b/lib/layouts/theorems.inc
index b42fda9b1c..43255036ef 100644
--- a/lib/layouts/theorems.inc
+++ b/lib/layouts/theorems.inc
@@ -153,6 +153,8 @@ Style Conjecture
TheoremName conjecture
TheoremCounter thm
TheoremLaTeXName conjecturename
+ TheoremCrossRefName Conjecture
+ TheoremCrossRefPluralName Conjectures
TheoremZRefName none
LangPreamble
\providecommand{\conjecturename}{_(Conjecture)}
@@ -176,6 +178,8 @@ Style Fact
TheoremName fact
TheoremCounter thm
TheoremLaTeXName factname
+ TheoremCrossRefName Fact
+ TheoremCrossRefPluralName Facts
TheoremZRefName none
LangPreamble
\providecommand{\factname}{_(Fact)}
@@ -250,6 +254,8 @@ Style Problem
TheoremStyle definition
TheoremCounter thm
TheoremLaTeXName problemname
+ TheoremCrossRefName Problem
+ TheoremCrossRefPluralName Problems
TheoremZRefName none
LangPreamble
\providecommand{\problemname}{_(Problem)}
@@ -351,6 +357,8 @@ Style Claim
TheoremStyle remark
TheoremCounter thm
TheoremLaTeXName claimname
+ TheoremCrossRefName Claim
+ TheoremCrossRefPluralName Claims
TheoremZRefName none
LangPreamble
\providecommand{\claimname}{_(Claim)}
diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py
index 747ef7ac62..176fd2643e 100644
--- a/lib/scripts/layout2layout.py
+++ b/lib/scripts/layout2layout.py
@@ -361,7 +361,8 @@ currentFormat = 108
# Incremented to format 108, 25 April 2025 by spitz
# New Layout tags "TheoremName", "TheoremZRefName",
-# "TheoremCounter", "TheoremParentCounter", "TheoremStyle"
+# "TheoremCounter", "TheoremParentCounter", "TheoremStyle",
+# "TheoremCrossRefName", "TheoremCrossRefPluralName"
# Do not forget to document format change in Customization
# Manual (section "Declaring a new text class").
diff --git a/po/lyx_pot.py b/po/lyx_pot.py
index 6a8ffb212d..3cd1ca52ed 100755
--- a/po/lyx_pot.py
+++ b/po/lyx_pot.py
@@ -92,6 +92,8 @@ def layouts_l10n(input_files, output, base,
layouttranslations):
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)
+ TheoremCrossRefName = re.compile(r'^\s*TheoremCrossRefName\s+(.*\S)\s*$',
re.IGNORECASE)
+ TheoremCrossRefPluralName =
re.compile(r'^\s*TheoremCrossRefPluralName\s+(.*\S)\s*$', re.IGNORECASE)
CategoryName = re.compile(r'^\s*Category\s+(.*\S)\s*$', re.IGNORECASE)
NameRE = re.compile(r'^\s*#\s*\\DeclareLyXModule.*{(.*)}$', re.IGNORECASE)
CiteNameRE = re.compile(r'^\s*#\s*\\DeclareLyXCiteEngine.*\{(.*)\}$',
re.IGNORECASE)
@@ -266,6 +268,18 @@ def layouts_l10n(input_files, output, base,
layouttranslations):
if not layouttranslations:
writeString(out, src, base, lineno, string)
continue
+ res = TheoremCrossRefName.search(line)
+ if res != None:
+ string = res.group(1)
+ writeString(out, src, base, lineno, string)
+ writeString(out, src, base, lineno, string.lower())
+ continue
+ res = TheoremCrossRefPluralName.search(line)
+ if res != None:
+ string = res.group(1)
+ writeString(out, src, base, lineno, string)
+ writeString(out, src, base, lineno, string.lower())
+ continue
res = OutlinerName.search(line)
if res != None:
string = res.group(2)
diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index 4e20a012e2..23075ddb2d 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -2207,6 +2207,27 @@ docstring const i18npreamble(docstring const & templ,
Language const * lang,
} // namespace
+docstring const LaTeXFeatures::getThmI18nDefs(Layout const & lay) const
+{
+ if (lay.thmName().empty())
+ return docstring();
+ if (params_.xref_package == "zref" && lay.thmZRefName() == "none" &&
!lay.thmXRefName().empty()) {
+ docstring const tn = from_utf8(lay.thmXRefName());
+ docstring const tnp = from_utf8(lay.thmXRefNamePl());
+ odocstringstream ods;
+ ods << "\\zcRefTypeSetup{"
+ << from_utf8(lay.thmName()) << "}{\n"
+ << "Name-sg = _(" << tn << "),\n"
+ << "name-sg = _(" << lowercase(tn) << "),\n"
+ << "Name-pl = _(" << tnp << "),\n"
+ << "name-pl = _(" << lowercase(tnp) << ")"
+ << "}\n";
+ return ods.str();
+ }
+ return docstring();
+}
+
+
docstring const LaTeXFeatures::getTClassI18nPreamble(bool use_babel,
bool use_polyglossia, bool use_minted) const
{
@@ -2220,11 +2241,17 @@ docstring const
LaTeXFeatures::getTClassI18nPreamble(bool use_babel,
list<docstring>::const_iterator cit = usedLayouts_.begin();
list<docstring>::const_iterator end = usedLayouts_.end();
for (; cit != end; ++cit) {
+ docstring const thmxref = getThmI18nDefs(tclass[*cit]);
// language dependent commands (once per document)
snippets.insert(i18npreamble(tclass[*cit].langpreamble(),
buffer().language(),
buffer().params().encoding(),
use_polyglossia, false));
+ if (!thmxref.empty())
+ snippets.insert(i18npreamble(thmxref,
+ buffer().language(),
+
buffer().params().encoding(),
+ use_polyglossia, false));
// commands for language changing (for multilanguage documents)
if ((use_babel || use_polyglossia) && !UsedLanguages_.empty()) {
snippets.insert(i18npreamble(
@@ -2232,12 +2259,18 @@ docstring const
LaTeXFeatures::getTClassI18nPreamble(bool use_babel,
buffer().language(),
buffer().params().encoding(),
use_polyglossia, false));
- for (lang_it lit = lbeg; lit != lend; ++lit)
+ for (lang_it lit = lbeg; lit != lend; ++lit) {
+ if (!thmxref.empty())
+ snippets.insert(i18npreamble(thmxref,
+ *lit,
+
buffer().params().encoding(),
+
use_polyglossia, false));
snippets.insert(i18npreamble(
tclass[*cit].babelpreamble(),
*lit,
buffer().params().encoding(),
use_polyglossia, false));
+ }
}
}
if ((use_babel || use_polyglossia) && !UsedLanguages_.empty()) {
diff --git a/src/LaTeXFeatures.h b/src/LaTeXFeatures.h
index 4d407b9b80..4a1c593b95 100644
--- a/src/LaTeXFeatures.h
+++ b/src/LaTeXFeatures.h
@@ -27,6 +27,7 @@ class Buffer;
class BufferParams;
class InsetLayout;
class Language;
+class Layout;
class otexstream;
class OutputParams;
struct TexString;
@@ -85,6 +86,8 @@ public:
std::string const loadAMSPackages() const;
/// The definitions needed by the document's textclass
docstring const getTClassPreamble() const;
+ /// Localizations for theorem reference defs
+ docstring const getThmI18nDefs(Layout const &) const;
/// The language dependent definitions needed by the document's
textclass
docstring const getTClassI18nPreamble(bool use_babel,
bool use_polyglossia, bool use_minted) const;
diff --git a/src/Layout.cpp b/src/Layout.cpp
index 2660fcbeb3..09626bbb22 100644
--- a/src/Layout.cpp
+++ b/src/Layout.cpp
@@ -99,6 +99,8 @@ enum LayoutTags {
LT_THM_COUNTER,
LT_THM_PARENTCOUNTER,
LT_THM_STYLE,
+ LT_THM_CROSSREFNAME,
+ LT_THM_CROSSREFNAMEPL,
LT_THM_ZREFNAME,
LT_HTMLTAG,
LT_HTMLATTR,
@@ -348,6 +350,8 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass
const & tclass,
{ "stepparentcounter", LT_STEPPARENTCOUNTER },
{ "textfont", LT_TEXTFONT },
{ "theoremcounter", LT_THM_COUNTER },
+ { "theoremcrossrefname", LT_THM_CROSSREFNAME },
+ { "theoremcrossrefpluralname", LT_THM_CROSSREFNAMEPL },
{ "theoremlatexname", LT_THM_LATEXNAME },
{ "theoremname", LT_THM_NAME },
{ "theoremparentcounter", LT_THM_PARENTCOUNTER },
@@ -594,6 +598,14 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass
const & tclass,
lex >> thm_style_;
break;
+ case LT_THM_CROSSREFNAME:
+ lex >> thm_xref_name_;
+ break;
+
+ case LT_THM_CROSSREFNAMEPL:
+ lex >> thm_xref_name_pl_;
+ break;
+
case LT_THM_ZREFNAME:
lex >> thm_zref_name_;
break;
@@ -1749,6 +1761,10 @@ void Layout::write(ostream & os) const
os << "\tTheoremParentCounter " << thm_parent_counter_ << '\n';
if (!thm_style_.empty())
os << "\tTheoremStyle " << thm_style_ << '\n';
+ if (!thm_xref_name_.empty())
+ os << "\tTheoremCrossRefName " << thm_xref_name_ << '\n';
+ if (!thm_xref_name_pl_.empty())
+ os << "\tTheoremCrossRefPluralName " << thm_xref_name_pl_ <<
'\n';
if (!thm_zref_name_.empty())
os << "\tTheoremZRefName " << thm_zref_name_ << '\n';
if (refprefix.empty())
diff --git a/src/Layout.h b/src/Layout.h
index 55ea1099f4..4722866b54 100644
--- a/src/Layout.h
+++ b/src/Layout.h
@@ -194,6 +194,10 @@ public:
///
std::string const & thmZRefName() const { return thm_zref_name_; }
///
+ std::string const & thmXRefName() const { return thm_xref_name_; }
+ ///
+ std::string const & thmXRefNamePl() const { return thm_xref_name_pl_; }
+ ///
std::string const & htmltag() const;
///
std::string const & htmlattr() const { return htmlattr_; }
@@ -524,6 +528,10 @@ private:
std::string thm_style_;
/// 6. zref-clever name
std::string thm_zref_name_;
+ /// 7. cross references name
+ std::string thm_xref_name_;
+ /// 8. cross references name (plural)
+ std::string thm_xref_name_pl_;
/// The interpretation of this tag varies depending upon the latextype.
/// In an environment, it is the tag enclosing all content for this set
of
/// paragraphs. So for quote, e.g,. it would be: blockquote. For
itemize,
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs