]> git.lyx.org Git - features.git/commitdiff
If language needs to be reset at the end of footnotes or floats
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 16 Jul 2023 14:31:31 +0000 (16:31 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Sun, 16 Jul 2023 14:31:31 +0000 (16:31 +0200)
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
src/insets/InsetFoot.cpp
src/insets/InsetFoot.h
src/output_latex.cpp

index 65b4fc266f83975822775666a0cccf6d14ee4f00..36c972bc84a93047ef258b7889302d7e4229c3d7 100644 (file)
@@ -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;
index 6de5e1353472ec0f1ab8f258957afb83427f9fa1..1440310d3b72170eb35ca196f6bcaf9e96aa9dec 100644 (file)
@@ -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
 {
index 0c3f65aa706a95a354c29f212d16df51acffedf4..fe650078a90d0355e165130aa5394d3d97c2f9dd 100644 (file)
@@ -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;
        ///
index c24a5320e117cdebdb48711c67772be31a5ae8a2..ebe4c69d38eaff17f35f769215f49d2338fa34ef 100644 (file)
@@ -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';