From 46e4463066d0f30d3a7c203bc729e14cd49ae229 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Uwe=20St=C3=B6hr?= Date: Mon, 24 Oct 2011 22:39:54 +0000 Subject: [PATCH] tex2lyx: support for phantom insets git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39958 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/tex2lyx/TODO.txt | 1 - src/tex2lyx/test/test-insets.tex | 22 ++++++++++++++++++++++ src/tex2lyx/text.cpp | 17 +++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/tex2lyx/TODO.txt b/src/tex2lyx/TODO.txt index ee6172e891..cf6b09429c 100644 --- a/src/tex2lyx/TODO.txt +++ b/src/tex2lyx/TODO.txt @@ -50,7 +50,6 @@ Format LaTeX feature LyX feature 336 ? \font_cjk 343 ? \use_default_options 347 tabular valign InsetTabular -348 \phantom, \hphantom, \vphantom InsetPhantom 350 ? \default_output_format 353 \printsubindex InsetIndex 354 \printindex*, \printsubindex* InsetIndex diff --git a/src/tex2lyx/test/test-insets.tex b/src/tex2lyx/test/test-insets.tex index 82299ac717..5ffbc6e88d 100644 --- a/src/tex2lyx/test/test-insets.tex +++ b/src/tex2lyx/test/test-insets.tex @@ -110,6 +110,7 @@ in their names. It's OK to use them in the man\"{u}script, though. \bibitem[{{G\"{u}rkan et~al.}(2004)}]{gur+04} Gürkan, M.~A., Freitag, M., \& Rasio, F.~A. 2004, ApJ, 604, 632\end{thebibliography} + \section{Input files\index{Input files}} We can input files too, like this \input{DummyDocument}, or with the include @@ -119,16 +120,37 @@ variant \include{DummyDocument} % unfortunately, including the doc twice If you prefer verbatim input, you can choose between~\verbatiminput{foo} or~\verbatiminput*{foo}. + \section{URL\index{URL}\nomenclature[www]{URL}{uniform resource locator}} An URL: \url{http://www.lyx.org} \nomenclature{URL2}{uniform resource locator} + \section{Lists\index{Lists}} \listoffigures \listoftables + +\section{Phantoms} + +test\hphantom{Wow}test + +test\phantom{\textcolor{green}{W}\textbf{ow}\textsuperscript{Wow}}test + +test\vphantom{Wow\textbackslash{}\&\%}test + +$test\hphantom{Wow}test$ + +\[ +test\phantom{\textcolor{green}{W}\mathbf{ow}\textsuperscript{Wow}}test +\] + + +$test\vphantom{Wow\&\%}test$ + + \section{Graphics\index{Graphics}} There is also some basic support for graphics, in the form diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp index 758ddc120b..ce58886981 100644 --- a/src/tex2lyx/text.cpp +++ b/src/tex2lyx/text.cpp @@ -881,6 +881,8 @@ void parse_box(Parser & p, ostream & os, unsigned outer_flags, Context context(true, parent_context.textclass); context.font = parent_context.font; + // FIXME, the inset layout should be plain, not standard, see bug #7846 + // If we have no inner box the contens will be read with the outer box if (!inner_type.empty()) parse_text(p, os, inner_flags, outer, context); @@ -2443,6 +2445,21 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer, os << "\n\\" << t.cs() << " default\n"; } + // FIXME, the inset layout should be plain, not standard, see bug #7846 + else if (t.cs() == "phantom" || t.cs() == "hphantom" || + t.cs() == "vphantom") { + context.check_layout(os); + if (t.cs() == "phantom") + begin_inset(os, "Phantom Phantom\n"); + if (t.cs() == "hphantom") + begin_inset(os, "Phantom Hhantom\n"); + if (t.cs() == "vphantom") + begin_inset(os, "Phantom Vhantom\n"); + os << "status open\n"; + parse_text_in_inset(p, os, FLAG_ITEM, outer, context); + end_inset(os); + } + else if (t.cs() == "lyxline") { // swallow size argument (it is not used anyway) p.getArg('{', '}'); -- 2.39.5