DocBook: new lines around formulae.

This commit is contained in:
Thibaut Cuvelier 2020-08-31 00:21:12 +02:00
parent e995414917
commit 91982ee105
2 changed files with 24 additions and 17 deletions

View File

@ -1,21 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- This DocBook file was created by LyX 2.4.0dev <!-- This DocBook file was created by LyX 2.4.0dev
See http://www.lyx.org/ for more information --> See http://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.1"> <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>Test document</title> <title>Test document</title>
<para>A formula: <para>A formula:
<informalequation> <informalequation>
<m:math> <alt role='tex'>\Vert,\vert</alt>
<m:alt role='tex'>\Vert,\vert</m:alt> <m:math>
<m:mrow> <m:mrow>
<m:mrow><m:mi>&#x2225;</m:mi><m:mo>,</m:mo><m:mi>&#x007C;</m:mi> <m:mrow><m:mi>&#x2225;</m:mi><m:mo>,</m:mo><m:mi>&#x007C;</m:mi>
</m:mrow> </m:mrow>
</m:mrow> </m:mrow>
</m:math> </m:math>
</informalequation>A second formula: </informalequation>
<informalequation> A second formula:
<m:math> <informalequation>
<m:alt role='tex'>\left\Vert \mathbf{a^{T}\,x}\right\Vert _{2}\leq x_{0}</m:alt> <alt role='tex'>\left\Vert \mathbf{a^{T}\,x}\right\Vert _{2}\leq x_{0}</alt>
<m:math>
<m:mrow> <m:mrow>
<m:mrow> <m:mrow>
<m:msub> <m:msub>
@ -45,7 +48,7 @@
</m:msub> </m:msub>
</m:mrow> </m:mrow>
</m:mrow> </m:mrow>
</m:math> </m:math>
</informalequation></para> </informalequation>
</para>
</article> </article>

View File

@ -2418,13 +2418,11 @@ void InsetMathHull::docbook(XMLStream & xs, OutputParams const & runparams) cons
{ {
// Choose the tag around the MathML equation. // Choose the tag around the MathML equation.
docstring name; docstring name;
bool doCR = false;
if (getType() == hullSimple) if (getType() == hullSimple)
name = from_ascii("inlineequation"); name = from_ascii("inlineequation");
else { else {
// This is a block equation, always have <informalequation> on its own line. doCR = true; // This is a block equation, always have <informalequation> on its own line.
if (!xs.isLastTagCR())
xs << xml::CR();
name = from_ascii("informalequation"); name = from_ascii("informalequation");
} }
@ -2439,6 +2437,10 @@ void InsetMathHull::docbook(XMLStream & xs, OutputParams const & runparams) cons
} }
} }
if (doCR)
if (!xs.isLastTagCR())
xs << xml::CR();
xs << xml::StartTag(name, attr); xs << xml::StartTag(name, attr);
xs << xml::CR(); xs << xml::CR();
@ -2485,6 +2487,8 @@ void InsetMathHull::docbook(XMLStream & xs, OutputParams const & runparams) cons
xs << XMLStream::ESCAPE_NONE << osmath.str(); xs << XMLStream::ESCAPE_NONE << osmath.str();
xs << xml::CR(); xs << xml::CR();
xs << xml::EndTag(name); xs << xml::EndTag(name);
if (doCR)
xs << xml::CR();
} }