From a4a7502769ca1d15ae7bbef6a2dbf4f4b2091680 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Sun, 12 Dec 2010 12:16:18 +0000 Subject: [PATCH] textsubscript and textsuperscript for tex2lyx (deactivated until format is recent enough) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36839 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/tex2lyx/preamble.cpp | 3 +++ src/tex2lyx/test/test-insets.tex | 4 ++++ src/tex2lyx/text.cpp | 9 +++++++++ 3 files changed, 16 insertions(+) diff --git a/src/tex2lyx/preamble.cpp b/src/tex2lyx/preamble.cpp index fc76051a75..9b6b9d25f6 100644 --- a/src/tex2lyx/preamble.cpp +++ b/src/tex2lyx/preamble.cpp @@ -377,6 +377,9 @@ void handle_package(Parser &p, string const & name, string const & opts, else if (name == "url") ; // ignore this + else if (LYX_FORMAT >= 408 && name == "subscript") + ; // ignore this + else if (name == "color") { // with the following command this package is only loaded when needed for // undefined colors, since we only support the predefined colors diff --git a/src/tex2lyx/test/test-insets.tex b/src/tex2lyx/test/test-insets.tex index 13e4026648..f7d16d2b29 100644 --- a/src/tex2lyx/test/test-insets.tex +++ b/src/tex2lyx/test/test-insets.tex @@ -16,6 +16,7 @@ \providecommand{\makenomenclature}{\makeglossary} \usepackage{varioref} \usepackage{prettyref} +\usepackage{subscript} \usepackage{graphicx} @@ -153,6 +154,9 @@ And what about special characters like hyphe\-nation mark, ellipsis\ldots, and end-of-sentence\@. LyX also supports a menu separator\lyxarrow{}and a spif\textcompwordmark{}fy ligature break. +A sub\textsubscript{sc\emph{ript}} and super\textsuperscript{script +with $a^2+b^2=c^2$ math}. + \printindex{} \printnomenclature{} diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp index 632be575d1..72426f550f 100644 --- a/src/tex2lyx/text.cpp +++ b/src/tex2lyx/text.cpp @@ -2162,6 +2162,15 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer, end_inset(os); } + else if (LYX_FORMAT >= 408 && + (t.cs() == "textsuperscript" || t.cs() == "textsubscript")) { + context.check_layout(os); + begin_inset(os, "script "); + os << t.cs().substr(4) << '\n'; + parse_text_in_inset(p, os, FLAG_ITEM, false, context); + end_inset(os); + } + else if (is_known(t.cs(), known_quotes)) { char const * const * where = is_known(t.cs(), known_quotes); context.check_layout(os);