]> git.lyx.org Git - lyx.git/blobdiff - src/paragraph.C
redraw fix 1.
[lyx.git] / src / paragraph.C
index f92968bac2cf75f008b6f518700e99fcd21928cd..97405c5e9421c23753a5fece4d9da068c975a67b 100644 (file)
@@ -1461,7 +1461,7 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf,
 
 // This could go to ParagraphParameters if we want to
 int Paragraph::startTeXParParams(BufferParams const & bparams,
-                                ostream & os) const
+                                ostream & os, bool moving_arg) const
 {
        int column = 0;
 
@@ -1470,6 +1470,22 @@ int Paragraph::startTeXParParams(BufferParams const & bparams,
                column += 10;
        }
 
+       switch (params().align()) {
+       case LYX_ALIGN_NONE:
+       case LYX_ALIGN_BLOCK:
+       case LYX_ALIGN_LAYOUT:
+       case LYX_ALIGN_SPECIAL:
+               break;
+       case LYX_ALIGN_LEFT:
+       case LYX_ALIGN_RIGHT:
+       case LYX_ALIGN_CENTER:
+               if (moving_arg) {
+                       os << "\\protect";
+                       column = 8;
+               }
+               break;
+       }
+       
        switch (params().align()) {
        case LYX_ALIGN_NONE:
        case LYX_ALIGN_BLOCK:
@@ -1505,10 +1521,26 @@ int Paragraph::startTeXParParams(BufferParams const & bparams,
 
 // This could go to ParagraphParameters if we want to
 int Paragraph::endTeXParParams(BufferParams const & bparams,
-                              ostream & os) const
+                              ostream & os, bool moving_arg) const
 {
        int column = 0;
 
+       switch (params().align()) {
+       case LYX_ALIGN_NONE:
+       case LYX_ALIGN_BLOCK:
+       case LYX_ALIGN_LAYOUT:
+       case LYX_ALIGN_SPECIAL:
+               break;
+       case LYX_ALIGN_LEFT:
+       case LYX_ALIGN_RIGHT:
+       case LYX_ALIGN_CENTER:
+               if (moving_arg) {
+                       os << "\\protect";
+                       column = 8;
+               }
+               break;
+       }
+       
        switch (params().align()) {
        case LYX_ALIGN_NONE:
        case LYX_ALIGN_BLOCK:
@@ -1602,7 +1634,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
                        ++column;
                }
                if (!asdefault)
-                       column += startTeXParParams(bparams, os);
+                       column += startTeXParParams(bparams, os, moving_arg);
 
        }
 
@@ -1626,7 +1658,8 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
                        }
 
                        if (!asdefault)
-                               column += startTeXParParams(bparams, os);
+                               column += startTeXParParams(bparams, os,
+                                                           moving_arg);
                }
 
                value_type c = getChar(i);
@@ -1741,7 +1774,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
        }
 
        if (!asdefault) {
-               column += endTeXParParams(bparams, os);
+               column += endTeXParParams(bparams, os, moving_arg);
        }
 
        lyxerr[Debug::LATEX] << "SimpleTeXOnePar...done " << this << endl;