mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
DocBook: output inline equations in their own paragraph if they are the only inset of the paragraph.
It's invalid to have an <inlineequation> outside a paragraph. Another solution would have been to change InsetMathHull::docbook to generate an <informalequation>, but that function would have required more knowledge about its context than now. Need more tests to determine if <inlineequation> should only be output for hullSimple or in more cases like: const static std::set<HullType> inlineHulls = { hullUnknown, hullNone, hullSimple, hullEquation, hullMultline, hullGather, hullRegexp };
This commit is contained in:
parent
3a452a240b
commit
739735ab73
324
autotests/export/docbook/doc_de_Math.lyx
Normal file
324
autotests/export/docbook/doc_de_Math.lyx
Normal file
@ -0,0 +1,324 @@
|
||||
#LyX 2.4 created this file. For more info see https://www.lyx.org/
|
||||
\lyxformat 599
|
||||
\begin_document
|
||||
\begin_header
|
||||
\save_transient_properties true
|
||||
\origin unavailable
|
||||
\textclass scrartcl
|
||||
\begin_preamble
|
||||
% DO NOT ALTER THIS PREAMBLE!!!
|
||||
%
|
||||
% This preamble is designed to ensure that the file prints
|
||||
% out as advertised. If you mess with this preamble,
|
||||
% parts of this document may not print out as expected. If you
|
||||
% have problems LaTeXing this file, please contact
|
||||
% the documentation team
|
||||
% email: lyx-docs@lists.lyx.org
|
||||
|
||||
% Folgendes Problem lösen:
|
||||
% Besteht die Kapitelnummer aus zu vielen Ziffern, wird die
|
||||
% Kapitelüberschrift im Inhaltsverzeichnis direkt an oder über
|
||||
% die Kapitelnummer geschrieben.
|
||||
% Als Lösung wird mehr Platz zwischen Nummer und
|
||||
% Überschrift eingefügt.
|
||||
\renewcommand{\l@subsection}{\@dottedtocline{2}{1.5em}{2.8em}}
|
||||
\renewcommand{\l@subsubsection}{\@dottedtocline{3}{4.3em}{3.6em}}
|
||||
|
||||
% Linkfläche für Querverweise vergrößern und automatisch benennen,
|
||||
\AtBeginDocument{\renewcommand{\ref}[1]{\mbox{\autoref{#1}}}}
|
||||
\@ifpackageloaded{babel}{
|
||||
\addto\extrasngerman{%
|
||||
\renewcommand*{\equationautorefname}[1]{}%
|
||||
\renewcommand{\sectionautorefname}{Kap.\negthinspace}%
|
||||
\renewcommand{\subsectionautorefname}{Kap.\negthinspace}%
|
||||
\renewcommand{\subsubsectionautorefname}{Kap.\negthinspace}%
|
||||
}
|
||||
}{}
|
||||
|
||||
% Makros damit Pakete nicht doppelt geladen werden.
|
||||
% siehe erste Fußnote in Kap. 9.3
|
||||
\@ifundefined{textcolor}{\usepackage{color}}{}
|
||||
|
||||
% Die Seiten des Inhaltsverzeichnisses werden römisch numeriert,
|
||||
% ein PDF-Lesezeichen für das Inhaltsverzeichnis wird hinzugefügt
|
||||
\pagenumbering{roman}
|
||||
\let\myTOC\tableofcontents
|
||||
\renewcommand{\tableofcontents}{%
|
||||
\vspace{1cm}
|
||||
\pdfbookmark[1]{\contentsname}{}
|
||||
\myTOC
|
||||
\cleardoublepage
|
||||
\pagenumbering{arabic}}
|
||||
|
||||
% add 0.5 mm vertical space for table rows
|
||||
\@ifundefined{extrarowheight} {\usepackage{array}}{}
|
||||
\setlength{\extrarowheight}{0.5mm}
|
||||
|
||||
% Damit die Fußnoten einen zusätzlichen vertikalen Abstand von 1,5 mm haben,
|
||||
\let\myFoot\footnote
|
||||
\renewcommand{\footnote}[1]{\myFoot{#1\vspace{1.5mm}}}
|
||||
|
||||
% macht Beschriftungen fett
|
||||
\setkomafont{captionlabel}{\bfseries}
|
||||
|
||||
% enables calculation of values
|
||||
\usepackage{calc}
|
||||
|
||||
% für Mehrfachzeilen, benutzt in Kap. 24.7
|
||||
\usepackage{multicol}
|
||||
|
||||
% benutzt in Kap. 19.4
|
||||
\usepackage{remreset}
|
||||
|
||||
% für das Fourier-Transformationssymbol
|
||||
\usepackage{mathrsfs}
|
||||
|
||||
% Farbdefinition aus Kap. 9.3
|
||||
\definecolor{dunkelgruen}{cmyk}{0.5, 0, 1, 0.5}
|
||||
|
||||
% Operatoren deklarieren (siehe Kap. 10.4 und 15.2)
|
||||
\DeclareMathOperator*{\Raute}{\blacklozenge}
|
||||
\DeclareMathOperator{\sgn}{sgn}
|
||||
|
||||
% Beispielbefehle aus Kap. 20.1
|
||||
\newcommand{\gr}{\Longrightarrow}
|
||||
\newcommand{\us}[1]{\underline{#1}}
|
||||
\newcommand{\fb}[3]{\framebox#1#2{$#3$}}
|
||||
\newcommand{\cb}[3][white]{\fcolorbox{#2}{#1}{$#3$}}
|
||||
\newcommand{\fracS}[3][]{\genfrac{}{}{#1}{}{#2}{#3}}
|
||||
|
||||
% Beispielmakro aus Kap. 19.4
|
||||
%\AtBeginDocument{
|
||||
%\def\tagform@#1{\maketag@@@{|#1|}}
|
||||
%}
|
||||
|
||||
\@ifpackageloaded{babel}{
|
||||
% Damit der Index einen anderen Namen erhält.
|
||||
\addto\captionsngerman
|
||||
{\renewcommand{\indexname}
|
||||
{Stichwort- und Befehlsverzeichnis}}
|
||||
}{}
|
||||
|
||||
% ------------------------------------
|
||||
% used to check for needed LaTeX packages
|
||||
\usepackage{ifthen}
|
||||
|
||||
% testen ob das Paket undertilde installiert ist
|
||||
% wird benutzt für den Befehl \utilde
|
||||
\newboolean{undertilde}
|
||||
\IfFileExists{undertilde.sty}
|
||||
{\usepackage{undertilde}
|
||||
\setboolean{undertilde}{true}}
|
||||
{\setboolean{undertilde}{false}}
|
||||
|
||||
% testen ob das Paket eurosym installiert ist
|
||||
% wird benutzt für das Euro-Symbol
|
||||
\newboolean{eurosym}
|
||||
\IfFileExists{eurosym.sty}
|
||||
{\usepackage[gennarrow]{eurosym}
|
||||
\setboolean{eurosym}{true}}
|
||||
{\setboolean{eurosym}{false}}
|
||||
|
||||
% testen ob Paket braket installiert ist
|
||||
% benötigt für physikalische Vektoren
|
||||
\newboolean{braket}
|
||||
\IfFileExists{braket.sty}
|
||||
{\usepackage{braket}
|
||||
\setboolean{braket}{true}}
|
||||
{\setboolean{braket}{false}}
|
||||
|
||||
% testen ob Paket cancel installiert ist
|
||||
\newboolean{cancel}
|
||||
\IfFileExists{cancel.sty}
|
||||
{\usepackage{cancel}
|
||||
\setboolean{cancel}{true}}
|
||||
{\setboolean{cancel}{false}}
|
||||
|
||||
% testen ob Paket upgreek installiert ist
|
||||
\newboolean{upgreek}
|
||||
\IfFileExists{upgreek.sty}
|
||||
{\usepackage{upgreek}
|
||||
\setboolean{upgreek}{true}}
|
||||
{\setboolean{upgreek}{false}}
|
||||
|
||||
% benötigt für Kommas in Formeln, siehe Kap. 22.3
|
||||
\IfFileExists{icomma.sty}
|
||||
{\usepackage{icomma}}{}
|
||||
% Added by lyx2lyx
|
||||
\setlength{\parskip}{\medskipamount}
|
||||
\setlength{\parindent}{0pt}
|
||||
\end_preamble
|
||||
\options bibliography=totoc,index=totoc,BCOR7.5mm,titlepage,captions=tableheading
|
||||
\use_default_options false
|
||||
\begin_modules
|
||||
subequations
|
||||
\end_modules
|
||||
\maintain_unincluded_children no
|
||||
\language ngerman
|
||||
\language_package default
|
||||
\inputencoding utf8
|
||||
\fontencoding auto
|
||||
\font_roman "lmodern" "default"
|
||||
\font_sans "lmss" "default"
|
||||
\font_typewriter "lmtt" "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 false
|
||||
\graphics default
|
||||
\default_output_format pdf2
|
||||
\output_sync 0
|
||||
\bibtex_command default
|
||||
\index_command makeindex
|
||||
\paperfontsize 12
|
||||
\spacing single
|
||||
\use_hyperref true
|
||||
\pdf_title "LyXs Mathehandbuch"
|
||||
\pdf_author "LyX Team, Uwe Stöhr"
|
||||
\pdf_subject "LyX-Dokumentation der Mathefunktionen"
|
||||
\pdf_keywords "LyX, Mathed"
|
||||
\pdf_bookmarks true
|
||||
\pdf_bookmarksnumbered true
|
||||
\pdf_bookmarksopen true
|
||||
\pdf_bookmarksopenlevel 1
|
||||
\pdf_breaklinks false
|
||||
\pdf_pdfborder false
|
||||
\pdf_colorlinks true
|
||||
\pdf_backref false
|
||||
\pdf_pdfusetitle false
|
||||
\pdf_quoted_options "linkcolor=black, citecolor=black, urlcolor=blue, filecolor=blue, pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false"
|
||||
\papersize a4
|
||||
\use_geometry false
|
||||
\use_package amsmath 2
|
||||
\use_package amssymb 2
|
||||
\use_package cancel 1
|
||||
\use_package esint 1
|
||||
\use_package mathdots 1
|
||||
\use_package mathtools 2
|
||||
\use_package mhchem 1
|
||||
\use_package stackrel 1
|
||||
\use_package stmaryrd 1
|
||||
\use_package undertilde 0
|
||||
\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 0
|
||||
\use_minted 0
|
||||
\use_lineno 0
|
||||
\notefontcolor #0000ff
|
||||
\index Stichwortverzeichnis
|
||||
\shortcut idx
|
||||
\color #008000
|
||||
\end_index
|
||||
\secnumdepth 4
|
||||
\tocdepth 3
|
||||
\paragraph_separation indent
|
||||
\paragraph_indentation default
|
||||
\is_math_indent 0
|
||||
\math_numbering_side default
|
||||
\quotes_style german
|
||||
\dynamic_quotes 0
|
||||
\papercolumns 1
|
||||
\papersides 2
|
||||
\paperpagestyle plain
|
||||
\tablestyle default
|
||||
\bullet 1 0 6 -1
|
||||
\bullet 2 2 35 -1
|
||||
\bullet 3 2 7 -1
|
||||
\tracking_changes false
|
||||
\output_changes false
|
||||
\change_bars false
|
||||
\postpone_fragile_content false
|
||||
\html_math_output 0
|
||||
\html_css_as_file 0
|
||||
\html_be_strict false
|
||||
\docbook_table_output 0
|
||||
\end_header
|
||||
|
||||
\begin_body
|
||||
|
||||
\begin_layout Title
|
||||
\SpecialChar LyX
|
||||
' detailliertes Mathe Handbuch
|
||||
\end_layout
|
||||
|
||||
\begin_layout Section
|
||||
Grundlegende Funktionen
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsection
|
||||
Fortsetzungspunkte
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
Z.
|
||||
\begin_inset space \thinspace{}
|
||||
\end_inset
|
||||
|
||||
B.
|
||||
ergibt der Befehl
|
||||
\series bold
|
||||
A
|
||||
\backslash
|
||||
dotfill
|
||||
\begin_inset space \textvisiblespace{}
|
||||
\end_inset
|
||||
|
||||
B
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_inset Formula $A\dotfill B$
|
||||
\end_inset
|
||||
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
Analog dazu gibt es für eine Linie den Befehl
|
||||
\series bold
|
||||
|
||||
\backslash
|
||||
hrulefill
|
||||
\series default
|
||||
|
||||
\begin_inset Index idx
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
Befehle ! H !
|
||||
\backslash
|
||||
hrulefill
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
:
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_inset Formula $A\hrulefill B$
|
||||
\end_inset
|
||||
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
Um die Befehle für Text zu verwenden, müssen sie im \SpecialChar TeX
|
||||
-Modus eingegeben werden.
|
||||
\end_layout
|
||||
|
||||
\end_body
|
||||
\end_document
|
23
autotests/export/docbook/doc_de_Math.xml
Normal file
23
autotests/export/docbook/doc_de_Math.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- This DocBook file was created by LyX 2.4.0dev
|
||||
See http://www.lyx.org/ for more information -->
|
||||
<article xml:lang="de_DE" 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>LyX' detailliertes Mathe Handbuch</title>
|
||||
<section>
|
||||
<title>Grundlegende Funktionen</title>
|
||||
<section>
|
||||
<title>Fortsetzungspunkte</title>
|
||||
<para>Z. B. ergibt der Befehl <emphasis role='bold'>A\dotfill␣B</emphasis></para>
|
||||
<para><inlineequation>
|
||||
<alt role='tex'>A\dotfill B</alt>
|
||||
<mathphrase>MathML export failed. Please report this as a bug.</mathphrase>
|
||||
</inlineequation></para>
|
||||
<para>Analog dazu gibt es für eine Linie den Befehl <emphasis role='bold'>\hrulefill</emphasis><indexterm><primary>Befehle</primary><secondary>H</secondary><tertiary>\textbackslash hrulefill</tertiary></indexterm>:</para>
|
||||
<para><inlineequation>
|
||||
<alt role='tex'>A\hrulefill B</alt>
|
||||
<mathphrase>MathML export failed. Please report this as a bug.</mathphrase>
|
||||
</inlineequation></para>
|
||||
<para>Um die Befehle für Text zu verwenden, müssen sie im TeX-Modus eingegeben werden.</para>
|
||||
</section>
|
||||
</section>
|
||||
</article>
|
@ -27,6 +27,7 @@
|
||||
#include "insets/InsetBibtex.h"
|
||||
#include "insets/InsetBibitem.h"
|
||||
#include "insets/InsetLabel.h"
|
||||
#include "mathed/InsetMath.h"
|
||||
#include "insets/InsetNote.h"
|
||||
|
||||
#include "support/lassert.h"
|
||||
@ -447,8 +448,9 @@ void makeParagraph(
|
||||
// Plain layouts must be ignored.
|
||||
special_case |= buf.params().documentClass().isPlainLayout(par->layout()) && !runparams.docbook_force_pars;
|
||||
// Equations do not deserve their own paragraph (DocBook allows them outside paragraphs).
|
||||
// Exception: any case that generates an <inlineequation> must still get a paragraph to be valid.
|
||||
special_case |= nInsets == (size_t) par->size() && std::all_of(par->insetList().begin(), par->insetList().end(), [](InsetList::Element inset) {
|
||||
return inset.inset && inset.inset->asInsetMath();
|
||||
return inset.inset && inset.inset->asInsetMath() && inset.inset->asInsetMath()->getType() != hullSimple;
|
||||
});
|
||||
|
||||
// TODO: Could get rid of this with a DocBook equivalent to htmlisblock? Not for all cases, unfortunately... See above for those that have been determined not to be allowable for this potential refactoring.
|
||||
|
Loading…
Reference in New Issue
Block a user