DocBook: add support for DocBookGenerateTitle.

The new parameter allows more flexibility when encoding some elements that have a poor mapping in DocBook, like theorems. The major use is to wrap the environment in a generic container, figure, which requires a title (but none is available).
This commit is contained in:
Thibaut Cuvelier 2022-12-22 04:38:36 +01:00
parent 69d54ff9d8
commit 16a1aa9901
15 changed files with 600 additions and 133 deletions

View File

@ -0,0 +1,148 @@
#LyX 2.4 created this file. For more info see https://www.lyx.org/
\lyxformat 613
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass article
\use_default_options true
\begin_modules
theorems-std
\end_modules
\maintain_unincluded_children no
\language american
\language_package default
\inputencoding utf8
\fontencoding auto
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_roman_osf false
\font_sans_osf false
\font_typewriter_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\float_placement class
\float_alignment class
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\use_lineno 0
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tablestyle default
\tracking_changes false
\output_changes false
\change_bars false
\postpone_fragile_content true
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\docbook_table_output 0
\docbook_mathml_prefix 1
\end_header
\begin_body
\begin_layout Title
Ensure that maths are properly converted in theorems
\end_layout
\begin_layout Standard
Equation outside environments:
\begin_inset Formula $\pi\,r^{2}$
\end_inset
.
\begin_inset Formula
\[
\pi\,\rho^{3}
\]
\end_inset
\end_layout
\begin_layout Theorem
This is a theorem:
hypothesis
\begin_inset Formula $a=b$
\end_inset
,
thesis
\begin_inset Formula
\[
a\neq b.
\]
\end_inset
Clear,
don't you think?
\end_layout
\begin_layout Proof
Left as exercise for the reader.
\end_layout
\begin_layout Remark
This is real math,
you know.
\begin_inset Formula $a=b=a$
\end_inset
.
\end_layout
\end_body
\end_document

View File

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- This DocBook file was created by LyX 2.4.0-beta2
See https://www.lyx.org/ for more information -->
<article xml:lang="en_US" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.2">
<title>Ensure that maths are properly converted in theorems</title>
<para>Equation outside environments: <inlineequation>
<alt role='tex'>\pi\,r^{2}</alt>
<m:math display="inline">
<m:mrow>
<m:mrow><m:mi>&#x3C0;</m:mi>
<m:mspace width="6px"/>
<m:msup>
<m:mi>r</m:mi>
<m:mn>2</m:mn>
</m:msup>
</m:mrow>
</m:mrow>
</m:math>
</inlineequation>.
<informalequation>
<alt role='tex'>\pi\,\rho^{3}</alt>
<m:math display="block">
<m:mrow>
<m:mrow><m:mi>&#x3C0;</m:mi>
<m:mspace width="6px"/>
<m:msup><m:mi>&#x3C1;</m:mi>
<m:mn>3</m:mn>
</m:msup>
</m:mrow>
</m:mrow>
</m:math>
</informalequation>
</para>
<figure role='theorem'>
<title>Theorem 1.</title>
<para>This is a theorem: hypothesis <inlineequation>
<alt role='tex'>a=b</alt>
<m:math display="inline">
<m:mrow>
<m:mrow>
<m:mi>a</m:mi>
<m:mo>=</m:mo>
<m:mi>b</m:mi>
</m:mrow>
</m:mrow>
</m:math>
</inlineequation>, thesis
<informalequation>
<alt role='tex'>a\neq b.</alt>
<m:math display="block">
<m:mrow>
<m:mrow>
<m:mi>a</m:mi><m:mo>&#x2260;</m:mo>
<m:mi>b</m:mi>
<m:mn>.</m:mn>
</m:mrow>
</m:mrow>
</m:math>
</informalequation>
Clear, don&#8217;t you think?</para>
</figure>
<para role='proof'>Left as exercise for the reader.</para>
<figure role='remark'>
<title>Remark 2.</title>
<para>This is real math, you know. <inlineequation>
<alt role='tex'>a=b=a</alt>
<m:math display="inline">
<m:mrow>
<m:mrow>
<m:mi>a</m:mi>
<m:mo>=</m:mo>
<m:mi>b</m:mi>
<m:mo>=</m:mo>
<m:mi>a</m:mi>
</m:mrow>
</m:mrow>
</m:math>
</inlineequation>.</para>
</figure>
</article>

View File

@ -333,8 +333,10 @@ Style Theorem
Shape Up
Series Bold
EndFont
DocBookWrapperTag figure
DocBookWrapperAttr role='theorem'
DocBookTag para
DocBookAttr role='theorem'
DocBookGenerateTitle true
End
@ -364,8 +366,10 @@ Style Proof
LabelFont
Series Bold
EndFont
DocBookWrapperTag figure
DocBookWrapperAttr role='proof'
DocBookTag para
DocBookAttr role='proof'
DocBookGenerateTitle true
End
@ -373,8 +377,10 @@ Style Lemma
CopyStyle Theorem
LatexName lem
LabelString "Lemma \arabic{theorem}"
DocBookWrapperTag figure
DocBookWrapperAttr role='lemma'
DocBookTag para
DocBookAttr role='lemma'
DocBookGenerateTitle true
End
@ -382,8 +388,10 @@ Style Corollary
CopyStyle Theorem
LatexName cor
LabelString "Corollary \arabic{theorem}"
DocBookWrapperTag figure
DocBookWrapperAttr role='corollary'
DocBookTag para
DocBookAttr role='corollary'
DocBookGenerateTitle true
End
@ -391,8 +399,10 @@ Style Proposition
CopyStyle Theorem
LatexName prop
LabelString "Proposition \arabic{theorem}"
DocBookWrapperTag figure
DocBookWrapperAttr role='proposition'
DocBookTag para
DocBookAttr role='proposition'
DocBookGenerateTitle true
End
@ -400,8 +410,10 @@ Style Criterion
CopyStyle Theorem
LatexName crit
LabelString "Criterion \arabic{theorem}"
DocBookWrapperTag figure
DocBookWrapperAttr role='criterion'
DocBookTag para
DocBookAttr role='criterion'
DocBookGenerateTitle true
End
@ -409,8 +421,10 @@ Style Algorithm
CopyStyle Theorem
LatexName alg
LabelString "Algorithm \arabic{theorem}"
DocBookWrapperTag figure
DocBookWrapperAttr role='algorithm'
DocBookTag para
DocBookAttr role='algorithm'
DocBookGenerateTitle true
End
@ -425,8 +439,10 @@ Style Definition
Shape Up
Series Bold
EndFont
DocBookWrapperTag figure
DocBookWrapperAttr role='definition'
DocBookTag para
DocBookAttr role='definition'
DocBookGenerateTitle true
End
@ -434,8 +450,10 @@ Style Conjecture
CopyStyle Theorem
LatexName conj
LabelString "Conjecture \arabic{theorem}"
DocBookWrapperTag figure
DocBookWrapperAttr role='conjecture'
DocBookTag para
DocBookAttr role='conjecture'
DocBookGenerateTitle true
End
@ -453,8 +471,10 @@ Style Problem
CopyStyle Theorem
LatexName prob
LabelString "Problem \arabic{theorem}"
DocBookWrapperTag figure
DocBookWrapperAttr role='problem'
DocBookTag para
DocBookAttr role='problem'
DocBookGenerateTitle true
End
@ -462,8 +482,10 @@ Style Remark
CopyStyle Theorem
LatexName rem
LabelString "Remark \arabic{theorem}"
DocBookTag note
DocBookItemTag para
DocBookWrapperTag figure
DocBookWrapperAttr role='remark'
DocBookTag para
DocBookGenerateTitle true
End
@ -471,8 +493,10 @@ Style Note
CopyStyle Theorem
LatexName note
LabelString "Note \arabic{theorem}"
DocBookWrapperTag figure
DocBookWrapperAttr role='note'
DocBookTag para
DocBookAttr role='note'
DocBookGenerateTitle true
End
@ -480,8 +504,10 @@ Style Claim
CopyStyle Theorem
LatexName claim
LabelString "Claim \arabic{theorem}"
DocBookWrapperTag figure
DocBookWrapperAttr role='claim'
DocBookTag para
DocBookAttr role='claim'
DocBookGenerateTitle true
End
@ -490,8 +516,10 @@ Style Summary
LatexName summ
LabelCounter summ
LabelString "Summary \arabic{summ}"
DocBookWrapperTag figure
DocBookWrapperAttr role='summary'
DocBookTag para
DocBookAttr role='summary'
DocBookGenerateTitle true
End
@ -500,8 +528,10 @@ Style Case
LatexName case
LabelCounter case
LabelString "Case \arabic{case}"
DocBookWrapperTag figure
DocBookWrapperAttr role='case'
DocBookTag para
DocBookAttr role='case'
DocBookGenerateTitle true
End

View File

@ -72,8 +72,10 @@ Style Theorem
\addto\captions$$lang{\renewcommand{\theoremname}{_(Theorem)}}
EndBabelPreamble
Requires amsthm
DocBookWrapperTag figure
DocBookWrapperAttr role='theorem'
DocBookTag para
DocBookAttr role='theorem'
DocBookGenerateTitle true
End
@ -92,8 +94,10 @@ Style Corollary
BabelPreamble
\addto\captions$$lang{\renewcommand{\corollaryname}{_(Corollary)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='corollary'
DocBookTag para
DocBookAttr role='corollary'
DocBookGenerateTitle true
End
@ -112,8 +116,10 @@ Style Lemma
\addto\captions$$lang{\renewcommand{\lemmaname}{_(Lemma)}}
EndBabelPreamble
LabelCounter lemma
DocBookWrapperTag figure
DocBookWrapperAttr role='lemma'
DocBookTag para
DocBookAttr role='lemma'
DocBookGenerateTitle true
End
@ -132,8 +138,10 @@ Style Proposition
\addto\captions$$lang{\renewcommand{\propositionname}{_(Proposition)}}
EndBabelPreamble
LabelCounter proposition
DocBookWrapperTag figure
DocBookWrapperAttr role='proposition'
DocBookTag para
DocBookAttr role='proposition'
DocBookGenerateTitle true
End
@ -152,8 +160,10 @@ Style Conjecture
\addto\captions$$lang{\renewcommand{\conjecturename}{_(Conjecture)}}
EndBabelPreamble
LabelCounter conjecture
DocBookWrapperTag figure
DocBookWrapperAttr role='conjecture'
DocBookTag para
DocBookAttr role='conjecture'
DocBookGenerateTitle true
End
@ -172,8 +182,10 @@ Style Fact
\addto\captions$$lang{\renewcommand{\factname}{_(Fact)}}
EndBabelPreamble
LabelCounter fact
DocBookWrapperTag figure
DocBookWrapperAttr role='fact'
DocBookTag para
DocBookAttr role='fact'
DocBookGenerateTitle true
End
@ -199,8 +211,10 @@ Style Definition
\addto\captions$$lang{\renewcommand{\definitionname}{_(Definition)}}
EndBabelPreamble
LabelCounter definition
DocBookWrapperTag figure
DocBookWrapperAttr role='definition'
DocBookTag para
DocBookAttr role='definition'
DocBookGenerateTitle true
End
@ -222,7 +236,7 @@ Style Example
LabelCounter example
DocBookWrapperTag informalexample
DocBookTag para
DocBookAttr ""
DocBookAttr ""
End
@ -242,8 +256,10 @@ Style Problem
\addto\captions$$lang{\renewcommand{\problemname}{_(Problem)}}
EndBabelPreamble
LabelCounter problem
DocBookWrapperTag figure
DocBookWrapperAttr role='problem'
DocBookTag para
DocBookAttr role='problem'
DocBookGenerateTitle true
End
@ -263,8 +279,10 @@ Style Exercise
\addto\captions$$lang{\renewcommand{\exercisename}{_(Exercise)}}
EndBabelPreamble
LabelCounter exercise
DocBookWrapperTag figure
DocBookWrapperAttr role='exercise'
DocBookTag para
DocBookAttr role='exercise'
DocBookGenerateTitle true
End
@ -284,8 +302,10 @@ Style Solution
\addto\captions$$lang{\renewcommand{\solutionname}{_(Solution)}}
EndBabelPreamble
LabelCounter solution
DocBookWrapperTag figure
DocBookWrapperAttr role='solution'
DocBookTag para
DocBookAttr role='solution'
DocBookGenerateTitle true
End
@ -312,8 +332,10 @@ Style Remark
\addto\captions$$lang{\renewcommand{\remarkname}{_(Remark)}}
EndBabelPreamble
LabelCounter remark
DocBookTag note
DocBookItemTag para
DocBookWrapperTag figure
DocBookWrapperAttr role='remark'
DocBookTag para
DocBookGenerateTitle true
End
@ -333,9 +355,10 @@ Style Claim
\addto\captions$$lang{\renewcommand{\claimname}{_(Claim)}}
EndBabelPreamble
LabelCounter claim
DocBookWrapperTag figure
DocBookWrapperAttr role='claim'
DocBookTag para
DocBookAttr role='claim'
DocBookItemTag ""
DocBookGenerateTitle true
End
Input theorems-case.inc

View File

@ -118,8 +118,10 @@ Style Theorem
\addto\captions$$lang{\renewcommand{\theoremname}{_(Theorem)}}
EndBabelPreamble
Requires amsthm
DocBookWrapperTag figure
DocBookWrapperAttr role='theorem'
DocBookTag para
DocBookAttr role='theorem'
DocBookGenerateTitle true
End
@ -142,8 +144,10 @@ Style Corollary
BabelPreamble
\addto\captions$$lang{\renewcommand{\corollaryname}{_(Corollary)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='corollary'
DocBookTag para
DocBookAttr role='corollary'
DocBookGenerateTitle true
End
@ -166,8 +170,10 @@ Style Lemma
\addto\captions$$lang{\renewcommand{\lemmaname}{_(Lemma)}}
EndBabelPreamble
LabelCounter lemma
DocBookWrapperTag figure
DocBookWrapperAttr role='lemma'
DocBookTag para
DocBookAttr role='lemma'
DocBookGenerateTitle true
End
@ -190,8 +196,10 @@ Style Proposition
\addto\captions$$lang{\renewcommand{\propositionname}{_(Proposition)}}
EndBabelPreamble
LabelCounter proposition
DocBookWrapperTag figure
DocBookWrapperAttr role='proposition'
DocBookTag para
DocBookAttr role='proposition'
DocBookGenerateTitle true
End
@ -214,8 +222,10 @@ Style Conjecture
\addto\captions$$lang{\renewcommand{\conjecturename}{_(Conjecture)}}
EndBabelPreamble
LabelCounter conjecture
DocBookWrapperTag figure
DocBookWrapperAttr role='conjecture'
DocBookTag para
DocBookAttr role='conjecture'
DocBookGenerateTitle true
End
@ -238,8 +248,10 @@ Style Fact
\addto\captions$$lang{\renewcommand{\factname}{_(Fact)}}
EndBabelPreamble
LabelCounter fact
DocBookWrapperTag figure
DocBookWrapperAttr role='fact'
DocBookTag para
DocBookAttr role='fact'
DocBookGenerateTitle true
End
@ -269,8 +281,10 @@ Style Definition
\addto\captions$$lang{\renewcommand{\definitionname}{_(Definition)}}
EndBabelPreamble
LabelCounter definition
DocBookWrapperTag figure
DocBookWrapperAttr role='definition'
DocBookTag para
DocBookAttr role='definition'
DocBookGenerateTitle true
End
@ -296,7 +310,7 @@ Style Example
LabelCounter example
DocBookWrapperTag informalexample
DocBookTag para
DocBookAttr ""
DocBookAttr ""
End
@ -320,8 +334,10 @@ Style Problem
\addto\captions$$lang{\renewcommand{\problemname}{_(Problem)}}
EndBabelPreamble
LabelCounter problem
DocBookWrapperTag figure
DocBookWrapperAttr role='problem'
DocBookTag para
DocBookAttr role='problem'
DocBookGenerateTitle true
End
@ -345,8 +361,10 @@ Style Exercise
\addto\captions$$lang{\renewcommand{\exercisename}{_(Exercise)}}
EndBabelPreamble
LabelCounter exercise
DocBookWrapperTag figure
DocBookWrapperAttr role='exercise'
DocBookTag para
DocBookAttr role='exercise'
DocBookGenerateTitle true
End
@ -370,8 +388,10 @@ Style Solution
\addto\captions$$lang{\renewcommand{\solutionname}{_(Solution)}}
EndBabelPreamble
LabelCounter solution
DocBookWrapperTag figure
DocBookWrapperAttr role='solution'
DocBookTag para
DocBookAttr role='solution'
DocBookGenerateTitle true
End
@ -402,8 +422,10 @@ Style Remark
\addto\captions$$lang{\renewcommand{\remarkname}{_(Remark)}}
EndBabelPreamble
LabelCounter remark
DocBookTag note
DocBookItemTag para
DocBookWrapperTag figure
DocBookWrapperAttr role='remark'
DocBookTag para
DocBookGenerateTitle true
End
@ -427,9 +449,10 @@ Style Claim
\addto\captions$$lang{\renewcommand{\claimname}{_(Claim)}}
EndBabelPreamble
LabelCounter claim
DocBookWrapperTag figure
DocBookWrapperAttr role='claim'
DocBookTag para
DocBookAttr role='claim'
DocBookItemTag ""
DocBookGenerateTitle true
End

View File

@ -69,8 +69,10 @@ Style Theorem
\addto\captions$$lang{\renewcommand{\theoremname}{_(Theorem)}}
EndBabelPreamble
Requires amsthm
DocBookWrapperTag figure
DocBookWrapperAttr role='theorem'
DocBookTag para
DocBookAttr role='theorem'
DocBookGenerateTitle true
End
@ -89,8 +91,10 @@ Style Corollary
BabelPreamble
\addto\captions$$lang{\renewcommand{\corollaryname}{_(Corollary)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='corollary'
DocBookTag para
DocBookAttr role='corollary'
DocBookGenerateTitle true
End
@ -109,8 +113,10 @@ Style Lemma
BabelPreamble
\addto\captions$$lang{\renewcommand{\lemmaname}{_(Lemma)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='lemma'
DocBookTag para
DocBookAttr role='lemma'
DocBookGenerateTitle true
End
@ -129,8 +135,10 @@ Style Proposition
BabelPreamble
\addto\captions$$lang{\renewcommand{\propositionname}{_(Proposition)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='proposition'
DocBookTag para
DocBookAttr role='proposition'
DocBookGenerateTitle true
End
@ -149,8 +157,10 @@ Style Conjecture
BabelPreamble
\addto\captions$$lang{\renewcommand{\conjecturename}{_(Conjecture)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='conjecture'
DocBookTag para
DocBookAttr role='conjecture'
DocBookGenerateTitle true
End
@ -169,8 +179,10 @@ Style Fact
BabelPreamble
\addto\captions$$lang{\renewcommand{\factname}{_(Fact)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='fact'
DocBookTag para
DocBookAttr role='fact'
DocBookGenerateTitle true
End
@ -196,8 +208,10 @@ Style Definition
BabelPreamble
\addto\captions$$lang{\renewcommand{\definitionname}{_(Definition)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='definition'
DocBookTag para
DocBookAttr role='definition'
DocBookGenerateTitle true
End
@ -235,8 +249,10 @@ Style Problem
BabelPreamble
\addto\captions$$lang{\renewcommand{\problemname}{_(Problem)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='problem'
DocBookTag para
DocBookAttr role='problem'
DocBookGenerateTitle true
End
@ -254,8 +270,10 @@ Style Exercise
BabelPreamble
\addto\captions$$lang{\renewcommand{\exercisename}{_(Exercise)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='exercise'
DocBookTag para
DocBookAttr role='exercise'
DocBookGenerateTitle true
End
@ -273,8 +291,10 @@ Style Solution
BabelPreamble
\addto\captions$$lang{\renewcommand{\solutionname}{_(Solution)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='solution'
DocBookTag para
DocBookAttr role='solution'
DocBookGenerateTitle true
End
@ -301,8 +321,10 @@ Style Remark
BabelPreamble
\addto\captions$$lang{\renewcommand{\remarkname}{_(Remark)}}
EndBabelPreamble
DocBookTag note
DocBookItemTag para
DocBookWrapperTag figure
DocBookWrapperAttr role='remark'
DocBookTag para
DocBookGenerateTitle true
End
@ -320,9 +342,10 @@ Style Claim
BabelPreamble
\addto\captions$$lang{\renewcommand{\claimname}{_(Claim)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='claim'
DocBookTag para
DocBookAttr role='claim'
DocBookItemTag ""
DocBookGenerateTitle true
End
Input theorems-case.inc

View File

@ -66,8 +66,10 @@ Style Theorem
\addto\captions$$lang{\renewcommand{\theoremname}{_(Theorem)}}
EndBabelPreamble
Requires amsthm
DocBookWrapperTag figure
DocBookWrapperAttr role='theorem'
DocBookTag para
DocBookAttr role='theorem'
DocBookGenerateTitle true
End
@ -86,8 +88,10 @@ Style Corollary
\addto\captions$$lang{\renewcommand{\corollaryname}{_(Corollary)}}
EndBabelPreamble
LabelCounter corollary
DocBookWrapperTag figure
DocBookWrapperAttr role='corollary'
DocBookTag para
DocBookAttr role='corollary'
DocBookGenerateTitle true
End
@ -106,8 +110,10 @@ Style Lemma
\addto\captions$$lang{\renewcommand{\lemmaname}{_(Lemma)}}
EndBabelPreamble
LabelCounter lemma
DocBookWrapperTag figure
DocBookWrapperAttr role='lemma'
DocBookTag para
DocBookAttr role='lemma'
DocBookGenerateTitle true
End
@ -126,8 +132,10 @@ Style Proposition
\addto\captions$$lang{\renewcommand{\propositionname}{_(Proposition)}}
EndBabelPreamble
LabelCounter proposition
DocBookWrapperTag figure
DocBookWrapperAttr role='proposition'
DocBookTag para
DocBookAttr role='proposition'
DocBookGenerateTitle true
End
@ -146,8 +154,10 @@ Style Conjecture
\addto\captions$$lang{\renewcommand{\conjecturename}{_(Conjecture)}}
EndBabelPreamble
LabelCounter conjecture
DocBookWrapperTag figure
DocBookWrapperAttr role='conjecture'
DocBookTag para
DocBookAttr role='conjecture'
DocBookGenerateTitle true
End
@ -166,8 +176,10 @@ Style Fact
\addto\captions$$lang{\renewcommand{\factname}{_(Fact)}}
EndBabelPreamble
LabelCounter fact
DocBookWrapperTag figure
DocBookWrapperAttr role='fact'
DocBookTag para
DocBookAttr role='fact'
DocBookGenerateTitle true
End
@ -193,8 +205,10 @@ Style Definition
\addto\captions$$lang{\renewcommand{\definitionname}{_(Definition)}}
EndBabelPreamble
LabelCounter definition
DocBookWrapperTag figure
DocBookWrapperAttr role='definition'
DocBookTag para
DocBookAttr role='definition'
DocBookGenerateTitle true
End
@ -216,7 +230,7 @@ Style Example
LabelCounter example
DocBookWrapperTag informalexample
DocBookTag para
DocBookAttr ""
DocBookAttr ""
End
@ -236,8 +250,10 @@ Style Problem
\addto\captions$$lang{\renewcommand{\problemname}{_(Problem)}}
EndBabelPreamble
LabelCounter problem
DocBookWrapperTag figure
DocBookWrapperAttr role='problem'
DocBookTag para
DocBookAttr role='problem'
DocBookGenerateTitle true
End
@ -257,8 +273,10 @@ Style Exercise
\addto\captions$$lang{\renewcommand{\exercisename}{_(Exercise)}}
EndBabelPreamble
LabelCounter exercise
DocBookWrapperTag figure
DocBookWrapperAttr role='exercise'
DocBookTag para
DocBookAttr role='exercise'
DocBookGenerateTitle true
End
@ -278,8 +296,10 @@ Style Solution
\addto\captions$$lang{\renewcommand{\solutionname}{_(Solution)}}
EndBabelPreamble
LabelCounter solution
DocBookWrapperTag figure
DocBookWrapperAttr role='solution'
DocBookTag para
DocBookAttr role='solution'
DocBookGenerateTitle true
End
@ -306,8 +326,10 @@ Style Remark
\addto\captions$$lang{\renewcommand{\remarkname}{_(Remark)}}
EndBabelPreamble
LabelCounter remark
DocBookTag note
DocBookItemTag para
DocBookWrapperTag figure
DocBookWrapperAttr role='remark'
DocBookTag para
DocBookGenerateTitle true
End
@ -327,9 +349,10 @@ Style Claim
\addto\captions$$lang{\renewcommand{\claimname}{_(Claim)}}
EndBabelPreamble
LabelCounter claim
DocBookWrapperTag figure
DocBookWrapperAttr role='claim'
DocBookTag para
DocBookAttr role='claim'
DocBookItemTag ""
DocBookGenerateTitle true
End
Input theorems-case.inc

View File

@ -19,6 +19,9 @@
# - Claim
# - Proof
# TODO: for DocBook, there is no difference with standard (not starred) environments.
# How to encode the subtlety?
Format 98
OutlinerName thm "Definitions & Theorems"
@ -67,8 +70,10 @@ Style Theorem*
\addto\captions$$lang{\renewcommand{\theoremname}{_(Theorem)}}
EndBabelPreamble
Requires amsthm
DocBookWrapperTag figure
DocBookWrapperAttr role='theorem'
DocBookTag para
DocBookAttr role='theorem'
DocBookGenerateTitle true
End
@ -86,8 +91,10 @@ Style Corollary*
BabelPreamble
\addto\captions$$lang{\renewcommand{\corollaryname}{_(Corollary)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='corollary'
DocBookTag para
DocBookAttr role='corollary'
DocBookGenerateTitle true
End
@ -105,8 +112,10 @@ Style Lemma*
BabelPreamble
\addto\captions$$lang{\renewcommand{\lemmaname}{_(Lemma)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='lemma'
DocBookTag para
DocBookAttr role='lemma'
DocBookGenerateTitle true
End
@ -124,8 +133,10 @@ Style Proposition*
BabelPreamble
\addto\captions$$lang{\renewcommand{\propositionname}{_(Proposition)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='proposition'
DocBookTag para
DocBookAttr role='proposition'
DocBookGenerateTitle true
End
@ -143,8 +154,10 @@ Style Conjecture*
BabelPreamble
\addto\captions$$lang{\renewcommand{\conjecturename}{_(Conjecture)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='conjecture'
DocBookTag para
DocBookAttr role='conjecture'
DocBookGenerateTitle true
End
@ -162,8 +175,10 @@ Style Fact*
BabelPreamble
\addto\captions$$lang{\renewcommand{\factname}{_(Fact)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='fact'
DocBookTag para
DocBookAttr role='fact'
DocBookGenerateTitle true
End
@ -189,8 +204,10 @@ Style Definition*
BabelPreamble
\addto\captions$$lang{\renewcommand{\definitionname}{_(Definition)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='definition'
DocBookTag para
DocBookAttr role='definition'
DocBookGenerateTitle true
End
@ -210,7 +227,7 @@ Style Example*
EndBabelPreamble
DocBookWrapperTag informalexample
DocBookTag para
DocBookAttr ""
DocBookAttr ""
End
@ -228,8 +245,10 @@ Style Problem*
BabelPreamble
\addto\captions$$lang{\renewcommand{\problemname}{_(Problem)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='problem'
DocBookTag para
DocBookAttr role='problem'
DocBookGenerateTitle true
End
@ -247,8 +266,10 @@ Style Exercise*
BabelPreamble
\addto\captions$$lang{\renewcommand{\exercisename}{_(Exercise)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='exercise'
DocBookTag para
DocBookAttr role='exercise'
DocBookGenerateTitle true
End
@ -266,8 +287,10 @@ Style Solution*
BabelPreamble
\addto\captions$$lang{\renewcommand{\solutionname}{_(Solution)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='solution'
DocBookTag para
DocBookAttr role='solution'
DocBookGenerateTitle true
End
@ -293,8 +316,10 @@ Style Remark*
BabelPreamble
\addto\captions$$lang{\renewcommand{\remarkname}{_(Remark)}}
EndBabelPreamble
DocBookTag note
DocBookItemTag para
DocBookWrapperTag figure
DocBookWrapperAttr role='remark'
DocBookTag para
DocBookGenerateTitle true
End
@ -312,8 +337,9 @@ Style Claim*
BabelPreamble
\addto\captions$$lang{\renewcommand{\claimname}{_(Claim)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='claim'
DocBookTag para
DocBookAttr role='claim'
DocBookItemTag ""
DocBookGenerateTitle true
End

View File

@ -74,8 +74,10 @@ Style Theorem
BabelPreamble
\addto\captions$$lang{\renewcommand{\theoremname}{_(Theorem)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='theorem'
DocBookTag para
DocBookAttr role='theorem'
DocBookGenerateTitle true
End
@ -93,8 +95,10 @@ Style Corollary
BabelPreamble
\addto\captions$$lang{\renewcommand{\corollaryname}{_(Corollary)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='corollary'
DocBookTag para
DocBookAttr role='corollary'
DocBookGenerateTitle true
End
@ -112,8 +116,10 @@ Style Lemma
BabelPreamble
\addto\captions$$lang{\renewcommand{\lemmaname}{_(Lemma)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='lemma'
DocBookTag para
DocBookAttr role='lemma'
DocBookGenerateTitle true
End
@ -131,8 +137,10 @@ Style Proposition
BabelPreamble
\addto\captions$$lang{\renewcommand{\propositionname}{_(Proposition)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='proposition'
DocBookTag para
DocBookAttr role='proposition'
DocBookGenerateTitle true
End
@ -150,8 +158,10 @@ Style Prop
LabelFont
Series Medium
EndFont
DocBookWrapperTag figure
DocBookWrapperAttr role='proposition'
DocBookTag para
DocBookAttr role='proposition'
DocBookGenerateTitle true
End
@ -176,8 +186,10 @@ Style Conjecture
BabelPreamble
\addto\captions$$lang{\renewcommand{\conjecturename}{_(Conjecture)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='conjecture'
DocBookTag para
DocBookAttr role='conjecture'
DocBookGenerateTitle true
End
@ -195,8 +207,10 @@ Style Fact
BabelPreamble
\addto\captions$$lang{\renewcommand{\factname}{_(Fact)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='fact'
DocBookTag para
DocBookAttr role='fact'
DocBookGenerateTitle true
End
@ -222,8 +236,10 @@ Style Definition
BabelPreamble
\addto\captions$$lang{\renewcommand{\definitionname}{_(Definition)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='definition'
DocBookTag para
DocBookAttr role='definition'
DocBookGenerateTitle true
End
@ -244,7 +260,7 @@ Style Example
EndBabelPreamble
DocBookWrapperTag informalexample
DocBookTag para
DocBookAttr ""
DocBookAttr ""
End
@ -264,8 +280,10 @@ Style Problem
BabelPreamble
\addto\captions$$lang{\renewcommand{\problemname}{_(Problem)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='problem'
DocBookTag para
DocBookAttr role='problem'
DocBookGenerateTitle true
End
@ -299,8 +317,10 @@ Style Prob
EndFont
AddToToc thm
IsTocCaption true
DocBookWrapperTag figure
DocBookWrapperAttr role='problem'
DocBookTag para
DocBookAttr role='problem'
DocBookGenerateTitle true
End
@ -319,8 +339,10 @@ Style Solution
BabelPreamble
\addto\captions$$lang{\renewcommand{\solutionname}{_(Solution)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='solution'
DocBookTag para
DocBookAttr role='solution'
DocBookGenerateTitle true
End
@ -335,8 +357,10 @@ Style Sol
Tooltip "Label of the corresponding problem"
IsTocCaption true
EndArgument
DocBookWrapperTag figure
DocBookWrapperAttr role='solution'
DocBookTag para
DocBookAttr role='solution'
DocBookGenerateTitle true
End
@ -355,8 +379,10 @@ Style Exercise
BabelPreamble
\addto\captions$$lang{\renewcommand{\exercisename}{_(Exercise)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='exercise'
DocBookTag para
DocBookAttr role='exercise'
DocBookGenerateTitle true
End
@ -375,8 +401,10 @@ Style Remark
BabelPreamble
\addto\captions$$lang{\renewcommand{\remarkname}{_(Remark)}}
EndBabelPreamble
DocBookTag note
DocBookItemTag para
DocBookWrapperTag figure
DocBookWrapperAttr role='remark'
DocBookTag para
DocBookGenerateTitle true
End
@ -390,9 +418,10 @@ Style Claim
BabelPreamble
\addto\captions$$lang{\renewcommand{\claimname}{_(Claim)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='claim'
DocBookTag para
DocBookAttr role='claim'
DocBookItemTag ""
DocBookGenerateTitle true
End
@ -411,8 +440,10 @@ Style Case
BabelPreamble
\addto\captions$$lang{\renewcommand{\casename}{_(Case)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='case'
DocBookTag para
DocBookAttr role='case'
DocBookGenerateTitle true
End
@ -431,8 +462,10 @@ Style Property
BabelPreamble
\addto\captions$$lang{\renewcommand{\propertyname}{_(Property)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='property'
DocBookTag para
DocBookAttr role='property'
DocBookGenerateTitle true
End
@ -451,8 +484,10 @@ Style Question
BabelPreamble
\addto\captions$$lang{\renewcommand{\questionname}{_(Question)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='question'
DocBookTag para
DocBookAttr role='question'
DocBookGenerateTitle true
End
@ -471,7 +506,9 @@ Style Note
BabelPreamble
\addto\captions$$lang{\renewcommand{\notename}{_(Note)}}
EndBabelPreamble
DocBookTag note
DocBookItemTag para
DocBookWrapperTag figure
DocBookWrapperAttr role='note'
DocBookTag para
DocBookGenerateTitle true
End

View File

@ -69,8 +69,10 @@ Style Theorem
\addto\captions$$lang{\renewcommand{\theoremname}{_(Theorem)}}
EndBabelPreamble
Requires amsthm
DocBookWrapperTag figure
DocBookWrapperAttr role='theorem'
DocBookTag para
DocBookAttr role='theorem'
DocBookGenerateTitle true
End
@ -89,8 +91,10 @@ Style Corollary
BabelPreamble
\addto\captions$$lang{\renewcommand{\corollaryname}{_(Corollary)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='corollary'
DocBookTag para
DocBookAttr role='corollary'
DocBookGenerateTitle true
End
@ -109,8 +113,10 @@ Style Lemma
BabelPreamble
\addto\captions$$lang{\renewcommand{\lemmaname}{_(Lemma)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='lemma'
DocBookTag para
DocBookAttr role='lemma'
DocBookGenerateTitle true
End
@ -129,8 +135,10 @@ Style Proposition
BabelPreamble
\addto\captions$$lang{\renewcommand{\propositionname}{_(Proposition)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='proposition'
DocBookTag para
DocBookAttr role='proposition'
DocBookGenerateTitle true
End
@ -149,8 +157,10 @@ Style Conjecture
BabelPreamble
\addto\captions$$lang{\renewcommand{\conjecturename}{_(Conjecture)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='conjecture'
DocBookTag para
DocBookAttr role='conjecture'
DocBookGenerateTitle true
End
@ -169,8 +179,10 @@ Style Fact
BabelPreamble
\addto\captions$$lang{\renewcommand{\factname}{_(Fact)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='fact'
DocBookTag para
DocBookAttr role='fact'
DocBookGenerateTitle true
End
@ -196,8 +208,10 @@ Style Definition
BabelPreamble
\addto\captions$$lang{\renewcommand{\definitionname}{_(Definition)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='definition'
DocBookTag para
DocBookAttr role='definition'
DocBookGenerateTitle true
End
@ -235,8 +249,10 @@ Style Problem
BabelPreamble
\addto\captions$$lang{\renewcommand{\problemname}{_(Problem)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='problem'
DocBookTag para
DocBookAttr role='problem'
DocBookGenerateTitle true
End
@ -254,8 +270,10 @@ Style Exercise
BabelPreamble
\addto\captions$$lang{\renewcommand{\exercisename}{_(Exercise)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='exercise'
DocBookTag para
DocBookAttr role='exercise'
DocBookGenerateTitle true
End
@ -273,8 +291,10 @@ Style Solution
BabelPreamble
\addto\captions$$lang{\renewcommand{\solutionname}{_(Solution)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='solution'
DocBookTag para
DocBookAttr role='solution'
DocBookGenerateTitle true
End
@ -301,8 +321,10 @@ Style Remark
BabelPreamble
\addto\captions$$lang{\renewcommand{\remarkname}{_(Remark)}}
EndBabelPreamble
DocBookTag note
DocBookItemTag para
DocBookWrapperTag figure
DocBookWrapperAttr role='remark'
DocBookTag para
DocBookGenerateTitle true
End
@ -320,9 +342,10 @@ Style Claim
BabelPreamble
\addto\captions$$lang{\renewcommand{\claimname}{_(Claim)}}
EndBabelPreamble
DocBookWrapperTag figure
DocBookWrapperAttr role='claim'
DocBookTag para
DocBookAttr role='claim'
DocBookItemTag ""
DocBookGenerateTitle true
End
Input theorems-case.inc

View File

@ -11,7 +11,7 @@
# This script will update a .layout file to current format
# The latest layout format is also defined in src/TextClass.cpp
currentFormat = 98
currentFormat = 99
# Incremented to format 4, 6 April 2007, lasgouttes
@ -331,6 +331,9 @@ currentFormat = 98
# Incremented to format 98, 5 December 2022 by rikiheck
# Add HTMLClass for InsetLayout
# Incremented to format 99, 22 December 2022 by tcuvelier
# Add DocBookGenerateTitle for Layout
# Do not forget to document format change in Customization
# Manual (section "Declaring a new text class").
@ -578,7 +581,7 @@ def convert(lines, end_format):
i += 1
continue
if 87 <= format <= 97:
if 87 <= format <= 98:
# nothing to do.
i += 1
continue

View File

@ -111,6 +111,7 @@ enum LayoutTags {
LT_DOCBOOKINNERTAGTYPE,
LT_DOCBOOKININFO,
LT_DOCBOOKABSTRACT,
LT_DOCBOOKGENERATETITLE,
LT_DOCBOOKWRAPPERTAG,
LT_DOCBOOKWRAPPERATTR,
LT_DOCBOOKWRAPPERTAGTYPE,
@ -240,6 +241,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass,
{ "docbookabstract", LT_DOCBOOKABSTRACT },
{ "docbookattr", LT_DOCBOOKATTR },
{ "docbookforceabstracttag", LT_DOCBOOKFORCEABSTRACTTAG },
{ "docbookgeneratetitle", LT_DOCBOOKGENERATETITLE },
{ "docbookininfo", LT_DOCBOOKININFO },
{ "docbookinnerattr", LT_DOCBOOKINNERATTR },
{ "docbookinnertag", LT_DOCBOOKINNERTAG },
@ -872,6 +874,10 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass,
lex >> docbooknofontinside_;
break;
case LT_DOCBOOKGENERATETITLE:
lex >> docbookgeneratetitle_;
break;
case LT_SPELLCHECK:
lex >> spellcheck;
break;

View File

@ -265,6 +265,8 @@ public:
///
bool docbooknofontinside() const { return docbooknofontinside_; }
///
bool docbookgeneratetitle() const { return docbookgeneratetitle_; }
///
bool isParagraph() const { return latextype == LATEX_PARAGRAPH; }
///
bool isCommand() const { return latextype == LATEX_COMMAND; }
@ -587,10 +589,14 @@ private:
bool docbookabstract_;
/// Whether this element (root or not) does not accept text without a section (i.e. the first text that is met
/// in LyX must be considered as the abstract if this is true); this text must be output with the specific tag
/// held by this attribute
/// held by this attribute.
mutable std::string docbookforceabstracttag_;
/// Whether font tags are allowed inside this tag.
bool docbooknofontinside_ = false;
/// Whether LyX should create a title on its own, just after the wrapper tag. Typically, this parameter is required
/// because the wrapper tag requires a title (like a figure). The generated title will be similar to a LyXHTML label
/// (environment type and a number).
bool docbookgeneratetitle_ = false;
/// Should we generate the default CSS for this layout, even if HTMLStyle
/// has been given? Default is false.
/// Note that the default CSS is output first, then the user CSS, so it is

View File

@ -59,7 +59,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 = 98; // rikiheck: HTMLClass for InsetLayout
int const LAYOUT_FORMAT = 99; // tcuvelier: add docbookgeneratetitle
// Layout format for the current lyx file format. Controls which format is

View File

@ -200,9 +200,18 @@ void openParTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar
}
// Main logic.
if (openWrapper)
if (openWrapper) {
xml::openTag(xs, lay.docbookwrappertag(), lay.docbookwrapperattr(), lay.docbookwrappertagtype());
if (lay.docbookgeneratetitle()) {
docstring const label = par->params().labelString();
xml::openTag(xs, "title", "", "paragraph");
xs << (!label.empty() ? label : from_ascii("No title"));
xml::closeTag(xs, "title", "paragraph");
}
}
const string & tag = lay.docbooktag();
if (tag != "NONE") {
auto xmltag = xml::ParTag(tag, lay.docbookattr());
@ -508,7 +517,9 @@ void makeEnvironment(Text const &text,
std::vector<docstring> pars_prepend;
std::vector<docstring> pars;
std::vector<docstring> pars_append;
tie(pars_prepend, pars, pars_append) = par->simpleDocBookOnePar(buf, runparams, text.outerFont(std::distance(text.paragraphs().begin(), par)), 0, false, ignoreFonts);
tie(pars_prepend, pars, pars_append) =
par->simpleDocBookOnePar(buf, runparams, text.outerFont(std::distance(text.paragraphs().begin(), par)),
0, false, ignoreFonts);
for (docstring const & parXML : pars_prepend)
xs << XMLStream::ESCAPE_NONE << parXML;