[LyX features/feature/docbook] ru Beamer: make absolute path relative

Scott Kostyshak skostysh at lyx.org
Sat Sep 12 22:09:44 UTC 2020


The branch, feature/docbook, has been updated.
  discards  c8e76e78e7db859455bfd91dc24af7a1a79257da (commit)
  discards  e432855a30661e5e8a786b146cfb9aee2717e524 (commit)
  discards  ffef28772219aedf874a0747518116d144ddc3e5 (commit)
  discards  8456ff160df443656ba51dfdd1ff34cfc5188e7a (commit)
  discards  510299ae4a96ffb734192b2e5ec36949457811bb (commit)
  discards  71f8d419e4ca3114e6e527725b673e580e713040 (commit)
  discards  e00770d1e9f94a82b8c3719167480ab2b15ce049 (commit)
  discards  c15863a8a62d3bd167bb9213b34545e0a2742dad (commit)
  discards  6011a6eb0ef6eb393ea6e1c9e9fde4e2d696e93c (commit)
  discards  a74c1963559feef65a5342714e248d4b4c65beb7 (commit)
  discards  604ba1b77e788d2c5c865cb59c81aaec36dcd43f (commit)
  discards  67784de1f95ca4bc3225e24778d715b2f8007c6d (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (c8e76e78e7db859455bfd91dc24af7a1a79257da)
            \
             N -- N -- N (98f92809874d68dc6c329cfd81a409331bc68d81)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

- Log -----------------------------------------------------------------

commit 98f92809874d68dc6c329cfd81a409331bc68d81
Author: Scott Kostyshak <skostysh at lyx.org>
Date:   Fri Sep 11 00:51:10 2020 -0400

    ru Beamer: make absolute path relative
    
    (cherry picked from commit 6a5f1f380e5e988367fdb0ffa86e5177ff88e3ff)

diff --git a/lib/examples/ru/Presentations/Beamer.lyx b/lib/examples/ru/Presentations/Beamer.lyx
index 3a8acc3..d91272e 100644
--- a/lib/examples/ru/Presentations/Beamer.lyx
+++ b/lib/examples/ru/Presentations/Beamer.lyx
@@ -124,7 +124,7 @@ status collapsed
 
 \begin_layout TitleGraphic
 \begin_inset Graphics
-	filename C:/Program Files (x86)/LyX 2.3/Resources/doc/clipart/3D-structure-distort.pdf
+	filename ../../../doc/clipart/3D-structure-distort.pdf
 	lyxscale 30
 	scale 10
 

commit 46f12f6a97e633a1776b10abe46369740efaa88d
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Sat Sep 12 03:21:08 2020 +0200

    DocBook: fix output in Layout::write.

diff --git a/lib/layouts/aastex.layout b/lib/layouts/aastex.layout
index 78089a4..37dbd07 100644
--- a/lib/layouts/aastex.layout
+++ b/lib/layouts/aastex.layout
@@ -204,7 +204,7 @@ Style Altaffilation
 	  Color		green
 	EndFont
 	DocBookTag                        affiliation
-	DocBookAttr                       role="alternate"
+	DocBookAttr                       role='alternate'
 	DocBookWrapperTag                 author
 	DocBookWrapperMergeWithPrevious   true
 	DocBookItemTag                    orgname
diff --git a/lib/layouts/shapepar.module b/lib/layouts/shapepar.module
index 6b38cdf..2b2fbfe 100644
--- a/lib/layouts/shapepar.module
+++ b/lib/layouts/shapepar.module
@@ -36,50 +36,50 @@ Style "CD label"
 	Align		Block
 	LabelType	No_Label
 	DocBookWrapperTag  sidebar
-	DocBookWrapperAttr role="cd-label"
+	DocBookWrapperAttr role='cd-label'
 	DocBookTag  para
 End
 
 Style "Circle"
 	CopyStyle	"CD label"
 	LatexName	circlepar
-	DocBookWrapperAttr role="circle"
+	DocBookWrapperAttr role='circle'
 End
 
 Style "Diamond"
 	CopyStyle	"CD label"
 	LatexName	diamondpar
-	DocBookWrapperAttr role="diamond"
+	DocBookWrapperAttr role='diamond'
 End
 
 Style "Heart"
 	CopyStyle	"CD label"
 	LatexName	heartpar
-	DocBookWrapperAttr role="heart"
+	DocBookWrapperAttr role='heart'
 End
 
 Style "Hexagon"
 	CopyStyle	"CD label"
 	LatexName	hexagonpar
-	DocBookWrapperAttr role="hexagon"
+	DocBookWrapperAttr role='hexagon'
 End
 
 Style "Nut"
 	CopyStyle	"CD label"
 	LatexName	nutpar
-	DocBookWrapperAttr role="nut"
+	DocBookWrapperAttr role='nut'
 End
 
 Style "Square"
 	CopyStyle	"CD label"
 	LatexName	squarepar
-	DocBookWrapperAttr role="square"
+	DocBookWrapperAttr role='square'
 End
 
 Style "Star"
 	CopyStyle	"CD label"
 	LatexName	starpar
-	DocBookWrapperAttr role="star"
+	DocBookWrapperAttr role='star'
 End
 
 # now the shapes defined in the .def files
@@ -87,49 +87,49 @@ End
 Style "Candle"
 	CopyStyle	"CD label"
 	LatexName	shapepar{\candle}
-	DocBookWrapperAttr role="candle"
+	DocBookWrapperAttr role='candle'
 End
 
 Style "Drop down"
 	CopyStyle	"CD label"
 	LatexName	droppar
-	DocBookWrapperAttr role="drop-down"
+	DocBookWrapperAttr role='drop-down'
 End
 
 Style "Drop up"
 	CopyStyle	"CD label"
 	LatexName	dropuppar
-	DocBookWrapperAttr role="drop-up"
+	DocBookWrapperAttr role='drop-up'
 End
 
 Style "TeX"
 	CopyStyle	"CD label"
 	LatexName	shapepar{\TeXshape}
-	DocBookWrapperAttr role="tex"
+	DocBookWrapperAttr role='tex'
 End
 
 Style "Triangle up"
 	CopyStyle	"CD label"
 	LatexName	triangleuppar
-	DocBookWrapperAttr role="triangle-up"
+	DocBookWrapperAttr role='triangle-up'
 End
 
 Style "Triangle down"
 	CopyStyle	"CD label"
 	LatexName	triangledownpar
-	DocBookWrapperAttr role="triangle-down"
+	DocBookWrapperAttr role='triangle-down'
 End
 
 Style "Triangle left"
 	CopyStyle	"CD label"
 	LatexName	triangleleftpar
-	DocBookWrapperAttr role="triangle-left"
+	DocBookWrapperAttr role='triangle-left'
 End
 
 Style "Triangle right"
 	CopyStyle	"CD label"
 	LatexName	trianglerightpar
-	DocBookWrapperAttr role="triangle-right"
+	DocBookWrapperAttr role='triangle-right'
 End
 
 # finally the low-level commands
diff --git a/lib/layouts/stdstarsections.inc b/lib/layouts/stdstarsections.inc
index 60354b1..0159b07 100644
--- a/lib/layouts/stdstarsections.inc
+++ b/lib/layouts/stdstarsections.inc
@@ -49,7 +49,7 @@ Style Section*
 	LabelCounter	""
 	ResetArgs       1
 	DocBookTag            bridgehead
-	DocBookAttr           renderas="sect1"
+	DocBookAttr           renderas='sect1'
 	DocBookSectionTag     NONE
 	DocBookForceAbstractTag	NONE
 End
@@ -64,7 +64,7 @@ Style Subsection*
 	LabelCounter	""
 	ResetArgs       1
 	DocBookTag            bridgehead
-	DocBookAttr           renderas="sect2"
+	DocBookAttr           renderas='sect2'
 	DocBookSectionTag     NONE
 	DocBookForceAbstractTag	NONE
 End
@@ -79,7 +79,7 @@ Style Subsubsection*
 	LabelCounter	""
 	ResetArgs       1
 	DocBookTag            bridgehead
-	DocBookAttr           renderas="sect3"
+	DocBookAttr           renderas='sect3'
 	DocBookSectionTag     NONE
 	DocBookForceAbstractTag	NONE
 End
@@ -94,7 +94,7 @@ Style Paragraph*
 	LabelCounter	""
 	ResetArgs       1
 	DocBookTag            bridgehead
-	DocBookAttr           renderas="sect4"
+	DocBookAttr           renderas='sect4'
 	DocBookSectionTag     NONE
 	DocBookForceAbstractTag	NONE
 End
@@ -109,7 +109,7 @@ Style Subparagraph*
 	LabelCounter	""
 	ResetArgs       1
 	DocBookTag            bridgehead
-	DocBookAttr           renderas="sect5"
+	DocBookAttr           renderas='sect5'
 	DocBookSectionTag     NONE
 	DocBookForceAbstractTag	NONE
 End
diff --git a/src/Layout.cpp b/src/Layout.cpp
index 102410d..f5e6f77 100644
--- a/src/Layout.cpp
+++ b/src/Layout.cpp
@@ -1643,7 +1643,7 @@ void Layout::write(ostream & os) const
 	if(!docbooktag_.empty())
 		os << "\tDocBookTag " << docbooktag_ << '\n';
 	if(!docbookattr_.empty())
-		os << "\tDocBookAttr " << docbookattr_ << '\n';
+		os << "\tDocBookAttr \"" << docbookattr_ << "\"\n";
 	if(!docbooktagtype_.empty())
 		os << "\tDocBookTagType " << docbooktagtype_ << '\n';
 	if(!docbookininfo_.empty())
@@ -1669,7 +1669,7 @@ void Layout::write(ostream & os) const
 		os << "\tDocBookItemWrapperAttr " << docbookitemwrapperattr_ << '\n';
 	if(!docbookitemwrappertagtype_.empty())
 		os << "\tDocBookItemWrapperTagType " << docbookitemwrappertagtype_ << '\n';
-	os << "\tDocBookItemWrapperMergeWithPrevious " << docbookwrappermergewithprevious_ << '\n';
+	os << "\tDocBookWrapperMergeWithPrevious " << docbookwrappermergewithprevious_ << '\n';
 	if(!docbookitemlabeltag_.empty())
 		os << "\tDocBookItemLabelTag " << docbookitemlabeltag_ << '\n';
 	if(!docbookitemlabelattr_.empty())

commit e4dfc34ead151225af5a566ce68cb3775a24fd6b
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Sat Sep 12 01:52:58 2020 +0200

    DocBook: implement InsetBox titles.

diff --git a/autotests/export/docbook/A0_Poster_Simple.lyx b/autotests/export/docbook/A0_Poster_Simple.lyx
new file mode 100644
index 0000000..998f210
--- /dev/null
+++ b/autotests/export/docbook/A0_Poster_Simple.lyx
@@ -0,0 +1,192 @@
+#LyX 2.4 created this file. For more info see https://www.lyx.org/
+\lyxformat 598
+\begin_document
+\begin_header
+\save_transient_properties true
+\origin unavailable
+\textclass a0poster
+\begin_preamble
+% Adjust padding in boxes
+\setlength\fboxsep{12pt}
+% Added by lyx2lyx
+\setlength{\parskip}{\bigskipamount}
+\setlength{\parindent}{0pt}
+\end_preamble
+\options a0,portrait
+\use_default_options false
+\maintain_unincluded_children no
+\language english
+\language_package default
+\inputencoding utf8
+\fontencoding auto
+\font_roman "palatino" "default"
+\font_sans "default" "default"
+\font_typewriter "courier" "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 default
+\output_sync 0
+\bibtex_command default
+\index_command default
+\paperfontsize default
+\spacing single
+\use_hyperref false
+\papersize default
+\use_geometry true
+\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 0
+\use_minted 0
+\use_lineno 0
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\leftmargin 1cm
+\topmargin 1cm
+\rightmargin 1cm
+\bottommargin 1cm
+\secnumdepth 0
+\tocdepth 0
+\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 empty
+\tablestyle default
+\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 Standard
+\align center
+\begin_inset Box Shadowbox
+position "c"
+hor_pos "c"
+has_inner_box 1
+inner_pos "c"
+use_parbox 1
+use_makebox 0
+width "98col%"
+special "none"
+height "5cm"
+height_special "none"
+thickness "0.4pt"
+separation "3pt"
+shadowsize "4pt"
+framecolor "black"
+backgroundcolor "none"
+status open
+
+\begin_layout Plain Layout
+\noindent
+\align center
+
+\series bold
+\noun on
+\begin_inset Flex Most Giant Snippet
+status open
+
+\begin_layout Plain Layout
+\noindent
+
+\series bold
+\noun on
+Poster Heading
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Box Boxed
+position "t"
+hor_pos "c"
+has_inner_box 1
+inner_pos "t"
+use_parbox 0
+use_makebox 0
+width "98col%"
+special "none"
+height "1in"
+height_special "totalheight"
+thickness "0.4pt"
+separation "3pt"
+shadowsize "4pt"
+framecolor "black"
+backgroundcolor "none"
+status open
+
+\begin_layout Section
+Summary
+\end_layout
+
+\begin_layout Itemize
+For multiple columns, use the 
+\begin_inset Quotes eld
+\end_inset
+
+Multiple Columns
+\begin_inset Quotes erd
+\end_inset
+
+ module as documented in 
+\family sans
+Help\SpecialChar menuseparator
+Additional Features
+\family default
+.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_body
+\end_document
diff --git a/autotests/export/docbook/A0_Poster_Simple.xml b/autotests/export/docbook/A0_Poster_Simple.xml
new file mode 100644
index 0000000..3594ffd
--- /dev/null
+++ b/autotests/export/docbook/A0_Poster_Simple.xml
@@ -0,0 +1,16 @@
+<?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="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">
+<sidebar role='shadowbox'>
+Poster Heading
+</sidebar>
+<sidebar role='boxed'>
+<title>Summary</title>
+<itemizedlist>
+<listitem>
+<para>For multiple columns, use the “Multiple Columns” module as documented in <emphasis role='sans'>Help&#x21D2;Additional Features</emphasis>.</para>
+</listitem>
+</itemizedlist>
+</sidebar>
+</article>
\ No newline at end of file
diff --git a/src/insets/InsetBox.cpp b/src/insets/InsetBox.cpp
index db76f53..d714cf7 100644
--- a/src/insets/InsetBox.cpp
+++ b/src/insets/InsetBox.cpp
@@ -26,6 +26,7 @@
 #include "LaTeXFeatures.h"
 #include "Lexer.h"
 #include "MetricsInfo.h"
+#include "output_docbook.h"
 #include "output_xhtml.h"
 #include "TexRow.h"
 #include "texstream.h"
@@ -727,7 +728,21 @@ void InsetBox::docbook(XMLStream & xs, OutputParams const & runparams) const
 		LYXERR0("Assertion failed: box layout " + getLayout().name() + " missing DocBookWrapperTag.");
 	}
 
-	InsetText::docbook(xs, runparams);
+	// If the box starts with a sectioning item, use as box title.
+	auto current_par = paragraphs().begin();
+	if (current_par->layout().category() == from_utf8("Sectioning")) {
+		// Only generate the first paragraph.
+		current_par = makeAny(text(), buffer(), xs, runparams, paragraphs().begin());
+	}
+
+	xs.startDivision(false);
+	// Don't call InsetText::docbook, as this would generate all paragraphs in the inset, not the ones we are
+	// interested in. The best solution would be to call docbookParagraphs with an updated OutputParams object to only
+	// generate paragraphs after the title, but it leads to strange crashes, as if text().paragraphs() then returns
+	// a smaller set of paragrphs.
+	while (current_par != paragraphs().end())
+		current_par = makeAny(text(), buffer(), xs, runparams, current_par);
+	xs.endDivision();
 
 	if (!getLayout().docbookwrappertag().empty()) {
 		if (!xs.isLastTagCR())
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index ee829e5..c8ddc1a 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -16,6 +16,7 @@
 #include "BufferParams.h"
 #include "Font.h"
 #include "InsetList.h"
+#include "output_docbook.h"
 #include "Paragraph.h"
 #include "ParagraphList.h"
 #include "ParagraphParameters.h"
@@ -347,13 +348,6 @@ void closeParTag(XMLStream & xs, Paragraph const * par, Paragraph const * nextpa
 }
 
 
-ParagraphList::const_iterator makeAny(Text const &,
-		                              Buffer const &,
-		                              XMLStream &,
-		                              OutputParams const &,
-		                              ParagraphList::const_iterator);
-
-
 void makeBibliography(
 		Text const & text,
 		Buffer const & buf,
@@ -714,35 +708,6 @@ void makeCommand(
 }
 
 
-ParagraphList::const_iterator makeAny(Text const &text,
-		                              Buffer const &buf,
-		                              XMLStream &xs,
-		                              OutputParams const &runparams,
-		                              ParagraphList::const_iterator par)
-{
-	switch (par->layout().latextype) {
-	case LATEX_COMMAND:
-		makeCommand(text, buf, xs, runparams, par);
-		break;
-	case LATEX_ENVIRONMENT:
-		makeEnvironment(text, buf, xs, runparams, par);
-		break;
-	case LATEX_LIST_ENVIRONMENT:
-	case LATEX_ITEM_ENVIRONMENT:
-		// Only case when makeAny() might consume more than one paragraph.
-		return makeListEnvironment(text, buf, xs, runparams, par);
-	case LATEX_PARAGRAPH:
-		makeParagraph(text, buf, xs, runparams, par);
-		break;
-	case LATEX_BIB_ENVIRONMENT:
-		makeBibliography(text, buf, xs, runparams, par);
-		break;
-	}
-	++par;
-	return par;
-}
-
-
 bool isLayoutSectioning(Layout const & lay)
 {
 	return lay.category() == from_utf8("Sectioning");
@@ -862,6 +827,35 @@ DocBookInfoTag getParagraphsWithInfo(ParagraphList const &paragraphs,
 } // end anonymous namespace
 
 
+ParagraphList::const_iterator makeAny(Text const &text,
+                                      Buffer const &buf,
+                                      XMLStream &xs,
+                                      OutputParams const &runparams,
+                                      ParagraphList::const_iterator par)
+{
+	switch (par->layout().latextype) {
+	case LATEX_COMMAND:
+		makeCommand(text, buf, xs, runparams, par);
+		break;
+	case LATEX_ENVIRONMENT:
+		makeEnvironment(text, buf, xs, runparams, par);
+		break;
+	case LATEX_LIST_ENVIRONMENT:
+	case LATEX_ITEM_ENVIRONMENT:
+		// Only case when makeAny() might consume more than one paragraph.
+		return makeListEnvironment(text, buf, xs, runparams, par);
+	case LATEX_PARAGRAPH:
+		makeParagraph(text, buf, xs, runparams, par);
+		break;
+	case LATEX_BIB_ENVIRONMENT:
+		makeBibliography(text, buf, xs, runparams, par);
+		break;
+	}
+	++par;
+	return par;
+}
+
+
 xml::FontTag docbookStartFontTag(xml::FontTypes type)
 {
 	return xml::FontTag(from_utf8(fontToDocBookTag(type)), from_utf8(fontToAttribute(type)), type);
diff --git a/src/output_docbook.h b/src/output_docbook.h
index 4dcc853..401018d 100644
--- a/src/output_docbook.h
+++ b/src/output_docbook.h
@@ -16,6 +16,7 @@
 #define OUTPUT_DOCBOOK_H
 
 #include "LayoutEnums.h"
+#include "ParagraphList.h"
 
 #include "support/docstream.h"
 #include "support/strfwd.h"
@@ -27,18 +28,23 @@ class Buffer;
 class OutputParams;
 class Text;
 
-///
-std::string const fontToDocBookTag(xml::FontTypes type);
-///
+/// generates an xml::StartTag for the given style
 xml::FontTag docbookStartFontTag(xml::FontTypes type);
-///
+/// generates an xml::EndTag for the given style
 xml::EndFontTag docbookEndFontTag(xml::FontTypes type);
 
-///
-void docbookParagraphs(Text const & text,
-		               Buffer const & buf,
-                       XMLStream & os,
-		               OutputParams const & runparams);
+/// output a series of paragraphs into the XMLStream
+void docbookParagraphs(Text const &,
+		               Buffer const &,
+                       XMLStream &,
+		               OutputParams const &);
+
+/// output a single paragraph into the XMLStream
+ParagraphList::const_iterator makeAny(Text const &,
+                                      Buffer const &,
+                                      XMLStream &,
+                                      OutputParams const &,
+                                      ParagraphList::const_iterator);
 
 } // namespace lyx
 

commit 900dd8f58df2e3074e84f2c9aa8bce5ce290212b
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Sat Sep 12 01:43:57 2020 +0200

    DocBook: fix a crash in bibliography paragraphs.

diff --git a/autotests/export/docbook/SciPoster.lyx b/autotests/export/docbook/SciPoster.lyx
new file mode 100644
index 0000000..1bd3b51
--- /dev/null
+++ b/autotests/export/docbook/SciPoster.lyx
@@ -0,0 +1,867 @@
+#LyX 2.3 created this file. For more info see http://www.lyx.org/
+\lyxformat 544
+\begin_document
+\begin_header
+\save_transient_properties true
+\origin /systemlyxdir/templates/Posters/
+\textclass sciposter
+\begin_preamble
+%% Comment this out and adapt if you want a poster background
+%\usepackage{wallpaper}
+%\CenterWallPaper{1.1}{poster-background}
+
+% Set all margins to 1cm
+\setmargins[1cm]
+
+% Set up column layout
+\setlength\columnseprule{0pt}
+\setlength\columnsep{4.5pc}
+
+% Color settings:
+\usepackage{sectionbox}
+% a.) background color
+%\definecolor{mainCol}{RGB}{255,237,208}
+% b.) text color (mainly subsection headers)
+\definecolor{TextCol}{RGB}{128,0,0}
+% c.) section header color
+\definecolor{SectionCol}{RGB}{0,0,255}
+% d.) color of section boxes
+\definecolor{sectboxfillcol}{RGB}{255,220,168}
+\definecolor{subsectboxfillcol}{RGB}{255,245,198}
+
+% Large section titles
+\renewcommand{\sectionsize}{\Large}
+\end_preamble
+\options landscape,a0,largefonts,plainsections
+\use_default_options false
+\begin_modules
+multicol
+sectionbox
+\end_modules
+\maintain_unincluded_children false
+\language english
+\language_package default
+\inputencoding utf8
+\fontencoding global
+\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_osf false
+\font_sf_scale 100 100
+\font_tt_scale 100 100
+\use_microtype false
+\use_dash_ligatures false
+\graphics default
+\default_output_format default
+\output_sync 0
+\bibtex_command default
+\index_command default
+\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 natbib
+\cite_engine_type numerical
+\biblio_style plainnat
+\use_bibtopic false
+\use_indices false
+\paperorientation portrait
+\suppress_date false
+\justification true
+\use_refstyle 0
+\use_minted 0
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 0
+\tocdepth -1
+\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
+\tracking_changes false
+\output_changes false
+\html_math_output 0
+\html_css_as_file 0
+\html_be_strict false
+\end_header
+
+\begin_body
+
+\begin_layout Title
+Poster Title
+\end_layout
+
+\begin_layout Author
+Author One and Author Two
+\end_layout
+
+\begin_layout Institute
+The University, Some address, Postal Code
+\end_layout
+
+\begin_layout E-Mail
+author1 at somewhere and author2 at elsewhere
+\end_layout
+
+\begin_layout Conference
+The Conference
+\begin_inset Note Note
+status open
+
+\begin_layout Plain Layout
+appears in footer
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Note Note
+status open
+
+\begin_layout Section*
+Some advices
+\end_layout
+
+\begin_layout Subsubsection*
+Appearance
+\end_layout
+
+\begin_layout Itemize
+See 
+\family sans
+Document\SpecialChar menuseparator
+Settings\SpecialChar menuseparator
+\SpecialChar LaTeX
+ Preamble
+\family default
+ for some possibilities to adjust the appearance of your poster.
+ Also check 
+\family sans
+Document\SpecialChar menuseparator
+Settings\SpecialChar menuseparator
+Document Class\SpecialChar menuseparator
+Class Options
+\family default
+ for some general settings.
+ Please refer to the 
+\family sans
+sciposter
+\family default
+ manual for possible values.
+\end_layout
+
+\begin_layout Subsubsection*
+Logo
+\end_layout
+
+\begin_layout Itemize
+You can use the 
+\family sans
+LeftLogo
+\family default
+ and 
+\family sans
+RightLogo
+\family default
+ style to insert graphic logos in the header of your poster.
+ The logos need to be given as file names (with our without extension) and
+ with full path, if the files are not in the TEXMF directory.
+\end_layout
+
+\begin_layout Itemize
+Note that the logos only appear if you do not specify a 
+\begin_inset Quotes eld
+\end_inset
+
+Conference
+\begin_inset Quotes erd
+\end_inset
+
+ (i.
+\begin_inset space \thinspace{}
+\end_inset
+
+e., no foot line).
+\end_layout
+
+\begin_layout Subsubsection*
+Columns and Boxes
+\end_layout
+
+\begin_layout Itemize
+The 
+\family sans
+Columns
+\family default
+ and 
+\family sans
+(Section) Box
+\family default
+ insets can be found at 
+\family sans
+Insert\SpecialChar menuseparator
+Custom Insets.
+\end_layout
+
+\begin_layout Itemize
+Instead of the Section Boxes, you can also use the differently looking Color
+ Boxes via the 
+\begin_inset Quotes eld
+\end_inset
+
+Color Boxes
+\begin_inset Quotes erd
+\end_inset
+
+ module.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Flex Multiple Columns
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 1
+status open
+
+\begin_layout Plain Layout
+
+3
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Abstract
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+
+\size small
+\emph on
+This is my special abstract This is my special abstract This is my special
+ abstract This is my special abstract This is my special abstract This is
+ my special abstract This is my special abstract This is my special abstract
+ This is my special abstract This is my special abstract.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Background
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+This is the background and our hypothesis.
+ This is the background and our hypothesis.
+ This is the background and our hypothesis.
+ This is the background and our hypothesis.
+ This is the background and our hypothesis.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+
+\size small
+\begin_inset Flex SectionBox
+status open
+
+\begin_layout Bibliography
+\begin_inset CommandInset bibitem
+LatexCommand bibitem
+label "One/Two(2010)"
+key "key-1"
+literal "true"
+
+\end_inset
+
+Author One & Author Two (2010): Our Great Book.
+ Somewhere.
+\end_layout
+
+\begin_layout Bibliography
+\begin_inset CommandInset bibitem
+LatexCommand bibitem
+label "Two/One(2011)"
+key "key-2"
+literal "true"
+
+\end_inset
+
+Author Two & Author One (2011): Our Even Greater Book.
+ Somewhere.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset ERT
+status collapsed
+
+\begin_layout Plain Layout
+
+
+\backslash
+columnbreak
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Findings
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SubsectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Some evidence
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+point one
+\end_layout
+
+\begin_layout Itemize
+point two
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SubsectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+More evidence
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+point three
+\end_layout
+
+\begin_layout Itemize
+point four
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SubsectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Other issues
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+Really have to fill in this
+\end_layout
+
+\begin_layout Itemize
+Really have to fill in this
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset ERT
+status collapsed
+
+\begin_layout Plain Layout
+
+
+\backslash
+columnbreak
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Experiment
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+This is the experiment.
+ This is the experiment.
+ This is the experiment.
+ This is the experiment.
+ This is the experiment.
+ This is the experiment.
+ This is the experiment.
+ This is the experiment.
+ This is the experiment.
+ This is the experiment.
+ 
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Results
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+result
+\end_layout
+
+\begin_layout Itemize
+result
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Conclusions
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Enumerate
+first conclusion
+\end_layout
+
+\begin_layout Enumerate
+second conclusion
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Flex SectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Available font size (and corresponding 
+\begin_inset ERT
+status collapsed
+
+\begin_layout Plain Layout
+
+
+\backslash
+LaTeX
+\backslash
+
+\end_layout
+
+\end_inset
+
+ commands)
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\paragraph_spacing single
+\begin_inset Note Note
+status open
+
+\begin_layout Plain Layout
+The extra sizes (
+\begin_inset Quotes eld
+\end_inset
+
+Giant
+\begin_inset Quotes erd
+\end_inset
+
+ etc.) are available at 
+\family sans
+Insert\SpecialChar menuseparator
+Custom Insets
+\family default
+.
+ For small inline snippets, there are variants at 
+\family sans
+Edit\SpecialChar menuseparator
+Text Style.
+\end_layout
+
+\begin_layout Plain Layout
+Note that for some paper sizes and font settings, 
+\begin_inset Quotes eld
+\end_inset
+
+More Giant
+\begin_inset Quotes erd
+\end_inset
+
+ and 
+\begin_inset Quotes eld
+\end_inset
+
+Most Giant
+\begin_inset Quotes erd
+\end_inset
+
+ are equal.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+
+\size tiny
+Tiny (
+\family typewriter
+
+\backslash
+tiny
+\family default
+)
+\end_layout
+
+\begin_layout Plain Layout
+
+\size scriptsize
+Smallest (
+\family typewriter
+
+\backslash
+scriptsize
+\family default
+)
+\end_layout
+
+\begin_layout Plain Layout
+
+\size footnotesize
+Smaller (
+\family typewriter
+
+\backslash
+footnotesize
+\family default
+)
+\end_layout
+
+\begin_layout Plain Layout
+
+\size normal
+Normal (
+\family typewriter
+\size default
+
+\backslash
+normalsize
+\family default
+\size normal
+)
+\end_layout
+
+\begin_layout Plain Layout
+
+\size large
+Large (
+\family typewriter
+
+\backslash
+large
+\family default
+)
+\end_layout
+
+\begin_layout Plain Layout
+
+\size larger
+Larger (
+\family typewriter
+
+\backslash
+Large
+\family default
+)
+\end_layout
+
+\begin_layout Plain Layout
+
+\size largest
+Largest (
+\family typewriter
+
+\backslash
+LARGE
+\family default
+)
+\end_layout
+
+\begin_layout Plain Layout
+
+\size huge
+Huge (
+\family typewriter
+
+\backslash
+huge
+\family default
+)
+\end_layout
+
+\begin_layout Plain Layout
+
+\size giant
+Huger (
+\family typewriter
+
+\backslash
+Huge
+\family default
+)
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex Giant
+status open
+
+\begin_layout Plain Layout
+Giant (
+\family typewriter
+
+\backslash
+veryHuge
+\family default
+)
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex More Giant
+status open
+
+\begin_layout Plain Layout
+More Giant (
+\family typewriter
+
+\backslash
+VeryHuge
+\family default
+)
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex Most Giant
+status open
+
+\begin_layout Plain Layout
+Most Giant (
+\family typewriter
+
+\backslash
+VERYHuge
+\family default
+)
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_body
+\end_document
diff --git a/autotests/export/docbook/SciPoster.xml b/autotests/export/docbook/SciPoster.xml
new file mode 100644
index 0000000..abd919b
--- /dev/null
+++ b/autotests/export/docbook/SciPoster.xml
@@ -0,0 +1,65 @@
+<?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="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">
+<info>
+<title>Poster Title</title>
+<author>
+<personname>Author One and Author Two</personname>
+</author><author>
+<personname>The University, Some address, Postal Code</personname>
+</author><author>
+<personname>author1 at somewhere and author2 at elsewhere</personname>
+</author><author>
+<personname>The Conference</personname>
+</author>
+</info>
+<para>This is my special abstract This is my special abstract This is my special abstract This is my special abstract This is my special abstract This is my special abstract This is my special abstract This is my special abstract This is my special abstract This is my special abstract.This is the background and our hypothesis. This is the background and our hypothesis. This is the background and our hypothesis. This is the background and our hypothesis. This is the background and our hypothesis.<bibliography>
+<bibliomixed xml:id='key-1'>Author One & Author Two (2010): Our Great Book. Somewhere.</bibliomixed>
+<bibliomixed xml:id='key-2'>Author Two & Author One (2011): Our Even Greater Book. Somewhere.</bibliomixed>
+</bibliography>
+<!-- \columnbreak -->
+<itemizedlist>
+<listitem>
+<para>point one</para>
+</listitem>
+<listitem>
+<para>point two</para>
+</listitem>
+</itemizedlist>
+<itemizedlist>
+<listitem>
+<para>point three</para>
+</listitem>
+<listitem>
+<para>point four</para>
+</listitem>
+</itemizedlist>
+<itemizedlist>
+<listitem>
+<para>Really have to fill in this</para>
+</listitem>
+<listitem>
+<para>Really have to fill in this</para>
+</listitem>
+</itemizedlist>
+<!-- \columnbreak -->
+This is the experiment. This is the experiment. This is the experiment. This is the experiment. This is the experiment. This is the experiment. This is the experiment. This is the experiment. This is the experiment. This is the experiment. <itemizedlist>
+<listitem>
+<para>result</para>
+</listitem>
+<listitem>
+<para>result</para>
+</listitem>
+</itemizedlist>
+<orderedlist>
+<listitem>
+<para>first conclusion</para>
+</listitem>
+<listitem>
+<para>second conclusion</para>
+</listitem>
+</orderedlist>
+</para>
+<para>Tiny (\tiny)Smallest (\scriptsize)Smaller (\footnotesize)Normal (\normalsize)Large (\large)Larger (\Large)Largest (\LARGE)Huge (\huge)Huger (\Huge)Giant (\veryHuge)More Giant (\VeryHuge)Most Giant (\VERYHuge)</para>
+</article>
\ No newline at end of file
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 1e804ee..ee829e5 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -362,8 +362,8 @@ void makeBibliography(
 		ParagraphList::const_iterator const & par)
 {
 	// If this is the first paragraph in a bibliography, open the bibliography tag.
-	auto pbegin_before = text.paragraphs().getParagraphBefore(par);
-	if (pbegin_before->layout().latextype != LATEX_BIB_ENVIRONMENT) {
+	auto const * pbegin_before = text.paragraphs().getParagraphBefore(par);
+	if (pbegin_before == nullptr || (pbegin_before && pbegin_before->layout().latextype != LATEX_BIB_ENVIRONMENT)) {
 		xs << xml::StartTag("bibliography");
 		xs << xml::CR();
 	}

commit c38e9e94c06775fd3c5d8ed8392332dba9e34117
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Sat Sep 12 01:04:43 2020 +0200

    layout2layout: use name instead of pseudonym.

diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py
index 7cf2332..74119bb 100644
--- a/lib/scripts/layout2layout.py
+++ b/lib/scripts/layout2layout.py
@@ -271,7 +271,7 @@ currentFormat = 84
 # Incremented to format 81, 12 August 2019 by rikiheck
 # New tag GuiName for counters
 
-# Incremented to format 82, 4 June 2017 by dourouc05
+# Incremented to format 82, 4 June 2017 by tcuvelier
 # - Add new tags for Layout:
 #   DocBookTag, DocBookAttr, DocBookInInfo,
 #   DocBookWrapperTag, DocBookWrapperAttr,
@@ -281,7 +281,7 @@ currentFormat = 84
 # - Removed tag Header from ClassOptionsClassOptions
 # - Removed tag Element for flex insets
 
-# Incremented to format 83, 2 August 2020 by dourouc05
+# Incremented to format 83, 2 August 2020 by tcuvelier
 # New tags DocBookWrapperMergeWithPrevious and DocBookAbstract
 
 # Incremented to format 84, 17 August 2020 by tcuvelier

commit 5f1a3cc147eeb8bb375d21cee7098e95457129bd
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Sat Sep 12 00:39:23 2020 +0200

    DocBook: work for more subfigure cases.
    
    EmbeddedObjects hid quite a few gems :).

diff --git a/autotests/export/docbook/subfigures_EmbeddedObjects.lyx b/autotests/export/docbook/subfigures_EmbeddedObjects.lyx
new file mode 100644
index 0000000..0154d21
--- /dev/null
+++ b/autotests/export/docbook/subfigures_EmbeddedObjects.lyx
@@ -0,0 +1,444 @@
+#LyX 2.4 created this file. For more info see https://www.lyx.org/
+\lyxformat 598
+\begin_document
+\begin_header
+\save_transient_properties true
+\origin unavailable
+\textclass scrbook
+\begin_preamble
+% that links to image floats jumps
+% to the beginning of the float and 
+% not to its caption
+\usepackage[figure]{hypcap}
+
+% the pages of the TOC are numbered roman
+% and a PDF-bookmark for the TOC is added
+\let\myTOC\tableofcontents
+\renewcommand\tableofcontents{%
+  \frontmatter
+  \pdfbookmark[1]{\contentsname}{}
+  \myTOC
+  \mainmatter }
+
+% provides caption formatting
+\usepackage[labelfont={bf,sf}]{caption}[2004/07/16]
+
+% provides commands to set caption
+% beside tables/images
+\newcommand{\TabBesBeg}[1][1.0]{%
+ \let\MyTable\table
+ \let\MyEndtable\endtable
+ \renewenvironment{table}[1]{\begin{SCtable}[#1]##1}{\end{SCtable}}}
+
+\newcommand{\TabBesEnd}{%
+ \let\table\MyTable
+ \let\endtable\MyEndtable}
+
+\newcommand{\FigBesBeg}[1][1.0]{%
+ \let\MyFigure\figure
+ \let\MyEndfigure\endfigure
+ \renewenvironment{figure}[1]{\begin{SCfigure}[#1]##1}{\end{SCfigure}}}
+
+\newcommand{\FigBesEnd}{%
+ \let\figure\MyFigure
+ \let\endfigure\MyEndfigure}
+
+% enables calculation of values,
+\usepackage{calc}
+
+% increase the bottom float placement fraction
+\renewcommand{\bottomfraction}{0.5}
+
+% avoids that floats are placed before their
+% corresponding section starts
+\let\mySection\section\renewcommand{\section}{\suppressfloats[t]\mySection}
+
+% speed up the longtable calculation
+\setcounter{LTchunksize}{100}
+
+% used for colored tables
+\@ifundefined{textcolor}
+ {\usepackage{color}}{}
+\definecolor{darkgreen}{cmyk}{0.5, 0, 1, 0.5}
+\definecolor{lightgrey}{gray}{0.8}
+
+% check for package colortbl
+% used for colored table cells
+\newboolean{colortbl}
+\IfFileExists{colortbl.sty}
+ {\usepackage{colortbl}
+  \setboolean{colortbl}{true}}
+ {\setboolean{colortbl}{false}}
+
+% used to have extra space in table cells
+\@ifundefined{extrarowheight}
+ {\usepackage{array}}{}
+\setlength{\extrarowheight}{2pt}
+
+% used for customized tables
+% ---
+\newcolumntype{M}[1]
+ {>{\centering\hspace{0pt}}m{#1}}
+
+\newcolumntype{S}[2]
+ {>{\centering\hspace{0pt}}m{(#1+(2\tabcolsep+\arrayrulewidth)*(1-#2))/#2}}
+
+\newcolumntype{K}[1]
+ {>{\columncolor{#1}\hspace{0pt}}c}
+
+\newcolumntype{V}{!{\vrule width 1.5pt}}
+
+\newcolumntype{W}{!{\color{green}\vline}}
+% ---
+
+% insert additional vertical space of
+% 1.5 mm between footnotes
+\let\myFoot\footnote
+\renewcommand{\footnote}[1]{\myFoot{#1\vspace{1.5mm}}}
+
+% number algorithm floats within chapters
+\numberwithin{algorithm}{chapter}
+
+% ------------------------------------
+% used to check for needed LaTeX packages
+\usepackage{ifthen}
+
+% check for package arydshln
+% used for tables with dashed lines
+\newboolean{arydshln}
+\IfFileExists{arydshln.sty}
+ {\usepackage{arydshln}
+  \setboolean{arydshln}{true}}
+ {\setboolean{arydshln}{false}}
+
+% check for package marginnote
+% used for margin notes
+\newboolean{marginnote}
+\IfFileExists{marginnote.sty}
+ {\usepackage{marginnote}
+  \let\marginpar\marginnote
+  \setboolean{marginnote}{true}}
+ {\setboolean{marginnote}{false}}
+
+% check for package sidecap
+% used for captions on the side
+\newboolean{sidecap}
+\IfFileExists{sidecap.sty}
+ {\usepackage{sidecap}
+  \setboolean{sidecap}{true}}
+ {\setboolean{sidecap}{false}}
+
+% check for picinpar
+% used for surrounded fixed objects
+\newboolean{picinpar}
+\IfFileExists{picinpar.sty}
+ {\usepackage{picinpar}
+  \setboolean{picinpar}{true}}
+ {\setboolean{picinpar}{false}}
+
+% check for lettrine
+\newboolean{lettrine}
+\IfFileExists{lettrine.sty}
+ {\usepackage{lettrine}
+  \setboolean{lettrine}{true}}
+ {\setboolean{lettrine}{false}}
+
+% check for diagbox
+\newboolean{diagbox}
+\IfFileExists{diagbox.sty}
+ {\usepackage{diagbox}
+  \setboolean{diagbox}{true}}
+ {\setboolean{diagbox}{false}}
+% Added by lyx2lyx
+\setlength{\parskip}{\medskipamount}
+\setlength{\parindent}{0pt}
+\end_preamble
+\options bibliography=totoc,index=totoc,BCOR7.5mm,titlepage,captions=tableheading,dvipsnames,table
+\use_default_options false
+\begin_modules
+initials
+graphicboxes
+varwidth
+\end_modules
+\maintain_unincluded_children no
+\language english
+\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 true
+\graphics default
+\default_output_format pdf2
+\output_sync 0
+\bibtex_command default
+\index_command makeindex
+\paperfontsize 12
+\spacing single
+\use_hyperref true
+\pdf_title "LyX's Figure, Table, Floats, Notes, and Boxes manual"
+\pdf_author "LyX Team, Uwe Stöhr"
+\pdf_subject "LyX-documentation about figures, tables, floats, notes, and boxes"
+\pdf_keywords "LyX, Tables, Figures, Floats, Boxes, Notes"
+\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 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 0
+\use_minted 0
+\use_lineno 0
+\notefontcolor #0000ff
+\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 2
+\paperpagestyle default
+\tablestyle default
+\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
+'s detailed Figure, Table, Floats, Notes, Boxes and External Material manual
+\end_layout
+
+\begin_layout Chapter
+Figures
+\end_layout
+
+\begin_layout Section
+Figure Floats
+\end_layout
+
+\begin_layout Standard
+Normally only one image is inserted to a figure float, but sometimes you
+ might want to use two images with separate subcaptions.
+ This can be done by inserting image floats into existing image floats.
+ Note that only the main caption of the float is added to the List of Figures.
+ Figure
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "fig:Two-distorted-images"
+
+\end_inset
+
+ is an example of a figure float with two images set side by side.
+ You can also set the images one below the other.
+ Figure
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "fig:Pink-object"
+
+\end_inset
+
+ and 
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "fig:A-star"
+
+\end_inset
+
+ are the subfigures.
+\end_layout
+
+\begin_layout Standard
+\begin_inset Float figure
+placement document
+alignment document
+wide false
+sideways false
+status open
+
+\begin_layout Plain Layout
+\begin_inset space \hfill{}
+\end_inset
+
+
+\begin_inset Float figure
+placement document
+alignment document
+wide false
+sideways false
+status open
+
+\begin_layout Plain Layout
+\begin_inset Caption Standard
+
+\begin_layout Plain Layout
+\begin_inset CommandInset label
+LatexCommand label
+name "fig:Pink-object"
+
+\end_inset
+
+Pink object.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Graphics
+	filename ../../../lib/doc/clipart/3D-structure-distort.pdf
+	width 45col%
+	scaleBeforeRotation
+	groupId distorted
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\begin_inset space \hfill{}
+\end_inset
+
+
+\begin_inset Float figure
+placement document
+alignment document
+wide false
+sideways false
+status open
+
+\begin_layout Plain Layout
+\begin_inset Caption Standard
+
+\begin_layout Plain Layout
+\begin_inset CommandInset label
+LatexCommand label
+name "fig:A-star"
+
+\end_inset
+
+A star.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Graphics
+	filename ../../../lib/doc/clipart/Star-structure.pdf
+	width 45col%
+	scaleBeforeRotation
+	groupId distorted
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\begin_inset space \hfill{}
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Caption Standard
+
+\begin_layout Plain Layout
+\begin_inset CommandInset label
+LatexCommand label
+name "fig:Two-distorted-images"
+
+\end_inset
+
+Two distorted images.
+ Both images are in the image settings group named 
+\begin_inset Quotes eld
+\end_inset
+
+distorted
+\begin_inset Quotes erd
+\end_inset
+
+.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_body
+\end_document
diff --git a/autotests/export/docbook/subfigures_EmbeddedObjects.xml b/autotests/export/docbook/subfigures_EmbeddedObjects.xml
new file mode 100644
index 0000000..08fda04
--- /dev/null
+++ b/autotests/export/docbook/subfigures_EmbeddedObjects.xml
@@ -0,0 +1,32 @@
+<?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 -->
+<book 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>LyX's detailed Figure, Table, Floats, Notes, Boxes and External Material manual</title>
+<chapter>
+<title>Figures</title>
+<section>
+<title>Figure Floats</title>
+<para>Normally only one image is inserted to a figure float, but sometimes you might want to use two images with separate subcaptions. This can be done by inserting image floats into existing image floats. Note that only the main caption of the float is added to the List of Figures. Figure&#xA0;<xref linkend="fig.Two-distorted-images" /> is an example of a figure float with two images set side by side. You can also set the images one below the other. Figure&#xA0;<xref linkend="fig.Pink-object" /> and <xref linkend="fig.A-star" /> are the subfigures.</para>
+<formalgroup xml:id="fig.Two-distorted-images">
+<title>Two distorted images. Both images are in the image settings group named “distorted”.</title>
+<figure xml:id="fig.Pink-object">
+<title>Pink object.</title>
+<mediaobject>
+<imageobject>
+<imagedata fileref="D:/LyX/lyx-unstable/lib/doc/clipart/3D-structure-distort.pdf"  width="45%"  />
+</imageobject>
+</mediaobject>
+</figure>
+<figure xml:id="fig.A-star">
+<title>A star.</title>
+<mediaobject>
+<imageobject>
+<imagedata fileref="D:/LyX/lyx-unstable/lib/doc/clipart/Star-structure.pdf"  width="45%"  />
+</imageobject>
+</mediaobject>
+</figure>
+</formalgroup>
+</section>
+</chapter>
+</book>
\ No newline at end of file
diff --git a/autotests/export/docbook/subfigures_boxes_EmbeddedObjects.lyx b/autotests/export/docbook/subfigures_boxes_EmbeddedObjects.lyx
new file mode 100644
index 0000000..da41aa3
--- /dev/null
+++ b/autotests/export/docbook/subfigures_boxes_EmbeddedObjects.lyx
@@ -0,0 +1,420 @@
+#LyX 2.4 created this file. For more info see https://www.lyx.org/
+\lyxformat 598
+\begin_document
+\begin_header
+\save_transient_properties true
+\origin unavailable
+\textclass scrbook
+\begin_preamble
+% that links to image floats jumps
+% to the beginning of the float and 
+% not to its caption
+\usepackage[figure]{hypcap}
+
+% the pages of the TOC are numbered roman
+% and a PDF-bookmark for the TOC is added
+\let\myTOC\tableofcontents
+\renewcommand\tableofcontents{%
+  \frontmatter
+  \pdfbookmark[1]{\contentsname}{}
+  \myTOC
+  \mainmatter }
+
+% provides caption formatting
+\usepackage[labelfont={bf,sf}]{caption}[2004/07/16]
+
+% provides commands to set caption
+% beside tables/images
+\newcommand{\TabBesBeg}[1][1.0]{%
+ \let\MyTable\table
+ \let\MyEndtable\endtable
+ \renewenvironment{table}[1]{\begin{SCtable}[#1]##1}{\end{SCtable}}}
+
+\newcommand{\TabBesEnd}{%
+ \let\table\MyTable
+ \let\endtable\MyEndtable}
+
+\newcommand{\FigBesBeg}[1][1.0]{%
+ \let\MyFigure\figure
+ \let\MyEndfigure\endfigure
+ \renewenvironment{figure}[1]{\begin{SCfigure}[#1]##1}{\end{SCfigure}}}
+
+\newcommand{\FigBesEnd}{%
+ \let\figure\MyFigure
+ \let\endfigure\MyEndfigure}
+
+% enables calculation of values,
+\usepackage{calc}
+
+% increase the bottom float placement fraction
+\renewcommand{\bottomfraction}{0.5}
+
+% avoids that floats are placed before their
+% corresponding section starts
+\let\mySection\section\renewcommand{\section}{\suppressfloats[t]\mySection}
+
+% speed up the longtable calculation
+\setcounter{LTchunksize}{100}
+
+% used for colored tables
+\@ifundefined{textcolor}
+ {\usepackage{color}}{}
+\definecolor{darkgreen}{cmyk}{0.5, 0, 1, 0.5}
+\definecolor{lightgrey}{gray}{0.8}
+
+% check for package colortbl
+% used for colored table cells
+\newboolean{colortbl}
+\IfFileExists{colortbl.sty}
+ {\usepackage{colortbl}
+  \setboolean{colortbl}{true}}
+ {\setboolean{colortbl}{false}}
+
+% used to have extra space in table cells
+\@ifundefined{extrarowheight}
+ {\usepackage{array}}{}
+\setlength{\extrarowheight}{2pt}
+
+% used for customized tables
+% ---
+\newcolumntype{M}[1]
+ {>{\centering\hspace{0pt}}m{#1}}
+
+\newcolumntype{S}[2]
+ {>{\centering\hspace{0pt}}m{(#1+(2\tabcolsep+\arrayrulewidth)*(1-#2))/#2}}
+
+\newcolumntype{K}[1]
+ {>{\columncolor{#1}\hspace{0pt}}c}
+
+\newcolumntype{V}{!{\vrule width 1.5pt}}
+
+\newcolumntype{W}{!{\color{green}\vline}}
+% ---
+
+% insert additional vertical space of
+% 1.5 mm between footnotes
+\let\myFoot\footnote
+\renewcommand{\footnote}[1]{\myFoot{#1\vspace{1.5mm}}}
+
+% number algorithm floats within chapters
+\numberwithin{algorithm}{chapter}
+
+% ------------------------------------
+% used to check for needed LaTeX packages
+\usepackage{ifthen}
+
+% check for package arydshln
+% used for tables with dashed lines
+\newboolean{arydshln}
+\IfFileExists{arydshln.sty}
+ {\usepackage{arydshln}
+  \setboolean{arydshln}{true}}
+ {\setboolean{arydshln}{false}}
+
+% check for package marginnote
+% used for margin notes
+\newboolean{marginnote}
+\IfFileExists{marginnote.sty}
+ {\usepackage{marginnote}
+  \let\marginpar\marginnote
+  \setboolean{marginnote}{true}}
+ {\setboolean{marginnote}{false}}
+
+% check for package sidecap
+% used for captions on the side
+\newboolean{sidecap}
+\IfFileExists{sidecap.sty}
+ {\usepackage{sidecap}
+  \setboolean{sidecap}{true}}
+ {\setboolean{sidecap}{false}}
+
+% check for picinpar
+% used for surrounded fixed objects
+\newboolean{picinpar}
+\IfFileExists{picinpar.sty}
+ {\usepackage{picinpar}
+  \setboolean{picinpar}{true}}
+ {\setboolean{picinpar}{false}}
+
+% check for lettrine
+\newboolean{lettrine}
+\IfFileExists{lettrine.sty}
+ {\usepackage{lettrine}
+  \setboolean{lettrine}{true}}
+ {\setboolean{lettrine}{false}}
+
+% check for diagbox
+\newboolean{diagbox}
+\IfFileExists{diagbox.sty}
+ {\usepackage{diagbox}
+  \setboolean{diagbox}{true}}
+ {\setboolean{diagbox}{false}}
+% Added by lyx2lyx
+\setlength{\parskip}{\medskipamount}
+\setlength{\parindent}{0pt}
+\end_preamble
+\options bibliography=totoc,index=totoc,BCOR7.5mm,titlepage,captions=tableheading,dvipsnames,table
+\use_default_options false
+\begin_modules
+initials
+graphicboxes
+varwidth
+\end_modules
+\maintain_unincluded_children no
+\language english
+\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 true
+\graphics default
+\default_output_format pdf2
+\output_sync 0
+\bibtex_command default
+\index_command makeindex
+\paperfontsize 12
+\spacing single
+\use_hyperref true
+\pdf_title "LyX's Figure, Table, Floats, Notes, and Boxes manual"
+\pdf_author "LyX Team, Uwe Stöhr"
+\pdf_subject "LyX-documentation about figures, tables, floats, notes, and boxes"
+\pdf_keywords "LyX, Tables, Figures, Floats, Boxes, Notes"
+\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 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 0
+\use_minted 0
+\use_lineno 0
+\notefontcolor #0000ff
+\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 2
+\paperpagestyle default
+\tablestyle default
+\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
+'s detailed Figure, Table, Floats, Notes, Boxes and External Material manual
+\end_layout
+
+\begin_layout Chapter
+Floats
+\end_layout
+
+\begin_layout Section
+Floats Side by Side
+\end_layout
+
+\begin_layout Standard
+To place floats side by side, as in Figures
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "fig:Float-left"
+
+\end_inset
+
+ and 
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "fig:Float-right"
+
+\end_inset
+
+, only 
+\emph on
+one
+\emph default
+ float is used.
+ In it two minipage boxes are inserted.
+ 
+\end_layout
+
+\begin_layout Standard
+\begin_inset Float figure
+placement document
+alignment document
+wide false
+sideways false
+status open
+
+\begin_layout Plain Layout
+\begin_inset Box Frameless
+position "b"
+hor_pos "c"
+has_inner_box 1
+inner_pos "t"
+use_parbox 0
+use_makebox 0
+width "45col%"
+special "none"
+height "1in"
+height_special "totalheight"
+thickness "0.4pt"
+separation "3pt"
+shadowsize "4pt"
+framecolor "black"
+backgroundcolor "none"
+status open
+
+\begin_layout Plain Layout
+\align center
+\begin_inset Graphics
+	filename ../../../lib/doc/clipart/2D-intensity-plot.pdf
+	width 100col%
+	scaleBeforeRotation
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Caption Standard
+
+\begin_layout Plain Layout
+\begin_inset CommandInset label
+LatexCommand label
+name "fig:Float-left"
+
+\end_inset
+
+Float on the left side.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\begin_inset space \hfill{}
+\end_inset
+
+
+\begin_inset Box Frameless
+position "b"
+hor_pos "c"
+has_inner_box 1
+inner_pos "t"
+use_parbox 0
+use_makebox 0
+width "45col%"
+special "none"
+height "1in"
+height_special "totalheight"
+thickness "0.4pt"
+separation "3pt"
+shadowsize "4pt"
+framecolor "black"
+backgroundcolor "none"
+status open
+
+\begin_layout Plain Layout
+\align center
+\begin_inset Graphics
+	filename ../../../lib/doc/clipart/Star-structure.pdf
+	width 100col%
+	scaleBeforeRotation
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Caption Standard
+
+\begin_layout Plain Layout
+\begin_inset CommandInset label
+LatexCommand label
+name "fig:Float-right"
+
+\end_inset
+
+Float on the right side.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_body
+\end_document
diff --git a/autotests/export/docbook/subfigures_boxes_EmbeddedObjects.xml b/autotests/export/docbook/subfigures_boxes_EmbeddedObjects.xml
new file mode 100644
index 0000000..7f010cf
--- /dev/null
+++ b/autotests/export/docbook/subfigures_boxes_EmbeddedObjects.xml
@@ -0,0 +1,32 @@
+<?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 -->
+<book 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>LyX's detailed Figure, Table, Floats, Notes, Boxes and External Material manual</title>
+<chapter>
+<title>Floats</title>
+<section>
+<title>Floats Side by Side</title>
+<para>To place floats side by side, as in Figures&#xA0;<xref linkend="fig.Float-left" /> and <xref linkend="fig.Float-right" />, only <emphasis>one</emphasis> float is used. In it two minipage boxes are inserted. </para>
+<formalgroup>
+<title>No caption</title>
+<figure xml:id="fig.Float-left">
+<title>Float on the left side.</title>
+<mediaobject>
+<imageobject>
+<imagedata fileref="D:/LyX/lyx-unstable/lib/doc/clipart/2D-intensity-plot.pdf"  width="100%"  />
+</imageobject>
+</mediaobject>
+</figure>
+<figure xml:id="fig.Float-right">
+<title>Float on the right side.</title>
+<mediaobject>
+<imageobject>
+<imagedata fileref="D:/LyX/lyx-unstable/lib/doc/clipart/Star-structure.pdf"  width="100%"  />
+</imageobject>
+</mediaobject>
+</figure>
+</formalgroup>
+</section>
+</chapter>
+</book>
\ No newline at end of file
diff --git a/src/insets/InsetFloat.cpp b/src/insets/InsetFloat.cpp
index eaa24cb..4e7db11 100644
--- a/src/insets/InsetFloat.cpp
+++ b/src/insets/InsetFloat.cpp
@@ -566,6 +566,66 @@ const InsetCaption* findCaptionInParagraph(const Paragraph &par)
 }
 
 
+/// Takes an unstructured subfigure container (typically, an InsetBox) and find the elements within:
+/// actual content (image or table), maybe a caption, maybe a label.
+std::tuple<InsetCode, const Inset *, const InsetCaption *, const InsetLabel *> docbookParseHopelessSubfigure(const InsetText * subfigure)
+{
+	InsetCode type = NO_CODE;
+	const Inset * content = nullptr;
+	const InsetCaption * caption = nullptr;
+	const InsetLabel * label = nullptr;
+
+	for (const auto & it : subfigure->paragraphs()) {
+		for (pos_type posIn = 0; posIn < it.size(); ++posIn) {
+			const Inset * inset = it.getInset(posIn);
+			if (inset) {
+				switch (inset->lyxCode()) {
+					case GRAPHICS_CODE:
+					case TABULAR_CODE:
+						if (!content) {
+							content = inset;
+							type = inset->lyxCode();
+						}
+						break;
+					case CAPTION_CODE:
+						if (!caption) {
+							caption = dynamic_cast<const InsetCaption *>(inset);
+
+							// A label often hides in a caption. Make a simplified version of the main loop.
+							if (!label) {
+								for (const auto &cit : caption->paragraphs()) {
+									for (pos_type cposIn = 0; cposIn < cit.size(); ++cposIn) {
+										const Inset *cinset = cit.getInset(posIn);
+										if (cinset && cinset->lyxCode() == LABEL_CODE) {
+											label = dynamic_cast<const InsetLabel *>(cinset);
+											break;
+										}
+									}
+
+									if (label)
+										break;
+								}
+							}
+						}
+						break;
+					case LABEL_CODE:
+						if (!label)
+							label = dynamic_cast<const InsetLabel *>(inset);
+						break;
+					default:
+						break;
+				}
+			}
+		}
+
+		if (content && caption && label)
+			break;
+	}
+
+	return std::make_tuple(type, content, caption, label);
+}
+
+
 void docbookSubfigures(XMLStream & xs, OutputParams const & runparams, const InsetCaption * caption,
 					   const InsetLabel * label, std::vector<const InsetCollapsible *> & subfigures)
 {
@@ -595,22 +655,27 @@ void docbookSubfigures(XMLStream & xs, OutputParams const & runparams, const Ins
 
 	// Deal with each subfigure individually. This should also deal with their caption and their label.
 	// This should be a recursive call to InsetFloat.
-	// An item in subfigure should either be an InsetBox containing an InsetFloat or directly an InsetFloat.
-	for (const InsetCollapsible *subfigure: subfigures) {
-		// If there is no InsetFloat in the paragraphs, output a warning.
-		bool foundInsetFloat = false;
+	// An item in subfigure should either be an InsetBox containing an InsetFloat, or an InsetBox directly containing
+	// an image or a table, or directly an InsetFloat.
+	for (const InsetCollapsible * subfigure: subfigures) {
+		if (subfigure == nullptr)
+			continue;
 
 		// The collapsible may already be a float (InsetFloat).
-		if (subfigure && dynamic_cast<const InsetFloat *>(subfigure))
-			foundInsetFloat = true;
+		if (dynamic_cast<const InsetFloat *>(subfigure)) {
+			subfigure->docbook(xs, runparams);
+			continue;
+		}
 
-		// Subfigures are in boxes.
-		if (!foundInsetFloat) {
+		// Subfigures are in boxes, then in InsetFloat.
+		{
+			bool foundInsetFloat = false;
 			for (const auto &it : subfigure->paragraphs()) {
 				for (pos_type posIn = 0; posIn < it.size(); ++posIn) {
 					const Inset *inset = it.getInset(posIn);
-					if (inset && dynamic_cast<const InsetFloat *>(inset)) {
+					if (inset && inset->lyxCode() == FLOAT_CODE) {
 						foundInsetFloat = true;
+						inset->docbook(xs, runparams);
 						break;
 					}
 				}
@@ -618,15 +683,79 @@ void docbookSubfigures(XMLStream & xs, OutputParams const & runparams, const Ins
 				if (foundInsetFloat)
 					break;
 			}
+			if (foundInsetFloat)
+				continue;
+		}
+
+		// Subfigures are in boxes, then directly an image or a table. In that case, generate the whole content of the
+		// InsetBox, but not the box container.
+		// Impose some model on the subfigure: at most a caption, at most a label, exactly one figure or one table.
+		{
+			InsetCode stype = NO_CODE;
+			const Inset * scontent = nullptr;
+			const InsetCaption * scaption = nullptr;
+			const InsetLabel * slabel = nullptr;
+
+			std::tie(stype, scontent, scaption, slabel) = docbookParseHopelessSubfigure(subfigure);
+
+			// If there is something, generate it. This is very much like docbookNoSubfigures, but many things
+			// must be coded differently because there is no float.
+			// TODO: some code is identical to Floating, like Floating::docbookTag or Floating::docbookCaption. How to reuse that code?
+			if (scontent) {
+				// Floating::docbookCaption()
+				string docbook_caption = "caption"; // This is already correct for tables.
+				if (stype == GRAPHICS_CODE)
+					docbook_caption = "title";
+
+				// Floating::docbookTag() with hasTitle = true, as we are in formalgroup.
+				string stag = "float";
+				if (stype == GRAPHICS_CODE)
+					stag = "figure";
+				else if (stype == TABULAR_CODE)
+					stag = "table";
+
+				// Ensure there is no label output, it is supposed to be handled as xml:id.
+				if (slabel)
+					rpNoLabel.docbook_anchors_to_ignore.emplace(slabel->screenLabel());
+
+				// Ensure the float does not output its caption, as it is handled here (DocBook mandates a specific place for
+				// captions, they cannot appear at the end of the float, albeit LyX is happy with that).
+				OutputParams rpNoTitle = runparams;
+				rpNoTitle.docbook_in_float = true;
+				if (stype == TABULAR_CODE)
+					rpNoTitle.docbook_in_table = true;
+
+				// Organisation: <float> <title if any/> <contents without title/> </float>.
+				docstring sattr = docstring();
+				if (slabel)
+					sattr += "xml:id=\"" + xml::cleanID(slabel->screenLabel()) + "\"";
+				// No layout way of adding attributes, unlike the normal code path.
+
+				xs << xml::StartTag(stag, sattr);
+				xs << xml::CR();
+				xs << xml::StartTag(docbook_caption);
+				if (scaption)
+					scaption->getCaptionAsDocBook(xs, rpNoLabel);
+				else // Mandatory in formalgroup.
+					xs << "No caption detected";
+				xs << xml::EndTag(docbook_caption);
+				xs << xml::CR();
+				scontent->docbook(xs, rpNoTitle);
+				xs << xml::EndTag(stag);
+				xs << xml::CR();
+
+				// This subfigure could be generated.
+				continue;
+			}
 		}
 
-		if (!foundInsetFloat)
-			xs << XMLStream::ESCAPE_NONE << "Error: no float found in the box. "
-								"To use subfigures in DocBook, elements must be wrapped in a float "
-			                    "inset and have a title/caption.";
+		// If there is no InsetFloat in the inset, output a warning.
+		xs << XMLStream::ESCAPE_NONE << "Error: no float found in the box. "
+							"To use subfigures in DocBook, elements must be wrapped in a float "
+		                    "inset and have a title/caption.";
 		// TODO: could also output a table, that would ensure that the document is correct and *displays* correctly (but without the right semantics), instead of just an error.
 
-		// Finally, recurse.
+		// Recurse to generate as much content as possible (avoid any loss).
 		subfigure->docbook(xs, runparams);
 	}
 

commit e8545b466f2ebacf639f559a287b9d6c0276207b
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Fri Sep 11 23:38:11 2020 +0200

    DocBook: ensure xml:id is not output too many times.
    
    This is mostly important for subfigures, but debugging this issue showed that InsetCaption could be slightly simplified and InsetLabel should be made a tad more robust.

diff --git a/src/insets/InsetCaption.cpp b/src/insets/InsetCaption.cpp
index 0291625..8297c6f 100644
--- a/src/insets/InsetCaption.cpp
+++ b/src/insets/InsetCaption.cpp
@@ -367,8 +367,7 @@ void InsetCaption::getCaptionAsDocBook(XMLStream & xs,
 		return;
 
 	// Ignore full_label_, as the DocBook processor will deal with the numbering.
-	InsetText::XHTMLOptions const opts =
-			InsetText::WriteLabel | InsetText::WriteInnerTag;
+	InsetText::XHTMLOptions opts = InsetText::WriteInnerTag;
 	InsetText::docbook(xs, runparams, opts);
 }
 
diff --git a/src/insets/InsetFloat.cpp b/src/insets/InsetFloat.cpp
index d680013..eaa24cb 100644
--- a/src/insets/InsetFloat.cpp
+++ b/src/insets/InsetFloat.cpp
@@ -583,7 +583,7 @@ void docbookSubfigures(XMLStream & xs, OutputParams const & runparams, const Ins
 	xs << xml::StartTag("formalgroup", attr);
 	xs << xml::CR();
 
-	xs << xml::StartTag("title", attr);
+	xs << xml::StartTag("title"); // Don't take attr here, the ID should only go in one place, not two.
 	if (caption) {
 		caption->getCaptionAsDocBook(xs, rpNoLabel);
 	} else {
diff --git a/src/insets/InsetLabel.cpp b/src/insets/InsetLabel.cpp
index 2e80e26..5ba0344 100644
--- a/src/insets/InsetLabel.cpp
+++ b/src/insets/InsetLabel.cpp
@@ -356,8 +356,11 @@ int InsetLabel::plaintext(odocstringstream & os,
 void InsetLabel::docbook(XMLStream & xs, OutputParams const & runparams) const
 {
 	// Output an anchor only if it has not been processed before.
-	if (runparams.docbook_anchors_to_ignore.find(getParam("name")) == runparams.docbook_anchors_to_ignore.end()) {
-		docstring attr = from_utf8("xml:id=\"") + xml::cleanID(getParam("name")) + from_utf8("\"");
+	docstring id = getParam("name");
+	docstring cleaned_id = xml::cleanID(id);
+	if (runparams.docbook_anchors_to_ignore.find(id) == runparams.docbook_anchors_to_ignore.end() &&
+	        runparams.docbook_anchors_to_ignore.find(cleaned_id) == runparams.docbook_anchors_to_ignore.end()) {
+		docstring attr = from_utf8("xml:id=\"") + cleaned_id + from_utf8("\"");
 		xs << xml::CompTag("anchor", to_utf8(attr));
 	}
 }

commit 963d9cc0ae896b0377ec7f8ae21500b2dc597a28
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Fri Sep 11 03:14:41 2020 +0200

    DocBook: handle other cases of subfigures.

diff --git a/src/insets/InsetFloat.cpp b/src/insets/InsetFloat.cpp
index 981ba40..d680013 100644
--- a/src/insets/InsetFloat.cpp
+++ b/src/insets/InsetFloat.cpp
@@ -492,19 +492,22 @@ int InsetFloat::plaintext(odocstringstream & os, OutputParams const & runparams,
 }
 
 
-std::vector<const InsetBox *> findSubfiguresInParagraph(const Paragraph &par)
+std::vector<const InsetCollapsible *> findSubfiguresInParagraph(const Paragraph &par)
 {
 
 	// Don't make the hypothesis that all subfigures are in the same paragraph.
 	// Similarly, there may be several subfigures in the same paragraph (most likely case, based on the documentation).
 	// Any box is considered as a subfigure, even though the most likely case is \minipage.
-	std::vector<const InsetBox *> subfigures;
+	// Boxes are not required to make subfigures. The common root between InsetBox and InsetFLoat is InsetCollapsible.
+	std::vector<const InsetCollapsible *> subfigures;
 	for (pos_type pos = 0; pos < par.size(); ++pos) {
 		const Inset *inset = par.getInset(pos);
 		if (!inset)
 			continue;
 		if (const auto box = dynamic_cast<const InsetBox *>(inset))
 			subfigures.push_back(box);
+		else if (const auto fl = dynamic_cast<const InsetFloat *>(inset))
+			subfigures.push_back(fl);
 	}
 	return subfigures;
 }
@@ -564,7 +567,7 @@ const InsetCaption* findCaptionInParagraph(const Paragraph &par)
 
 
 void docbookSubfigures(XMLStream & xs, OutputParams const & runparams, const InsetCaption * caption,
-					   const InsetLabel * label, std::vector<const InsetBox *> & subfigures)
+					   const InsetLabel * label, std::vector<const InsetCollapsible *> & subfigures)
 {
 	// Ensure there is no label output, it is supposed to be handled as xml:id.
 	OutputParams rpNoLabel = runparams;
@@ -592,20 +595,29 @@ void docbookSubfigures(XMLStream & xs, OutputParams const & runparams, const Ins
 
 	// Deal with each subfigure individually. This should also deal with their caption and their label.
 	// This should be a recursive call to InsetFloat.
-	for (const InsetBox *subfigure: subfigures) {
+	// An item in subfigure should either be an InsetBox containing an InsetFloat or directly an InsetFloat.
+	for (const InsetCollapsible *subfigure: subfigures) {
 		// If there is no InsetFloat in the paragraphs, output a warning.
 		bool foundInsetFloat = false;
-		for (const auto & it : subfigure->paragraphs()) {
-			for (pos_type posIn = 0; posIn < it.size(); ++posIn) {
-				const Inset *inset = it.getInset(posIn);
-				if (inset && dynamic_cast<const InsetFloat*>(inset)) {
-					foundInsetFloat = true;
-					break;
+
+		// The collapsible may already be a float (InsetFloat).
+		if (subfigure && dynamic_cast<const InsetFloat *>(subfigure))
+			foundInsetFloat = true;
+
+		// Subfigures are in boxes.
+		if (!foundInsetFloat) {
+			for (const auto &it : subfigure->paragraphs()) {
+				for (pos_type posIn = 0; posIn < it.size(); ++posIn) {
+					const Inset *inset = it.getInset(posIn);
+					if (inset && dynamic_cast<const InsetFloat *>(inset)) {
+						foundInsetFloat = true;
+						break;
+					}
 				}
-			}
 
-			if (foundInsetFloat)
-				break;
+				if (foundInsetFloat)
+					break;
+			}
 		}
 
 		if (!foundInsetFloat)
@@ -673,11 +685,11 @@ void InsetFloat::docbook(XMLStream & xs, OutputParams const & runparams) const
 	// The caption and the label for each subfigure is handled by recursive calls.
 	const InsetCaption* caption = nullptr;
 	const InsetLabel* label = nullptr;
-	std::vector<const InsetBox *> subfigures;
+	std::vector<const InsetCollapsible *> subfigures;
 
 	auto end = paragraphs().end();
 	for (auto it = paragraphs().begin(); it != end; ++it) {
-		std::vector<const InsetBox *> foundSubfigures = findSubfiguresInParagraph(*it);
+		std::vector<const InsetCollapsible *> foundSubfigures = findSubfiguresInParagraph(*it);
 		if (!foundSubfigures.empty()) {
 			subfigures.reserve(subfigures.size() + foundSubfigures.size());
 			subfigures.insert(subfigures.end(), foundSubfigures.begin(), foundSubfigures.end());

commit 4be80db357b195ee0b04ab0b90a2e4b88957832b
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Fri Sep 11 03:05:04 2020 +0200

    DocBook: in configure.py, DeclareDocBookClass doesn't need to be checked anymore.

diff --git a/lib/configure.py b/lib/configure.py
index 2247c78..6cb1c70 100644
--- a/lib/configure.py
+++ b/lib/configure.py
@@ -1311,7 +1311,7 @@ def _checkForClassExtension(x):
         return x.strip()
 
 def processLayoutFile(file):
-    ''' process layout file and get a line of result
+    """ process layout file and get a line of result
 
         Declare lines look like this:
 
@@ -1336,38 +1336,36 @@ def processLayoutFile(file):
         "article" "article" "article" "false" "article.cls" "Articles"
         "scrbook" "scrbook" "book (koma-script)" "false" "scrbook.cls" "Books"
         "svjog" "svjour" "article (Springer - svjour/jog)" "false" "svjour.cls,svjog.clo" ""
-    '''
+    """
     classname = file.split(os.sep)[-1].split('.')[0]
-    # return ('LaTeX', '[a,b]', 'a', ',b,c', 'article') for \DeclareLaTeXClass[a,b,c]{article}
-    p = re.compile('\s*#\s*\\\\Declare(LaTeX|DocBook)Class\s*(\[([^,]*)(,.*)*\])*\s*{(.*)}\s*$')
+    # return ('[a,b]', 'a', ',b,c', 'article') for \DeclareLaTeXClass[a,b,c]{article}
+    p = re.compile('\s*#\s*\\\\DeclareLaTeXClass\s*(\[([^,]*)(,.*)*])*\s*{(.*)}\s*$')
     q = re.compile('\s*#\s*\\\\DeclareCategory{(.*)}\s*$')
     classdeclaration = ""
     categorydeclaration = '""'
     for line in open(file, 'r', encoding='utf8').readlines():
         res = p.match(line)
         qres = q.match(line)
-        if res != None:
-            (classtype, optAll, opt, opt1, desc) = res.groups()
-            avai = {'LaTeX': 'false', 'DocBook': 'true'}[classtype]
-            if opt == None:
+        if res is not None:
+            (optAll, opt, opt1, desc) = res.groups()
+            if opt is None:
                 opt = classname
-                prereq_latex = _checkForClassExtension(classname)
+                prereq = _checkForClassExtension(classname)
             else:
                 prereq_list = optAll[1:-1].split(',')
                 prereq_list = list(map(_checkForClassExtension, prereq_list))
-                prereq_latex = ','.join(prereq_list)
-            prereq = {'LaTeX': prereq_latex, 'DocBook': ''}[classtype]
+                prereq = ','.join(prereq_list)
             classdeclaration = ('"%s" "%s" "%s" "%s" "%s"'
-                               % (classname, opt, desc, avai, prereq))
+                               % (classname, opt, desc, 'false', prereq))
             if categorydeclaration != '""':
                 return classdeclaration + " " + categorydeclaration
-        if qres != None:
-             categorydeclaration = '"%s"' % (qres.groups()[0])
-             if classdeclaration:
-                 return classdeclaration + " " + categorydeclaration
+        if qres is not None:
+            categorydeclaration = '"%s"' % (qres.groups()[0])
+            if classdeclaration:
+                return classdeclaration + " " + categorydeclaration
     if classdeclaration:
         return classdeclaration + " " + categorydeclaration
-    logger.warning("Layout file " + file + " has no \DeclareXXClass line. ")
+    logger.warning("Layout file " + file + " has no \\DeclareLaTeXClass line. ")
     return ""
 
 
@@ -1434,7 +1432,7 @@ def checkLatexConfig(check_config):
     # Construct the list of classes to test for.
     # build the list of available layout files and convert it to commands
     # for chkconfig.ltx
-    declare = re.compile('\\s*#\\s*\\\\Declare(LaTeX|DocBook)Class\\s*(\[([^,]*)(,.*)*\])*\\s*{(.*)}\\s*$')
+    declare = re.compile('\\s*#\\s*\\\\DeclareLaTeXClass\\s*(\[([^,]*)(,.*)*\])*\\s*{(.*)}\\s*$')
     category = re.compile('\\s*#\\s*\\\\DeclareCategory{(.*)}\\s*$')
     empty = re.compile('\\s*$')
     testclasses = list()
@@ -1455,10 +1453,10 @@ def checkLatexConfig(check_config):
                         nodeclaration = True
                     # A class, but no category declaration. Just break.
                     break
-                if declare.match(line) != None:
+                if declare.match(line) is not None:
                     decline = "\\TestDocClass{%s}{%s}" % (classname, line[1:].strip())
                     testclasses.append(decline)
-                elif category.match(line) != None:
+                elif category.match(line) is not None:
                     catline = ("\\DeclareCategory{%s}{%s}"
                                % (classname, category.match(line).groups()[0]))
                     testclasses.append(catline)

commit 812a140f6574f43ce99cfdcf327578ca6095aeb2
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Fri Sep 11 01:50:26 2020 +0200

    DocBook: remove now useless function in configure.py.

diff --git a/lib/configure.py b/lib/configure.py
index 1547000..2247c78 100644
--- a/lib/configure.py
+++ b/lib/configure.py
@@ -1265,26 +1265,6 @@ def checkConverterEntries():
 ''')
 
 
-def checkDocBook():
-    ''' Check docbook '''
-    path, DOCBOOK = checkProg('SGML-tools 2.x (DocBook), db2x scripts or xsltproc', ['sgmltools', 'db2dvi', 'xsltproc'],
-        rc_entry = [
-            r'''\converter docbook    dvi        "sgmltools -b dvi $$i"	""
-\converter docbook    html       "sgmltools -b html $$i"	""
-\converter docbook    ps         "sgmltools -b ps $$i"	""''',
-            r'''\converter docbook    dvi        "db2dvi $$i"	""
-\converter docbook    html       "db2html $$i"	""''',
-            r'''\converter docbook    dvi        ""	""
-\converter docbook    html       "" ""''',
-            r'''\converter docbook    dvi        ""	""
-\converter docbook    html       ""	""'''])
-    #
-    if DOCBOOK:
-        return ('yes', 'true', '\\def\\hasdocbook{yes}')
-    else:
-        return ('no', 'false', '')
-
-
 def checkOtherEntries():
     ''' entries other than Format and Converter '''
     checkProg('ChkTeX', ['chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38'],

commit 5503144d4949455dfa95b8be218eeed0a34b9a44
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Fri Sep 11 01:28:59 2020 +0200

    DocBook: fix handling of new lines and fonts.
    
    Only the font variable was restored to the right state, not fs.

diff --git a/autotests/export/docbook/fonts_EmbeddedObjects.lyx b/autotests/export/docbook/fonts_EmbeddedObjects.lyx
new file mode 100644
index 0000000..9ea1ff1
--- /dev/null
+++ b/autotests/export/docbook/fonts_EmbeddedObjects.lyx
@@ -0,0 +1,288 @@
+#LyX 2.4 created this file. For more info see https://www.lyx.org/
+\lyxformat 598
+\begin_document
+\begin_header
+\save_transient_properties true
+\origin unavailable
+\textclass scrbook
+\begin_preamble
+% that links to image floats jumps
+% to the beginning of the float and 
+% not to its caption
+\usepackage[figure]{hypcap}
+
+% the pages of the TOC are numbered roman
+% and a PDF-bookmark for the TOC is added
+\let\myTOC\tableofcontents
+\renewcommand\tableofcontents{%
+  \frontmatter
+  \pdfbookmark[1]{\contentsname}{}
+  \myTOC
+  \mainmatter }
+
+% provides caption formatting
+\usepackage[labelfont={bf,sf}]{caption}[2004/07/16]
+
+% provides commands to set caption
+% beside tables/images
+\newcommand{\TabBesBeg}[1][1.0]{%
+ \let\MyTable\table
+ \let\MyEndtable\endtable
+ \renewenvironment{table}[1]{\begin{SCtable}[#1]##1}{\end{SCtable}}}
+
+\newcommand{\TabBesEnd}{%
+ \let\table\MyTable
+ \let\endtable\MyEndtable}
+
+\newcommand{\FigBesBeg}[1][1.0]{%
+ \let\MyFigure\figure
+ \let\MyEndfigure\endfigure
+ \renewenvironment{figure}[1]{\begin{SCfigure}[#1]##1}{\end{SCfigure}}}
+
+\newcommand{\FigBesEnd}{%
+ \let\figure\MyFigure
+ \let\endfigure\MyEndfigure}
+
+% enables calculation of values,
+\usepackage{calc}
+
+% increase the bottom float placement fraction
+\renewcommand{\bottomfraction}{0.5}
+
+% avoids that floats are placed before their
+% corresponding section starts
+\let\mySection\section\renewcommand{\section}{\suppressfloats[t]\mySection}
+
+% speed up the longtable calculation
+\setcounter{LTchunksize}{100}
+
+% used for colored tables
+\@ifundefined{textcolor}
+ {\usepackage{color}}{}
+\definecolor{darkgreen}{cmyk}{0.5, 0, 1, 0.5}
+\definecolor{lightgrey}{gray}{0.8}
+
+% check for package colortbl
+% used for colored table cells
+\newboolean{colortbl}
+\IfFileExists{colortbl.sty}
+ {\usepackage{colortbl}
+  \setboolean{colortbl}{true}}
+ {\setboolean{colortbl}{false}}
+
+% used to have extra space in table cells
+\@ifundefined{extrarowheight}
+ {\usepackage{array}}{}
+\setlength{\extrarowheight}{2pt}
+
+% used for customized tables
+% ---
+\newcolumntype{M}[1]
+ {>{\centering\hspace{0pt}}m{#1}}
+
+\newcolumntype{S}[2]
+ {>{\centering\hspace{0pt}}m{(#1+(2\tabcolsep+\arrayrulewidth)*(1-#2))/#2}}
+
+\newcolumntype{K}[1]
+ {>{\columncolor{#1}\hspace{0pt}}c}
+
+\newcolumntype{V}{!{\vrule width 1.5pt}}
+
+\newcolumntype{W}{!{\color{green}\vline}}
+% ---
+
+% insert additional vertical space of
+% 1.5 mm between footnotes
+\let\myFoot\footnote
+\renewcommand{\footnote}[1]{\myFoot{#1\vspace{1.5mm}}}
+
+% number algorithm floats within chapters
+\numberwithin{algorithm}{chapter}
+
+% ------------------------------------
+% used to check for needed LaTeX packages
+\usepackage{ifthen}
+
+% check for package arydshln
+% used for tables with dashed lines
+\newboolean{arydshln}
+\IfFileExists{arydshln.sty}
+ {\usepackage{arydshln}
+  \setboolean{arydshln}{true}}
+ {\setboolean{arydshln}{false}}
+
+% check for package marginnote
+% used for margin notes
+\newboolean{marginnote}
+\IfFileExists{marginnote.sty}
+ {\usepackage{marginnote}
+  \let\marginpar\marginnote
+  \setboolean{marginnote}{true}}
+ {\setboolean{marginnote}{false}}
+
+% check for package sidecap
+% used for captions on the side
+\newboolean{sidecap}
+\IfFileExists{sidecap.sty}
+ {\usepackage{sidecap}
+  \setboolean{sidecap}{true}}
+ {\setboolean{sidecap}{false}}
+
+% check for picinpar
+% used for surrounded fixed objects
+\newboolean{picinpar}
+\IfFileExists{picinpar.sty}
+ {\usepackage{picinpar}
+  \setboolean{picinpar}{true}}
+ {\setboolean{picinpar}{false}}
+
+% check for lettrine
+\newboolean{lettrine}
+\IfFileExists{lettrine.sty}
+ {\usepackage{lettrine}
+  \setboolean{lettrine}{true}}
+ {\setboolean{lettrine}{false}}
+
+% check for diagbox
+\newboolean{diagbox}
+\IfFileExists{diagbox.sty}
+ {\usepackage{diagbox}
+  \setboolean{diagbox}{true}}
+ {\setboolean{diagbox}{false}}
+% Added by lyx2lyx
+\setlength{\parskip}{\medskipamount}
+\setlength{\parindent}{0pt}
+\end_preamble
+\options bibliography=totoc,index=totoc,BCOR7.5mm,titlepage,captions=tableheading,dvipsnames,table
+\use_default_options false
+\begin_modules
+initials
+graphicboxes
+varwidth
+\end_modules
+\maintain_unincluded_children no
+\language english
+\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 true
+\graphics default
+\default_output_format pdf2
+\output_sync 0
+\bibtex_command default
+\index_command makeindex
+\paperfontsize 12
+\spacing single
+\use_hyperref true
+\pdf_title "LyX's Figure, Table, Floats, Notes, and Boxes manual"
+\pdf_author "LyX Team, Uwe Stöhr"
+\pdf_subject "LyX-documentation about figures, tables, floats, notes, and boxes"
+\pdf_keywords "LyX, Tables, Figures, Floats, Boxes, Notes"
+\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 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 0
+\use_minted 0
+\use_lineno 0
+\notefontcolor #0000ff
+\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 2
+\paperpagestyle default
+\tablestyle default
+\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
+'s detailed Figure, Table, Floats, Notes, Boxes and External Material manual
+\end_layout
+
+\begin_layout Chapter
+Floats
+\end_layout
+
+\begin_layout Standard
+can be created using these commands in the document preamble:
+\end_layout
+
+\begin_layout Standard
+
+\series bold
+
+\backslash
+usepackage[tableposition=top]{caption}
+\series default
+
+\begin_inset Newline newline
+\end_inset
+
+
+\series bold
+
+\backslash
+captionsetup[figure]{labelfont={tt}, textfont=it, indention=1cm,%
+\end_layout
+
+\end_body
+\end_document
diff --git a/autotests/export/docbook/fonts_EmbeddedObjects.xml b/autotests/export/docbook/fonts_EmbeddedObjects.xml
new file mode 100644
index 0000000..7ce65a1
--- /dev/null
+++ b/autotests/export/docbook/fonts_EmbeddedObjects.xml
@@ -0,0 +1,12 @@
+<?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 -->
+<book 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>LyX's detailed Figure, Table, Floats, Notes, Boxes and External Material manual</title>
+<chapter>
+<title>Floats</title>
+<para>can be created using these commands in the document preamble:</para>
+<para><emphasis role='bold'>\usepackage[tableposition=top]{caption}</emphasis></para>
+<para><emphasis role='bold'>\captionsetup[figure]{labelfont={tt}, textfont=it, indention=1cm,%</emphasis></para>
+</chapter>
+</book>
\ No newline at end of file
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index a409d20..8da67e3 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -3350,6 +3350,7 @@ std::vector<docstring> Paragraph::simpleDocBookOnePar(Buffer const & buf,
 	vector<xml::EndFontTag> tagsToClose;
 
 	std::vector<docstring> generatedParagraphs;
+	DocBookFontState old_fs = fs;
 	odocstringstream os;
 	auto * xs = new XMLStream(os); // XMLStream has no copy constructor: to create a new object, the only solution
 	// is to hold a pointer to the XMLStream (xs = XMLStream(os) is not allowed once the first object is built).
@@ -3369,8 +3370,10 @@ std::vector<docstring> Paragraph::simpleDocBookOnePar(Buffer const & buf,
 			os = odocstringstream();
 			delete xs;
 			xs = new XMLStream(os);
-			if (!ignore_fonts)
+			if (!ignore_fonts) {
 				font_old = outerfont.fontInfo();
+				fs = old_fs;
+			}
 		}
 
 		// Determine which tags should be opened or closed regarding fonts.

commit da199f744ebd93665d6ca3af0ba39150f4c91521
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Fri Sep 11 00:44:49 2020 +0200

    XHTML: fix generation of many useless </section>.

diff --git a/src/output_xhtml.cpp b/src/output_xhtml.cpp
index 7d9a69b..f8cd53e 100644
--- a/src/output_xhtml.cpp
+++ b/src/output_xhtml.cpp
@@ -611,20 +611,26 @@ void xhtmlParagraphs(Text const & text,
 
 		// Think about adding <section> and/or </section>s.
 		if (style.category() == from_utf8("Sectioning")) {
+			int level = style.toclevel;
+
 			// Need to close a previous section if it has the same level or a higher one (close <section> if opening a
-			// <h2> after a <h2>, <h3>, <h4>, <h5>, or <h6>). More examples:
+			// <h2> after a <h2>, <h3>, <h4>, <h5> or <h6>). More examples:
 			//   - current: h2; back: h1; do not close any <section>
 			//   - current: h1; back: h2; close two <section> (first the <h2>, then the <h1>, so a new <h1> can come)
-			// The level (h1, h2, etc.) corresponds to style.toclevel.
-			while (! headerLevels.empty() && style.toclevel <= headerLevels.top()) {
+			while (!headerLevels.empty() && level <= headerLevels.top()) {
+				// Output the tag only if it corresponds to a legit section.
+				int stackLevel = headerLevels.top();
+				if (stackLevel != Layout::NOT_IN_TOC && level > 1) { // <h1> is the document title.
+					xs << xml::EndTag("section");
+					xs << xml::CR();
+				}
 				headerLevels.pop();
-				xs << xml::EndTag("section");
-				xs << xml::CR();
 			}
 
-			// Open the new one.
-			headerLevels.push(style.toclevel);
-			if (style.toclevel > 1) { // <h1> is the document title.
+			// Open the new section: first push it onto the stack, then output it in XHTML.
+			headerLevels.push(level);
+			// Some sectioning-like elements should not be output (such as FrontMatter).
+			if (level != Layout::NOT_IN_TOC && level > 1) { // <h1> is the document title.
 				xs << xml::StartTag("section");
 				xs << xml::CR();
 			}
@@ -669,9 +675,11 @@ void xhtmlParagraphs(Text const & text,
 
 	// If need be, close <section>s, but only at the end of the document (otherwise, dealt with at the beginning
 	// of the loop).
-	while (! headerLevels.empty() && headerLevels.top() > 1) {
+	while (!headerLevels.empty() && headerLevels.top() > Layout::NOT_IN_TOC) {
+		docstring tag = from_utf8("</section>");
 		headerLevels.pop();
-		xs << xml::EndTag("section") << xml::CR();
+		xs << XMLStream::ESCAPE_NONE << tag;
+		xs << xml::CR();
 	}
 }
 

-----------------------------------------------------------------------

Summary of changes:
 src/output_xhtml.cpp |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
Repository for new features


More information about the lyx-cvs mailing list