]> git.lyx.org Git - lyx.git/commitdiff
tex2lyx:
authorUwe Stöhr <uwestoehr@web.de>
Mon, 24 Oct 2011 00:29:59 +0000 (00:29 +0000)
committerUwe Stöhr <uwestoehr@web.de>
Mon, 24 Oct 2011 00:29:59 +0000 (00:29 +0000)
- support for box background color, document fontcolor and background color (note_fontcolor was already supported)
- add colors and a nested box to the testfile

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39949 a592a061-630c-0410-9148-cb99ea01b6c8

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

index 6f235e1f037ccc8b957dc4596ac3ae1108a17869..368c3aa562799978ccad376640363db4049537b2 100644 (file)
@@ -52,7 +52,6 @@ Format LaTeX feature                        LyX feature
 347    tabular valign                       InsetTabular
 348    \phantom, \hphantom, \vphantom       InsetPhantom
 350    ?                                    \default_output_format
-351    ?                                    \backgroundcolor
 353    \printsubindex                       InsetIndex
 354    \printindex*, \printsubindex*        InsetIndex
 358    custom bibtex command                \bibtex_command
@@ -73,9 +72,6 @@ Format LaTeX feature                        LyX feature
 378    revision info                        InsetInfo
 380    ?                                    InsetPreview
 381    \xymatrix@!{0,R,C}                   InsetMathXYMatrix
-382    note_fontcolor                       InsetNote
-384    document font color                  \fontcolor
-385    shaded box background color          \boxbgcolor
 386    LyX version                          InsetInfo
 390    forward/reverse search               \forward_search, \forward_macro
 391    decimal alignment in tables          InsetTabular
index 5e26bfb336b27611e9a1f10f2a2f4bf4f0017279..719969452a0dd25322a23b432a78083b4537f9d7 100644 (file)
@@ -212,6 +212,9 @@ string h_use_bibtopic            = "false";
 string h_paperorientation        = "portrait";
 string h_suppress_date           = "false";
 string h_use_refstyle            = "0";
+string h_backgroundcolor;
+string h_boxbgcolor;
+string h_fontcolor;
 string h_notefontcolor;
 string h_secnumdepth             = "3";
 string h_tocdepth                = "3";
@@ -764,8 +767,14 @@ void end_preamble(ostream & os, TextClass const & /*textclass*/)
           << "\\paperorientation " << h_paperorientation << '\n'
           << "\\suppress_date " << h_suppress_date << '\n'
           << "\\use_refstyle " << h_use_refstyle << '\n';
+       if (!h_fontcolor.empty())
+               os << "\\fontcolor " << h_fontcolor << '\n';
        if (!h_notefontcolor.empty())
                os << "\\notefontcolor " << h_notefontcolor << '\n';
+       if (!h_backgroundcolor.empty())
+               os << "\\backgroundcolor " << h_backgroundcolor << '\n';
+       if (!h_boxbgcolor.empty())
+               os << "\\boxbgcolor " << h_boxbgcolor << '\n';
        os << h_margins
           << "\\secnumdepth " << h_secnumdepth << "\n"
           << "\\tocdepth " << h_tocdepth << "\n"
@@ -1127,9 +1136,18 @@ void parse_preamble(Parser & p, ostream & os,
                        string const color = p.getArg('{', '}');
                        string const space = p.getArg('{', '}');
                        string const value = p.getArg('{', '}');
-                       if (color == "note_fontcolor" && space == "rgb") {
+                       if (color == "document_fontcolor" && space == "rgb") {
+                               RGBColor c(RGBColorFromLaTeX(value));
+                               h_fontcolor = X11hexname(c);
+                       } else if (color == "note_fontcolor" && space == "rgb") {
                                RGBColor c(RGBColorFromLaTeX(value));
                                h_notefontcolor = X11hexname(c);
+                       } else if (color == "page_backgroundcolor" && space == "rgb") {
+                               RGBColor c(RGBColorFromLaTeX(value));
+                               h_backgroundcolor = X11hexname(c);
+                       } else if (color == "shadecolor" && space == "rgb") {
+                               RGBColor c(RGBColorFromLaTeX(value));
+                               h_boxbgcolor = X11hexname(c);
                        } else {
                                h_preamble << "\\definecolor{" << color
                                           << "}{" << space << "}{" << value
index 8c83d58768e2656a54e5cd3848c9ecb784492dfa..33d76cd00899d5c4951c89dd282770d124124967 100644 (file)
 
 \usepackage{amsmath}
 \usepackage{color}
+\definecolor{page_backgroundcolor}{rgb}{1, 0.3359375, 0}
+\pagecolor{page_backgroundcolor}
+\definecolor{document_fontcolor}{rgb}{0.66796875, 1, 0}
+\color{document_fontcolor}
 \definecolor{note_fontcolor}{rgb}{0, 0, 1}
 \definecolor{shadecolor}{rgb}{1, 0, 0}
 \usepackage{framed}
@@ -140,6 +144,11 @@ $\boxed{\int A=B}$
 \begin{shaded}%
 Shaded background box\end{shaded}
 
+\begin{minipage}[c]{1\columnwidth}%
+\begin{shaded}%
+Shaded background box, with inner minipage\end{shaded}%
+\end{minipage}
+
 \section{Colors}
 
 \subsection{Predefined Colors}