[LyX/master] \cprotect amendment

Juergen Spitzmueller spitz at lyx.org
Sat Jun 22 11:41:21 UTC 2024


commit 8659924abd7026aa97a36bd99efeb11705ff7190
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Sat Jun 22 13:38:47 2024 +0200

    \cprotect amendment
    
    \cprotect'ed insets do not need forced local font switch; in fact files
    with this break in compilation. E.g. a caption with an URL containing
    the char '#' and caption text set to a secondary language.
---
 src/output_latex.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/output_latex.cpp b/src/output_latex.cpp
index 49dbd2d07a..f6026a6da6 100644
--- a/src/output_latex.cpp
+++ b/src/output_latex.cpp
@@ -1001,7 +1001,10 @@ void TeXOnePar(Buffer const & buf,
 		     && (prev_language->rightToLeft() != par_language->rightToLeft()));
 	bool const localswitch =
 			(runparams_in.find_effective()
-			|| text.inset().forceLocalFontSwitch()
+			// \cprotect'ed insets do not need, and actually
+			// break with, local switches
+			|| (text.inset().forceLocalFontSwitch()
+			    && !text.inset().needsCProtection(maintext, runparams.moving_arg))
 			|| (using_begin_end && text.inset().forcePlainLayout())
 			|| in_polyglossia_rtl_env)
 			&& !text.inset().forceParDirectionSwitch();


More information about the lyx-cvs mailing list