Author: vfr
Date: Mon Jan  3 22:23:38 2011
New Revision: 37092
URL: http://www.lyx.org/trac/changeset/37092

Log:
Fix bug #7096: Wrong LaTeX export for layouts with intitle=true in branches.

Modified:
   lyx-devel/trunk/src/OutputParams.cpp
   lyx-devel/trunk/src/OutputParams.h
   lyx-devel/trunk/src/output_latex.cpp

Modified: lyx-devel/trunk/src/OutputParams.cpp
==============================================================================
--- lyx-devel/trunk/src/OutputParams.cpp        Mon Jan  3 21:59:17 2011        
(r37091)
+++ lyx-devel/trunk/src/OutputParams.cpp        Mon Jan  3 22:23:38 2011        
(r37092)
@@ -20,7 +20,8 @@
 
 OutputParams::OutputParams(Encoding const * enc)
        : flavor(LATEX), math_flavor(NotApplicable), nice(false), 
moving_arg(false), 
-         inulemcmd(false), local_font(0), master_language(0), encoding(enc),
+         inulemcmd(false), inTitle(false), didTitle(false). local_font(0),
+         master_language(0), encoding(enc),
          free_spacing(false), use_babel(false), use_polyglossia(false),
          use_indices(false), use_japanese(false), linelen(0), depth(0),
          exportdata(new ExportData),

Modified: lyx-devel/trunk/src/OutputParams.h
==============================================================================
--- lyx-devel/trunk/src/OutputParams.h  Mon Jan  3 21:59:17 2011        (r37091)
+++ lyx-devel/trunk/src/OutputParams.h  Mon Jan  3 22:23:38 2011        (r37092)
@@ -99,6 +99,14 @@
        */
        mutable bool inulemcmd;
 
+       /** Whether we are in the process of outputting title information. 
+        */ 
+       mutable bool inTitle; 
+
+       /** Whether we have arleady output \maketitle or whatever.
+        */
+       mutable bool didTitle;
+
        /** the font at the point where the inset is
         */
        Font const * local_font;

Modified: lyx-devel/trunk/src/output_latex.cpp
==============================================================================
--- lyx-devel/trunk/src/output_latex.cpp        Mon Jan  3 21:59:17 2011        
(r37091)
+++ lyx-devel/trunk/src/output_latex.cpp        Mon Jan  3 22:23:38 2011        
(r37092)
@@ -978,9 +978,6 @@
        pit_type pit = runparams.par_begin;
        // lastpit is for the language check after the loop.
        pit_type lastpit = pit;
-       // variables used in the loop:
-       bool was_title = false;
-       bool already_title = false;
        DocumentClass const & tclass = bparams.documentClass();
 
        for (; pit < runparams.par_end; ++pit) {
@@ -993,12 +990,12 @@
                                tclass.plainLayout() : par->layout();
 
                if (layout.intitle) {
-                       if (already_title) {
+                       if (runparams.didTitle) {
                                LYXERR0("Error in latexParagraphs: You"
                                        " should not mix title layouts"
                                        " with normal ones.");
-                       } else if (!was_title) {
-                               was_title = true;
+                       } else if (!runparams.inTitle) {
+                               runparams.inTitle = true;
                                if (tclass.titletype() == TITLE_ENVIRONMENT) {
                                        os << "\\begin{"
                                                        << 
from_ascii(tclass.titlename())
@@ -1006,7 +1003,7 @@
                                        texrow.newline();
                                }
                        }
-               } else if (was_title && !already_title) {
+               } else if (runparams.inTitle && !runparams.didTitle) {
                        if (tclass.titletype() == TITLE_ENVIRONMENT) {
                                os << "\\end{" << from_ascii(tclass.titlename())
                                                << "}\n";
@@ -1016,8 +1013,8 @@
                                                << "\n";
                        }
                        texrow.newline();
-                       already_title = true;
-                       was_title = false;
+                       runparams.didTitle = true;
+                       runparams.inTitle = false;
                }
 
 
@@ -1043,7 +1040,7 @@
        }
 
        // It might be that we only have a title in this document
-       if (was_title && !already_title) {
+       if (runparams.inTitle && !runparams.didTitle) {
                if (tclass.titletype() == TITLE_ENVIRONMENT) {
                        os << "\\end{" << from_ascii(tclass.titlename())
                            << "}\n";

Reply via email to