commit 243b0ef90c09d52ba52e9918f2f80ba4557d068e
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Sun Jul 16 16:31:31 2023 +0200

    If language needs to be reset at the end of footnotes or floats
    
    then do reset it only after footnotes or floats. \selectlanguage at
    the end of environments might produce spurious vertical space
    (see https://marc.info/?l=lyx-devel&m=168872369617866)
---
 src/OutputParams.h       |    4 ++++
 src/insets/InsetFoot.cpp |    8 ++++++++
 src/insets/InsetFoot.h   |    2 ++
 src/output_latex.cpp     |   10 ++++++----
 4 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/OutputParams.h b/src/OutputParams.h
index 65b4fc2..36c972b 100644
--- a/src/OutputParams.h
+++ b/src/OutputParams.h
@@ -291,6 +291,10 @@ public:
         */
        bool inInclude = false;
 
+       /** Whether we are inside a footnote. 
+        */
+       bool inFootnote = false;
+
        /** Whether a btUnit (for multiple biblographies) is open.
         */
        mutable bool openbtUnit = false;
diff --git a/src/insets/InsetFoot.cpp b/src/insets/InsetFoot.cpp
index 6de5e13..1440310 100644
--- a/src/insets/InsetFoot.cpp
+++ b/src/insets/InsetFoot.cpp
@@ -111,6 +111,14 @@ docstring InsetFoot::toolTip(BufferView const & bv, int x, 
int y) const
 }
 
 
+void InsetFoot::latex(otexstream & os, OutputParams const & runparams_in) const
+{
+       OutputParams runparams(runparams_in);
+       runparams.inFootnote = true;
+       InsetText::latex(os, runparams);
+}
+
+
 int InsetFoot::plaintext(odocstringstream & os,
         OutputParams const & runparams, size_t max_length) const
 {
diff --git a/src/insets/InsetFoot.h b/src/insets/InsetFoot.h
index 0c3f65a..fe65007 100644
--- a/src/insets/InsetFoot.h
+++ b/src/insets/InsetFoot.h
@@ -32,6 +32,8 @@ private:
        ///
        docstring layoutName() const override;
        ///
+       void latex(otexstream &, OutputParams const &) const override;
+       ///
        int plaintext(odocstringstream & ods, OutputParams const & op,
                      size_t max_length = INT_MAX) const override;
        ///
diff --git a/src/output_latex.cpp b/src/output_latex.cpp
index c24a532..ebe4c69 100644
--- a/src/output_latex.cpp
+++ b/src/output_latex.cpp
@@ -1298,13 +1298,15 @@ void TeXOnePar(Buffer const & buf,
        if (localswitch_needed
            || (intitle_command && using_begin_end)
            || closing_rtl_ltr_environment
-           || (((runparams.isLastPar && !runparams.inbranch) || 
close_lang_switch)
-               && (par_lang != outer_lang || (using_begin_end
-                                               && style.isEnvironment()
-                                               && par_lang != nextpar_lang)))) 
{
                // Since \selectlanguage write the language to the aux file,
                // we need to reset the language at the end of footnote or
                // float.
+           || (((runparams.isLastPar
+                 && (using_begin_end || runparams.inFloat != 
OutputParams::NONFLOAT || runparams.inFootnote))
+                || close_lang_switch)
+               && (par_lang != outer_lang || (using_begin_end
+                                               && style.isEnvironment()
+                                               && par_lang != nextpar_lang)))) 
{
 
                if (!localswitch && (pending_newline || close_lang_switch))
                        os << '\n';
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to