[LyX/master] Avoid \@ifundefined after user preamble

Juergen Spitzmueller spitz at lyx.org
Sun Jan 10 08:57:06 UTC 2021


commit c77ab339c121ba95cb25b6853545eba2780c025c
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Sun Jan 10 09:55:45 2021 +0100

    Avoid \@ifundefined after user preamble
    
    Users might have used \makeatother (#11163).
    
    \ifdefined (of e-tex) can be considered available nowadays.
---
 src/BufferParams.cpp |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index bc83548..f3f59cf 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -2240,8 +2240,10 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
 	// use \PassOptionsToPackage here because the user could have
 	// already loaded subfig in the preamble.
 	if (features.mustProvide("subfig"))
-		atlyxpreamble << "\\@ifundefined{showcaptionsetup}{}{%\n"
-		                 " \\PassOptionsToPackage{caption=false}{subfig}}\n"
+		atlyxpreamble << "\\ifdefined\\showcaptionsetup\n"
+		                 " % Caption package is used. Advise subfig not to load it again.\n"
+		                 " \\PassOptionsToPackage{caption=false}{subfig}\n"
+		                 "\\fi\n"
 		                 "\\usepackage{subfig}\n";
 
 	// Itemize bullet settings need to be last in case the user


More information about the lyx-cvs mailing list