]> git.lyx.org Git - features.git/commitdiff
Fix forcing of text class for LaTeX snippets
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sun, 17 Jul 2022 22:45:01 +0000 (00:45 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 18 Jul 2022 17:40:41 +0000 (19:40 +0200)
When the input document is not a full document, make sure that the -c
is taken into account.

src/tex2lyx/Preamble.cpp

index 3588086cfa3c23b1ebffea778e92031e0d95db29..7b69bc4db5392eaa0bbba2853c42684f4866b721 100644 (file)
@@ -2174,17 +2174,17 @@ void Preamble::parse(Parser & p, string const & forceclass,
        if (detectEncoding && !is_full_document)
                return;
 
+       // Force textclass if the user wanted it
+       if (!forceclass.empty()) {
+               setTextClass(forceclass, tc);
+               class_set = true;
+       }
+
        while (is_full_document && p.good()) {
                if (detectEncoding && h_inputencoding != "auto-legacy" &&
                    h_inputencoding != "auto-legacy-plain")
                        return;
 
-               // Force textclass if the user wanted it
-               if (!forceclass.empty()) {
-                       setTextClass(forceclass, tc);
-                       class_set = true;
-               }
-
                Token const & t = p.get_token();
 
 #ifdef FILEDEBUG