[LyX/master] Allow to request empty \DocumentMetadata

Juergen Spitzmueller <[email protected]>
Newsgroups gmane.editors.lyx.cvs
Message-ID <[email protected]>
commit 552baa76e8868c93eadee4a87914b7fa40a52a1f
Author: Juergen Spitzmueller <[email protected]>
Date:   Fri Apr 3 09:18:26 2026 +0200

    Allow to request empty \DocumentMetadata
    
    per Requires DocumentMetadata
    
    Some newer classes require this
---
 src/BufferParams.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index 2935d96bcc..bb862e90b2 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -2125,8 +2125,9 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
 			      FileName const & filepath) const
 {
 	// DocumentMetadata must come before anything else
-	if (features.isAvailableAtLeastFrom("LaTeX", 2022, 6)
-	    && !containsOnly(document_metadata, " \n\t")) {
+	if ((features.isRequired("DocumentMetadata")
+	     || !containsOnly(document_metadata, " \n\t"))
+	    && features.isAvailableAtLeastFrom("LaTeX", 2022, 6)) {
 		// Check if the user preamble contains uncodable glyphs
 		odocstringstream doc_metadata;
 		docstring uncodable_glyphs;
@@ -2171,7 +2172,8 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
 			os << "\\DocumentMetadata{\n"
 			   << doc_metadata.str()
 			   << "}\n";
-		}
+		} else if (features.isRequired("DocumentMetadata"))
+			os << "\\DocumentMetadata{}\n";
 	}
 
 	// http://www.tug.org/texmf-dist/doc/latex/base/fixltx2e.pdf
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.