From e9d2c866b491bd3bb7f536c1f7dc72721f502342 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Uwe=20St=C3=B6hr?= Date: Wed, 26 Oct 2011 00:31:02 +0000 Subject: [PATCH] tex2lyx: addendum to r39949; handle the case that LyX's defined colors are defined but not used, now it is assures that only the color is used that is actually used for \color and \pagecolor git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39989 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/tex2lyx/preamble.cpp | 18 ++++++++++++++++++ .../test/box-color-size-space-align.tex | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/tex2lyx/preamble.cpp b/src/tex2lyx/preamble.cpp index fb31e65a3a..dafceb42e0 100644 --- a/src/tex2lyx/preamble.cpp +++ b/src/tex2lyx/preamble.cpp @@ -915,6 +915,24 @@ void parse_preamble(Parser & p, ostream & os, h_suppress_date = "true"; } + else if (t.cs() == "color") { + string argument = p.getArg('{', '}'); + // check the case that not a color defined by LyX is used + if (argument != "document_fontcolor") { + h_preamble << t.asInput() << '{' << argument << '}'; + h_fontcolor = ""; + } + } + + else if (t.cs() == "pagecolor") { + string argument = p.getArg('{', '}'); + // check the case that not a color defined by LyX is used + if (argument != "page_backgroundcolor") { + h_preamble << t.asInput() << '{' << argument << '}'; + h_backgroundcolor = ""; + } + } + else if (t.cs() == "makeatletter") { // LyX takes care of this p.setCatCode('@', catLetter); diff --git a/src/tex2lyx/test/box-color-size-space-align.tex b/src/tex2lyx/test/box-color-size-space-align.tex index 33d76cd008..dcbfb70d3b 100644 --- a/src/tex2lyx/test/box-color-size-space-align.tex +++ b/src/tex2lyx/test/box-color-size-space-align.tex @@ -15,7 +15,7 @@ \definecolor{document_fontcolor}{rgb}{0.66796875, 1, 0} \color{document_fontcolor} \definecolor{note_fontcolor}{rgb}{0, 0, 1} -\definecolor{shadecolor}{rgb}{1, 0, 0} +\definecolor{shadecolor}{rgb}{1, 1, 0} \usepackage{framed} \usepackage{calc} \usepackage{fancybox} -- 2.39.2