From ffacdd8b469071e34c27f93e6f5b95f7a960a694 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sat, 18 Feb 2017 10:40:42 +0100 Subject: [PATCH] Output Preamble code of InPreamble styles before the styles themselves. This assures that macros are defined. Fixes: #10215 --- src/LaTeXFeatures.cpp | 5 ++++- src/Paragraph.cpp | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp index 4dacfcdbe1..3d70a5aa7b 100644 --- a/src/LaTeXFeatures.cpp +++ b/src/LaTeXFeatures.cpp @@ -1568,7 +1568,10 @@ docstring const LaTeXFeatures::getTClassPreamble() const list::const_iterator cit = usedLayouts_.begin(); list::const_iterator end = usedLayouts_.end(); for (; cit != end; ++cit) - tcpreamble << tclass[*cit].preamble(); + // For InPreamble layouts, we output the preamble stuff earlier + // (before the layouts). See Paragraph::Private::validate. + if (!tclass[*cit].inpreamble) + tcpreamble << tclass[*cit].preamble(); cit = usedInsetLayouts_.begin(); end = usedInsetLayouts_.end(); diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 0ae8291a05..e2ead40938 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -1391,6 +1391,7 @@ void Paragraph::Private::validate(LaTeXFeatures & features) const // output is wrong if this paragraph contains content // that needs to switch encoding. otexstringstream os; + os << layout_->preamble(); if (is_command) { os << '\\' << from_ascii(layout_->latexname()); // we have to provide all the optional arguments here, even though