]> git.lyx.org Git - features.git/commitdiff
tex2lyx/text.cpp: support for \fcolorbox
authorUwe Stöhr <uwestoehr@lyx.org>
Mon, 18 May 2015 22:04:45 +0000 (00:04 +0200)
committerUwe Stöhr <uwestoehr@lyx.org>
Mon, 18 May 2015 22:04:45 +0000 (00:04 +0200)
and a fix also for \colorbox

src/tex2lyx/TODO.txt
src/tex2lyx/test/box-color-size-space-align.tex
src/tex2lyx/text.cpp

index 92f863bf06998a5a6f21273d178923a52e7edb8a..61f4e25474279afc582b49b4e5bb7a744ac92069 100644 (file)
@@ -86,7 +86,6 @@ Format LaTeX feature                        LyX feature
 489    horizontal alignment in boxes         InsetBox
        \centering
        \reggedleft
-492    command \fcolorbox                    InsetBox
 
 General
 
index 28d40a16080356204122ff73f8af34da27a46365..cc982ba58edc474080852d7c1a8f682c52a54378 100644 (file)
@@ -191,6 +191,18 @@ www
 
 \colorbox{blue}{\makebox[0.9\columnwidth][l]{www}}
 
+\fcolorbox{lime}{white}{\begin{minipage}[t]{0.9\columnwidth}%
+www%
+\end{minipage}}
+
+\fcolorbox{lime}{white}{\parbox[t]{0.9\columnwidth}{%
+www%
+}}
+
+\fcolorbox{lime}{white}{\makebox[0.9\columnwidth][l]{www}}
+
+\fcolorbox{lime}{white}{www}
+
 \subsection{LyX Boxes}
 
 \begin{lyxgreyedout}
index 671c24e1c7edd2c4fbd4fdcba8f09c7d2e28c96a..28f0b56ac42584cf637f4a4968cbe06a0a2e4ee3 100644 (file)
@@ -1099,7 +1099,7 @@ void parse_box(Parser & p, ostream & os, unsigned outer_flags,
                begin_inset(os, "Box ");
                if (outer_type == "framed")
                        os << "Framed\n";
-               else if (outer_type == "framebox" || outer_type == "fbox")
+               else if (outer_type == "framebox" || outer_type == "fbox" || frame_color != "")
                        os << "Boxed\n";
                else if (outer_type == "shadowbox")
                        os << "Shadowbox\n";
@@ -1118,6 +1118,8 @@ void parse_box(Parser & p, ostream & os, unsigned outer_flags,
                os << "hor_pos \"" << hor_pos << "\"\n";
                if (outer_type == "mbox")
                        os << "has_inner_box 1\n";
+               if (frame_color != "")
+                       os << "has_inner_box 0\n";
                else
                        os << "has_inner_box " << !inner_type.empty() << "\n";
                os << "inner_pos \"" << inner_pos << "\"\n";
@@ -1125,6 +1127,8 @@ void parse_box(Parser & p, ostream & os, unsigned outer_flags,
                   << '\n';
                if (outer_type == "mbox")
                        os << "use_makebox 1\n";
+               if (frame_color != "")
+                       os << "use_makebox 0\n";
                else
                        os << "use_makebox " << (inner_type == "makebox") << '\n';
                if (outer_type == "mbox")
@@ -1210,7 +1214,7 @@ void parse_box(Parser & p, ostream & os, unsigned outer_flags,
                }
 #endif
        }
-       if (background_color != "") {
+       if (inner_flags != FLAG_BRACE_LAST && (frame_color != "" || background_color != "")) {
                // in this case we have to eat the the closing brace of the color box
                p.get_token().asInput(); // the '}'
        }
@@ -4235,9 +4239,17 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                         t.cs() == "shadowbox" || t.cs() == "doublebox")
                        parse_outer_box(p, os, FLAG_ITEM, outer, context, t.cs(), "");
 
-               else if (t.cs() == "colorbox") {
-                       string const backgroundcolor = p.getArg('{', '}');
-                       parse_box(p, os, 0, 0, outer, context, "", "", "", "", backgroundcolor);
+               else if (t.cs() == "fcolorbox" || t.cs() == "colorbox") {
+                       string backgroundcolor;
+                       preamble.registerAutomaticallyLoadedPackage("xcolor");
+                       if (t.cs() == "fcolorbox") {
+                               string const framecolor = p.getArg('{', '}');
+                               backgroundcolor = p.getArg('{', '}');
+                               parse_box(p, os, 0, 0, outer, context, "", "", "", framecolor, backgroundcolor);
+                       } else {
+                               backgroundcolor = p.getArg('{', '}');
+                               parse_box(p, os, 0, 0, outer, context, "", "", "", "", backgroundcolor);
+                       }
                }
 
                else if (t.cs() == "fboxrule" || t.cs() == "fboxsep"