diff --git a/development/qmake/lyx.pro b/development/qmake/lyx.pro index f01286ff1f..7634a55a34 100644 --- a/development/qmake/lyx.pro +++ b/development/qmake/lyx.pro @@ -189,6 +189,7 @@ SOURCES += \ ../../src/insets/InsetPhantom.cpp \ ../../src/insets/InsetQuotes.cpp \ ../../src/insets/InsetRef.cpp \ +../../src/insets/InsetScript.cpp \ ../../src/insets/InsetSpace.cpp \ ../../src/insets/InsetSpecialChar.cpp \ ../../src/insets/InsetTabular.cpp \ @@ -531,6 +532,7 @@ HEADERS += \ ../../src/insets/InsetQuotes.h \ ../../src/insets/InsetPhantom.h \ ../../src/insets/InsetRef.h \ +../../src/insets/InsetScript.h \ ../../src/insets/InsetSpace.h \ ../../src/insets/InsetSpecialChar.h \ ../../src/insets/InsetTOC.h \ diff --git a/development/scons/scons_manifest.py b/development/scons/scons_manifest.py index 6d7e14eb57..e549f0572a 100644 --- a/development/scons/scons_manifest.py +++ b/development/scons/scons_manifest.py @@ -1057,6 +1057,7 @@ src_insets_header_files = Split(''' InsetPreview.h InsetQuotes.h InsetRef.h + InsetScript.h InsetSpace.h InsetSpecialChar.h InsetTOC.h @@ -1113,6 +1114,7 @@ src_insets_files = Split(''' InsetPreview.cpp InsetQuotes.cpp InsetRef.cpp + InsetScript.cpp InsetSpace.cpp InsetSpecialChar.cpp InsetTOC.cpp @@ -1499,6 +1501,8 @@ lib_images_files = Split(''' href-insert.png hidetab.png index-insert.png + inset-insert_script_script_subscript.png + inset-insert_script_script_superscript.png info-insert_buffer_vcs-revision.png label-insert.png layout-document.png diff --git a/lib/Makefile.am b/lib/Makefile.am index db7a59e037..097cfc62ca 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -381,6 +381,8 @@ dist_images_DATA = \ images/hidetab.png \ images/index-insert.png \ images/info-insert_buffer_vcs-revision.png \ + images/inset-insert_script_script_subscript.png \ + images/inset-insert_script_script_superscript.png \ images/label-insert.png \ images/layout.png \ images/layout-document.png \ diff --git a/lib/chkconfig.ltx b/lib/chkconfig.ltx index 20f957c626..87052e5496 100644 --- a/lib/chkconfig.ltx +++ b/lib/chkconfig.ltx @@ -297,6 +297,7 @@ \TestPackage{subfig} \TestPackage{Sweave} \TestPackage{textcomp} +\TestPackage{subscript} \TestPackage[turkmen.ldf]{turkmen} \TestPackage{ulem} \TestPackage{units} diff --git a/lib/doc/LaTeXConfig.lyx b/lib/doc/LaTeXConfig.lyx index d797625d55..c483837112 100644 --- a/lib/doc/LaTeXConfig.lyx +++ b/lib/doc/LaTeXConfig.lyx @@ -5208,6 +5208,39 @@ e., subfigures, subtables, etc.). have individual subcaptions. \end_layout +\begin_layout Subsection +subscript +\end_layout + +\begin_layout Description +Found: +\begin_inset Info +type "package" +arg "subscript" +\end_inset + + +\end_layout + +\begin_layout Description +CTAN: +\family typewriter +macros/latex/contrib/fragments/subscript.sty +\end_layout + +\begin_layout Description +Notes: The package +\family sans +subscript +\family default + is needed by LyX to output subscript text with some document classes. + In TeX distributions it is usually part of the +\family sans +fragments +\family default + package. +\end_layout + \begin_layout Subsection setspace \end_layout diff --git a/lib/images/inset-insert_script_script_subscript.png b/lib/images/inset-insert_script_script_subscript.png new file mode 100644 index 0000000000..d2a72a4369 Binary files /dev/null and b/lib/images/inset-insert_script_script_subscript.png differ diff --git a/lib/images/inset-insert_script_script_superscript.png b/lib/images/inset-insert_script_script_superscript.png new file mode 100644 index 0000000000..ceb63aea6f Binary files /dev/null and b/lib/images/inset-insert_script_script_superscript.png differ diff --git a/lib/layouts/memoir.layout b/lib/layouts/memoir.layout index a0b74656c0..9d9cf0aa06 100644 --- a/lib/layouts/memoir.layout +++ b/lib/layouts/memoir.layout @@ -15,6 +15,7 @@ DefaultStyle Standard PageStyle Headings Provides makeidx 1 Provides framed 1 +Provides subscript 1 # Memoir has support for line spacing, but uses different names from # what setspace.sty does. Provides SetSpace 1 diff --git a/lib/layouts/scrclass.inc b/lib/layouts/scrclass.inc index de0fd2d11a..a0c77e1ca3 100644 --- a/lib/layouts/scrclass.inc +++ b/lib/layouts/scrclass.inc @@ -11,6 +11,7 @@ Format 30 SecNumDepth 2 TocDepth 2 DefaultStyle Standard +Provides subscript 1 Style Standard LatexName dummy diff --git a/lib/layouts/scrlttr2.layout b/lib/layouts/scrlttr2.layout index c0e80faba7..c486b0927e 100644 --- a/lib/layouts/scrlttr2.layout +++ b/lib/layouts/scrlttr2.layout @@ -5,6 +5,8 @@ # Uwe Stöhr , 2008/2/03. Format 30 +Provides subscript 1 + Style Standard LatexName dummy ParSep 0.4 diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index 638f773d2d..2cd365110f 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -2293,6 +2293,50 @@ def revert_multirowOffset(document): begin_table = end_table +def revert_script(document): + " Convert subscript/superscript inset to TeX code " + i = 0 + foundsubscript = False + while 1: + i = find_token(document.body, '\\begin_inset script', i) + if i == -1: + break + z = find_end_of_inset(document.body, i) + if z == -1: + document.warning("Malformed LyX document: Can't find end of script inset.") + i += 1 + continue + blay = find_token(document.body, "\\begin_layout", i, z) + if blay == -1: + document.warning("Malformed LyX document: Can't find layout in script inset.") + i = z + continue + + if check_token(document.body[i], "\\begin_inset script subscript"): + subst = '\\textsubscript{' + foundsubscript = True + elif check_token(document.body[i], "\\begin_inset script superscript"): + subst = '\\textsuperscript{' + else: + document.warning("Malformed LyX document: Unknown type of script inset.") + i = z + continue + bend = find_end_of_layout(document.body, blay) + if bend == -1 or bend > z: + document.warning("Malformed LyX document: Can't find end of layout in script inset.") + i = z + continue + # remove the \end_layout \end_inset pair + document.body[bend:z + 1] = put_cmd_in_ert("}") + document.body[i:blay + 1] = put_cmd_in_ert(subst) + i += 1 + # these classes provide a \textsubscript command: + # FIXME: Would be nice if we could use the information of the .layout file here + classes = ["memoir", "scrartcl", "scrbook", "scrlttr2", "scrreprt"] + if foundsubscript and find_token_exact(classes, document.textclass, 0) == -1: + add_to_preamble(document, ['\\usepackage{subscript}']) + + ## # Conversion hub # @@ -2359,10 +2403,12 @@ convert = [[346, []], [404, [convert_prettyref]], [405, []], [406, [convert_passthru]], - [407, []] + [407, []], + [408, []] ] -revert = [[406, [revert_multirowOffset]], +revert = [[407, [revert_script]], + [406, [revert_multirowOffset]], [405, [revert_passthru]], [404, []], [403, [revert_refstyle]], diff --git a/lib/ui/stdmenus.inc b/lib/ui/stdmenus.inc index a7aa5c2401..38f25e59ed 100644 --- a/lib/ui/stdmenus.inc +++ b/lib/ui/stdmenus.inc @@ -385,8 +385,8 @@ Menuset End Menu "insert_formatting" - Item "Superscript|S" "command-sequence math-mode on; math-superscript; math-insert \text;" - Item "Subscript|u" "command-sequence math-mode on; math-subscript; math-insert \text;" + Item "Superscript|S" "inset-insert script script superscript" + Item "Subscript|u" "inset-insert script script subscript" Separator Item "Protected Space|P" "space-insert protected" Item "Interword Space|w" "space-insert normal" diff --git a/lib/unicodesymbols b/lib/unicodesymbols index 2eeab4107f..4e2357a96d 100644 --- a/lib/unicodesymbols +++ b/lib/unicodesymbols @@ -49,14 +49,14 @@ 0x00af "\\textasciimacron" "textcomp" "" # MACRON 0x00b0 "\\textdegree" "textcomp" "force" # DEGREE SIGN # the force flag is only needed due to a bug in teTeX 3 / TeXLive 2005 0x00b1 "\\textpm" "textcomp" "force" "\pm" # ± PLUS-MINUS SIGN -0x00b2 "\\texttwosuperior" "textcomp" "force" # ² SUPERSCRIPT TWO -0x00b3 "\\textthreesuperior" "textcomp" "force" # ³ SUPERSCRIPT THREE +0x00b2 "\\texttwosuperior" "textcomp" "force" "{{}^2}" "" # ² SUPERSCRIPT TWO +0x00b3 "\\textthreesuperior" "textcomp" "force" "{{}^3}" "" # ³ SUPERSCRIPT THREE 0x00b4 "\\textasciiacute" "textcomp" "" # ACUTE ACCENT 0x00b5 "\\textmu" "textcomp" "force" # µ MICRO SIGN 0x00b6 "\\textparagraph" "textcomp" "" # PILCROW SIGN # not equal to \textpilcrow 0x00b7 "\\textperiodcentered" "" "" "\cdot" # MIDDLE DOT 0x00b8 "\\c\\ " "" "" # CEDILLA (command from latin1.def) -0x00b9 "\\textonesuperior" "textcomp" "force" # ¹ SUPERSCRIPT ONE +0x00b9 "\\textonesuperior" "textcomp" "force" "{{}^1}" "" # ¹ SUPERSCRIPT ONE 0x00ba "\\textordmasculine" "textcomp" "" # MASCULINE ORDINAL INDICATOR 0x00bb "\\guillemotright" "" "" # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK 0x00bc "\\textonequarter" "textcomp" "" # 1/4 FRACTION @@ -958,7 +958,7 @@ 0x1d2d "\\textsuperscript{\\AE}" "" "" # MODIFIER LETTER CAPITAL AE 0x1d2e "\\textsuperscript{B}" "" "" # MODIFIER LETTER CAPITAL B #0x1d2f "" "" "" # MODIFIER LETTER CAPITAL BARRED B -0x1d30 "\\textsuperscript{B}" "" "" # MODIFIER LETTER CAPITAL D +0x1d30 "\\textsuperscript{D}" "" "" # MODIFIER LETTER CAPITAL D 0x1d31 "\\textsuperscript{E}" "" "" # MODIFIER LETTER CAPITAL E #0x1d32 "" "" "" # MODIFIER LETTER CAPITAL REVERSED E 0x1d33 "\\textsuperscript{G}" "" "" # MODIFIER LETTER CAPITAL G @@ -1008,15 +1008,15 @@ 0x1d5f "\\textsuperscript{\\textgreek{d}}" "textgreek""" # MODIFIER LETTER SMALL DELTA 0x1d60 "\\textsuperscript{\\textgreek{f}}" "textgreek""" # MODIFIER LETTER SMALL GREEK PHI 0x1d61 "\\textsuperscript{\\textgreek{q}}" "textgreek""" # MODIFIER LETTER SMALL CHI -#0x1d62 "" "" "" # LATIN SUBSCRIPT SMALL LETTER I -#0x1d63 "" "" "" # LATIN SUBSCRIPT SMALL LETTER R -#0x1d64 "" "" "" # LATIN SUBSCRIPT SMALL LETTER U -#0x1d65 "" "" "" # LATIN SUBSCRIPT SMALL LETTER V -#0x1d66 "" "" "" # GREEK SUBSCRIPT SMALL LETTER BETA -#0x1d67 "" "" "" # GREEK SUBSCRIPT SMALL LETTER GAMMA -#0x1d68 "" "" "" # GREEK SUBSCRIPT SMALL LETTER RHO -#0x1d69 "" "" "" # GREEK SUBSCRIPT SMALL LETTER PHI -#0x1d6a "" "" "" # GREEK SUBSCRIPT SMALL LETTER CHI +0x1d62 "\\textsubscript{i}" "subscript" "" "{{}_i}" "" # LATIN SUBSCRIPT SMALL LETTER I +0x1d63 "\\textsubscript{r}" "subscript" "" "{{}_r}" "" # LATIN SUBSCRIPT SMALL LETTER R +0x1d64 "\\textsubscript{u}" "subscript" "" "{{}_u}" "" # LATIN SUBSCRIPT SMALL LETTER U +0x1d65 "\\textsubscript{v}" "subscript" "" "{{}_v}" "" # LATIN SUBSCRIPT SMALL LETTER V +0x1d66 "\\textsubscript{\\textgreek{b}}" "subscript" "" "{{}_\\beta}" "" # GREEK SUBSCRIPT SMALL LETTER BETA +0x1d67 "\\textsubscript{\\textgreek{g}}" "subscript" "" "{{}_\\gamma}" "" # GREEK SUBSCRIPT SMALL LETTER GAMMA +0x1d68 "\\textsubscript{\\textgreek{r}}" "subscript" "" "{{}_\\rho}" "" # GREEK SUBSCRIPT SMALL LETTER RHO +0x1d69 "\\textsubscript{\\textgreek{f}}" "subscript" "" "{{}_\\phi}" "" # GREEK SUBSCRIPT SMALL LETTER PHI +0x1d6a "\\textsubscript{\\textgreek{q}}" "subscript" "" "{{}_\\chi}" "" # GREEK SUBSCRIPT SMALL LETTER CHI #0x1d6b "" "" "" # LATIN SMALL LETTER UE #0x1d6c "" "" "" # LATIN SMALL LETTER B WITH MIDDLE TILDE 0x1d6d "\\textsuperimposetilde{d}" "tipa" "force" # LATIN SMALL LETTER D WITH MIDDLE TILDE @@ -1575,6 +1575,42 @@ 0x2049 "!?" "" "" # EXCLAMATION QUESTION MARK 0x2052 "\\textdiscount" "textcomp" "" # COMMERCIAL MINUS SIGN 0x205d "\\vdots" "" "" # TRICOLON # ≈ VERTICAL ELLIPSIS +#0x205e "" "" "" "" "" # VERTICAL FOUR DOTS +0x205f "" "" "" "\\:" "" # MEDIUM MATHEMATICAL SPACE +0x2070 "\\textsuperscript{0}" "" "" "{{}^0}" "" # SUPERSCRIPT ZERO +0x2071 "\\textsuperscript{i}" "" "" "{{}^i}" "" # SUPERSCRIPT LATIN SMALL LETTER I +0x2074 "\\textsuperscript{4}" "" "" "{{}^4}" "" # SUPERSCRIPT FOUR +0x2075 "\\textsuperscript{5}" "" "" "{{}^5}" "" # SUPERSCRIPT FIVE +0x2076 "\\textsuperscript{6}" "" "" "{{}^6}" "" # SUPERSCRIPT SIX +0x2077 "\\textsuperscript{7}" "" "" "{{}^7}" "" # SUPERSCRIPT SEVEN +0x2078 "\\textsuperscript{8}" "" "" "{{}^8}" "" # SUPERSCRIPT EIGHT +0x2079 "\\textsuperscript{9}" "" "" "{{}^9}" "" # SUPERSCRIPT NINE +0x207a "\\textsuperscript{+}" "" "" "{{}^+}" "" # SUPERSCRIPT PLUS SIGN +0x207b "\\textsuperscript{-}" "" "" "{{}^-}" "" # SUPERSCRIPT MINUS +0x207c "\\textsuperscript{=}" "" "" "{{}^=}" "" # SUPERSCRIPT EQUALS SIGN +0x207d "\\textsuperscript{(}" "" "" "{{}^(}" "" # SUPERSCRIPT LEFT PARENTHESIS +0x207e "\\textsuperscript{)}" "" "" "{{}^)}" "" # SUPERSCRIPT RIGHT PARENTHESIS +0x207f "\\textsuperscript{n}" "" "" "{{}^n}" "" # SUPERSCRIPT LATIN SMALL LETTER N +0x2080 "\\textsubscript{0}" "subscript" "" "{{}_0}" "" # SUBSCRIPT ZERO +0x2081 "\\textsubscript{1}" "subscript" "" "{{}_1}" "" # SUBSCRIPT ONE +0x2082 "\\textsubscript{2}" "subscript" "" "{{}_2}" "" # SUBSCRIPT TWO +0x2083 "\\textsubscript{3}" "subscript" "" "{{}_3}" "" # SUBSCRIPT THREE +0x2084 "\\textsubscript{4}" "subscript" "" "{{}_4}" "" # SUBSCRIPT FOUR +0x2085 "\\textsubscript{5}" "subscript" "" "{{}_5}" "" # SUBSCRIPT FIVE +0x2086 "\\textsubscript{6}" "subscript" "" "{{}_6}" "" # SUBSCRIPT SIX +0x2087 "\\textsubscript{7}" "subscript" "" "{{}_7}" "" # SUBSCRIPT SEVEN +0x2088 "\\textsubscript{8}" "subscript" "" "{{}_8}" "" # SUBSCRIPT EIGHT +0x2089 "\\textsubscript{9}" "subscript" "" "{{}_9}" "" # SUBSCRIPT NINE +0x208a "\\textsubscript{+}" "subscript" "" "{{}_+}" "" # SUBSCRIPT PLUS SIGN +0x208b "\\textsubscript{-}" "subscript" "" "{{}_-}" "" # SUBSCRIPT MINUS +0x208c "\\textsubscript{=}" "subscript" "" "{{}_=}" "" # SUBSCRIPT EQUALS SIGN +0x208d "\\textsubscript{(}" "subscript" "" "{{}_(}" "" # SUBSCRIPT LEFT PARENTHESIS +0x208e "\\textsubscript{)}" "subscript" "" "{{}_)}" "" # SUBSCRIPT RIGHT PARENTHESIS +0x2090 "\\textsubscript{a}" "subscript" "" "{{}_a}" "" # LATIN SUBSCRIPT SMALL LETTER A +0x2091 "\\textsubscript{e}" "subscript" "" "{{}_e}" "" # LATIN SUBSCRIPT SMALL LETTER E +0x2092 "\\textsubscript{o}" "subscript" "" "{{}_o}" "" # LATIN SUBSCRIPT SMALL LETTER O +0x2093 "\\textsubscript{x}" "subscript" "" "{{}_x}" "" # LATIN SUBSCRIPT SMALL LETTER X +0x2094 "\\textsubscript{\\textschwa}" "subscript" "" "{{}_\\textschwa}" "tipa" # LATIN SUBSCRIPT SMALL LETTER SCHWA # # currency symbols # @@ -1620,7 +1656,7 @@ # Weierstrass elliptic function, actually this has the form of a # lowercase calligraphic p, despite its name (Maybe use Zapf chancery?) #0x2118 "" "" "" "\\mathscr{P}" "mathrsfs" # SCRIPT CAPITAL P -0x2119 "" "" "" "\\mathbb{P}" "amssymb"# DOUBLE-STUCK CAPITAL P +0x2119 "" "" "" "\\mathbb{P}" "amssymb" # DOUBLE-STUCK CAPITAL P 0x211a "" "" "" "\\mathbb{Q}" "amssymb" # DOUBLE-STUCK CAPITAL Q 0x211b "" "" "" "\\mathscr{R}" "mathrsfs" # SCRIPT CAPITAL R 0x211c "" "" "" "\\mathfrak{R}" "amssymb" # BLACK-LETTER CAPITAL R diff --git a/src/Buffer.cpp b/src/Buffer.cpp index b43c4db234..f628e030e7 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -128,7 +128,7 @@ namespace { // Do not remove the comment below, so we get merge conflict in // independent branches. Instead add your own. -int const LYX_FORMAT = 407; // uwestoehr: support for multirow offset +int const LYX_FORMAT = 408; // gb add script inset typedef map DepClean; typedef map > RefCache; diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp index 08917b5664..14faacca1f 100644 --- a/src/LaTeXFeatures.cpp +++ b/src/LaTeXFeatures.cpp @@ -537,6 +537,7 @@ char const * simplefeatures[] = { "framed", "soul", "textcomp", + "subscript", "pmboxdraw", "bbding", "ifsym", diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp index a1003838e6..35d2c1ab77 100644 --- a/src/LyXAction.cpp +++ b/src/LyXAction.cpp @@ -1594,7 +1594,7 @@ void LyXAction::init() { LFUN_MATH_SUBSCRIPT, "math-subscript", Noop, Math }, /*! * \var lyx::FuncCode lyx::LFUN_MATH_SUPERSCRIPT - * \li Action: Enters subscript expression in math expression. + * \li Action: Enters superscript expression in math expression. * \li Syntax: math-superscript * \li Origin: vermeer, 12 Dec 2001 * \endvar @@ -2297,7 +2297,7 @@ void LyXAction::init() * \li Action: Insert new inset (type given by the parameters). * \li Syntax: inset-insert * \li Params: : \n + hyperlink|include|index|label|line|nomencl|vspace|ref|toc|script>\n : depends on the given inset. Use "lyx -dbg action" to explore. * \li Sample: inset-insert ref LatexCommand reference "