[LyX/master] Simplify output code

Juergen Spitzmueller spitz at lyx.org
Mon Dec 19 09:13:29 UTC 2022


commit 41146030b6551619c306b6af98fd53d8ce0ad004
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Mon Dec 19 11:08:41 2022 +0100

    Simplify output code
---
 lib/chkconfig.ltx    |    2 ++
 src/BufferParams.cpp |   17 ++++++++---------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/lib/chkconfig.ltx b/lib/chkconfig.ltx
index 957ea22..34f9aff 100644
--- a/lib/chkconfig.ltx
+++ b/lib/chkconfig.ltx
@@ -237,6 +237,8 @@
 %%% Crucial versions
 % This one introduces \textsubscript
 \TestLaTeXVersion{2005/12/01}
+% This one introduces \UseRawInputEncoding
+\TestLaTeXVersion{2018/04/01}
 % This one introduces path encoding changes
 \TestLaTeXVersion{2019/10/01}
 % This introduces all math and text spaces
diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index 01be1bf..3c55756 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -3429,10 +3429,10 @@ void BufferParams::writeEncodingPreamble(otexstream & os,
 		case Encoding::CJK:
 		case Encoding::japanese:
 			if (encoding().iconvName() != "UTF-8"
-				&& !features.runparams().isFullUnicode())
-			  // don't default to [utf8]{inputenc} with TeXLive >= 18
-			  os << "\\ifdefined\\UseRawInputEncoding\n"
-				 << "  \\UseRawInputEncoding\\fi\n";
+			    && !features.runparams().isFullUnicode()
+			    && features.isAvailable("LaTeX-2018/04/01"))
+				// don't default to [utf8]{inputenc} with LaTeX >= 2018/04
+				os << "\\UseRawInputEncoding\n";
 			break;
 		case Encoding::inputenc:
 			// do not load inputenc if japanese is used
@@ -3456,11 +3456,10 @@ void BufferParams::writeEncodingPreamble(otexstream & os,
 			break;
 		}
 	}
-	if (inputenc == "auto-legacy-plain" || features.isRequired("japanese")) {
-		// don't default to [utf8]{inputenc} with TeXLive >= 18
-		os << "\\ifdefined\\UseRawInputEncoding\n";
-		os << "  \\UseRawInputEncoding\\fi\n";
-	}
+	if ((inputenc == "auto-legacy-plain" || features.isRequired("japanese"))
+	    && features.isAvailable("LaTeX-2018/04/01"))
+		// don't default to [utf8]{inputenc} with LaTeX >= 2018/04
+		os << "\\UseRawInputEncoding\n";
 }
 
 


More information about the lyx-cvs mailing list