diff --git a/src/tex2lyx/TODO.txt b/src/tex2lyx/TODO.txt index e223501492..42a37085c1 100644 --- a/src/tex2lyx/TODO.txt +++ b/src/tex2lyx/TODO.txt @@ -51,9 +51,11 @@ Format LaTeX feature LyX feature 407 vertical offset for multirows InsetTabular 411 support for polyglossia \language_package (the cases of no package, of babel and of custom package is supported) 415 automatic undertilde loading \use_package undertilde -438 \tone{51}, \tone{15}, \tone{45}, InsetTIPA - \tone{12}, \tone{454}, \toptiebar, - \bottomtiebar +438 \tone{51} etc., InsetTIPA + \=*{a}, \*r and \*w, \!o + and \!b and \!d and \!g and \!G, + \textvertline, \t*{ }, + \textdoublevertline, \textglobfall 439 MinionPro.sty \font_roman, \font_osf 440 MinionPro.sty, \font_math 443 unicode-math.sty InsetMath* diff --git a/src/tex2lyx/test/test-insets.lyx.lyx b/src/tex2lyx/test/test-insets.lyx.lyx index af9c2de849..1013460bd7 100644 --- a/src/tex2lyx/test/test-insets.lyx.lyx +++ b/src/tex2lyx/test/test-insets.lyx.lyx @@ -5699,44 +5699,35 @@ TIPA \begin_inset IPA \begin_layout Standard -[@n Iɡ"zA:mpl] -\end_layout -\end_inset - - -\end_layout - -\begin_layout Standard - -\begin_inset IPA - -\begin_layout Standard -[@n Ig"zA -\color red -:m -\color inherit -pl] -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard - -\begin_inset IPA - -\begin_layout Standard -ls B!Y \begin_inset ERT status collapsed \begin_layout Plain Layout \backslash -textbottomtiebar +r{e} +\end_layout + +\end_inset + + e̬ e̤ e˷ e̼ e̪ e̺ e̻ e +\begin_inset script superscript + +\begin_layout Standard +h +\end_layout + +\end_inset + + e̹ e̜ e̟ +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +\backslash +={*} \end_layout \end_inset @@ -5751,68 +5742,399 @@ status collapsed \end_inset -ae -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout -} -\end_layout - -\end_inset - - -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - -\backslash -texttoptiebar -\end_layout - -\end_inset - - -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout -{ -\end_layout - -\end_inset - -ar -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout -} -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -l -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - -\backslash -u{ö} -\end_layout - -\end_inset - e \begin_inset ERT status collapsed +\begin_layout Plain Layout +} +\end_layout + +\end_inset + + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +\backslash +b{e} +\end_layout + +\end_inset + + ë e̽ +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +\backslash +s +\end_layout + +\end_inset + + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +{ +\end_layout + +\end_inset + +e +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +} +\end_layout + +\end_inset + + e̩ e̯ e˞e +\begin_inset script superscript + +\begin_layout Standard +w +\end_layout + +\end_inset + + e +\begin_inset script superscript + +\begin_layout Standard +j +\end_layout + +\end_inset + + e +\begin_inset script superscript + +\begin_layout Standard +ɣ +\end_layout + +\end_inset + + e +\begin_inset script superscript + +\begin_layout Standard +ʕ +\end_layout + +\end_inset + + e̴ e̝ e̞ e̘ e̙ ẽ e +\begin_inset script superscript + +\begin_layout Standard +n +\end_layout + +\end_inset + + e +\begin_inset script superscript + +\begin_layout Standard +l +\end_layout + +\end_inset + + e˺ +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +\backslash +H{e} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +è ē é eȅ ě ê e᷄ e᷅ e᷈ ĕ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard + +\begin_inset IPA + +\begin_layout Standard +pbtd t dcɟkɡq G +\end_layout + +\end_inset + + +\begin_inset IPA + +\begin_layout Standard +PmMn nɲN N Br RR +\end_layout + +\end_inset + + +\begin_inset IPA + +\begin_layout Standard + rFBfvTDszSZ s +\end_layout + +\end_inset + + +\begin_inset IPA + +\begin_layout Standard + zçJxGXKħQhHɬ +\end_layout + +\end_inset + + +\begin_inset IPA + +\begin_layout Standard +ɮV +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +\backslash +* +\end_layout + +\end_inset + +r Rhɰl lL L +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard + +\begin_inset IPA + +\begin_layout Standard + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +\backslash +! +\end_layout + +\end_inset + +o|!ǂ|| +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +\backslash +! +\end_layout + +\end_inset + +b +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +\backslash +! +\end_layout + +\end_inset + +d +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +\backslash +! +\end_layout + +\end_inset + +j +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +\backslash +! +\end_layout + +\end_inset + +g +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +\backslash +! +\end_layout + +\end_inset + +Ge' +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard + +\begin_inset IPA + +\begin_layout Standard +iy1ʉW +\color red +uIY +\color inherit +Ueø987o@Eœ3ɞ2Oæ5aɶA6 +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard + +\begin_inset IPA + +\begin_layout Standard + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +\backslash +* +\end_layout + +\end_inset + +ww4 HʢʡCʑɺɧ +\begin_inset IPADeco toptiebar +status open + +\begin_layout Standard +ar +\end_layout + +\end_inset + + +\begin_inset IPADeco bottomtiebar +status open + +\begin_layout Standard +tz +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard + +\begin_inset IPA + +\begin_layout Standard +:;eˈˌ +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +\backslash +textvertline +\end_layout + +\end_inset + + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +{} +\end_layout + +\end_inset + + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +\backslash +textdoublevertline +\end_layout + +\end_inset + + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +{} +\end_layout + +\end_inset + +. +\begin_inset ERT +status collapsed + \begin_layout Plain Layout \backslash @@ -5841,68 +6163,20 @@ status collapsed \end_inset -̥ -\begin_inset ERT -status collapsed -\begin_layout Plain Layout -{ -\end_layout - -\end_inset - -r -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout -} -\end_layout - -\end_inset - -̽ -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout -{ \end_layout \end_inset -\begin_inset script superscript +\end_layout \begin_layout Standard -j -\end_layout -\end_inset +\begin_inset IPA +\begin_layout Standard -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout -} -\end_layout - -\end_inset - - d˺ -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - -\backslash -H{k} -\end_layout - -\end_inset - - \begin_inset ERT status collapsed @@ -5934,7 +6208,295 @@ status collapsed \end_inset -e + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +\backslash +tone +\end_layout + +\end_inset + + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +{ +\end_layout + +\end_inset + +44 +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +} +\end_layout + +\end_inset + + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +\backslash +tone +\end_layout + +\end_inset + + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +{ +\end_layout + +\end_inset + +33 +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +} +\end_layout + +\end_inset + + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +\backslash +tone +\end_layout + +\end_inset + + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +{ +\end_layout + +\end_inset + +22 +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +} +\end_layout + +\end_inset + + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +\backslash +tone +\end_layout + +\end_inset + + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +{ +\end_layout + +\end_inset + +11 +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +} +\end_layout + +\end_inset + +ꜜꜛ +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +\backslash +tone +\end_layout + +\end_inset + + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +{ +\end_layout + +\end_inset + +15 +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +} +\end_layout + +\end_inset + + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +\backslash +tone +\end_layout + +\end_inset + + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +{ +\end_layout + +\end_inset + +51 +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +} +\end_layout + +\end_inset + + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +\backslash +tone +\end_layout + +\end_inset + + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +{ +\end_layout + +\end_inset + +45 +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +} +\end_layout + +\end_inset + + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +\backslash +tone +\end_layout + +\end_inset + + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +{ +\end_layout + +\end_inset + +12 +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +} +\end_layout + +\end_inset + + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +\backslash +tone +\end_layout + +\end_inset + + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +{ +\end_layout + +\end_inset + +454 +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +} +\end_layout + +\end_inset + +↗ \begin_inset ERT status collapsed @@ -5956,7 +6518,7 @@ status collapsed \end_inset - + \end_layout \end_inset diff --git a/src/tex2lyx/test/test-insets.tex b/src/tex2lyx/test/test-insets.tex index 187711c2bf..d84657273c 100644 --- a/src/tex2lyx/test/test-insets.tex +++ b/src/tex2lyx/test/test-insets.tex @@ -516,17 +516,70 @@ $test\vphantom{Wow\&\%}test$ \subsection{TIPA} -\textipa{[@n I\textscriptg "zA:mpl]} - -\textipa{[@n Ig"zA\textcolor{red}{:m}pl]} - \begin{IPA} -ls\;B!Y\textbottomtiebar{ae}\texttoptiebar{ar} +\r{e} +\textsubwedge{e} +\textsubumlaut{e} +\textsubtilde{e} +\textseagull{e} +\textsubbridge{e} +\textinvsubbridge{e} +\textsubsquare{e} +e\textsuperscript{h} +\textsubrhalfring{e} +\textsublhalfring{e} +\textsubplus{e} +\=*{e} +\b{e} +\"{e} +\textovercross{e} +\s{e} +\textsyllabic{e} +\textsubarch{e} +e\textrhoticity +e\textsuperscript{w} +e\textsuperscript{j} +e\textsuperscript{\textgamma} +e\textsuperscript{\textrevglotstop} +\textsuperimposetilde{e} +\textraising{e} +\textlowering{e} +\textadvancing{e} +\textretracting{e} +\~{e} +e\textsuperscript{n} +e\textsuperscript{l} +e\textcorner{} +\H{e} -l\u{}e\t*{ }\textsubring{r}\textovercross{\textsuperscript{j}} d\textcorner{} -\H{k} \tone{55}e\textglobfall{} +\`{e} +\={e} +\'{e} +\textdoublegrave{e} +\v{e} +\^{e} +\texthighrise{e} +\textlowrise{e} +\textrisefall{e} +\u{e} \end{IPA} +\textipa{pbtd\:t\:dc\textbardotlessj k\textscriptg q\;G} +\textipa{PmMn\:n\textltailn N\;N\;Br\;RR} +\textipa{\:rFBfvTDszSZ\:s} +\textipa{\:zJxGXK\textcrh QhH\textbeltl{}} +\textipa{\textlyoghlig V\*r\:Rh\textturnmrleg l\:lL\;L} + +\textipa{\!o|!\textdoublebarpipe ||\!b\!d\!j\!g\!Ge'} + +\textipa{iy1\textbaru W\textcolor{red}{uIY}Ue987o@E3\textcloserevepsilon 2O5a\textscoelig A6} + +\textipa{\*ww4\;H\textbarrevglotstop\textbarglotstop C\textctz\textturnlonglegr\texththeng \texttoptiebar{ar}\textbottomtiebar{tz}} + +\textipa{:;e\textprimstress\textsecstress \textvertline{}\textdoublevertline{}.\t*{ }} + +\textipa{\tone{55}\tone{44}\tone{33}\tone{22}\tone{11}\textdownstep\textupstep \tone{15}\tone{51}\tone{45}\tone{12}\tone{454}\textglobrise \textglobfall{}} + \subsection{Line breaks\sindex[breaks]{Line breaks}} diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp index 7bf2daed64..474fcb18e6 100644 --- a/src/tex2lyx/text.cpp +++ b/src/tex2lyx/text.cpp @@ -1417,7 +1417,6 @@ void parse_environment(Parser & p, ostream & os, bool outer, eat_whitespace(p, os, parent_context, false); parent_context.check_layout(os); begin_inset(os, "IPA\n"); - //os << "status open\n"; parse_text_in_inset(p, os, FLAG_END, outer, parent_context); end_inset(os); p.skip_spaces(); @@ -3229,6 +3228,52 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer, preamble.registerAutomaticallyLoadedPackage("tipx"); } + else if (t.cs() == "texttoptiebar" || t.cs() == "textbottomtiebar") { + context.check_layout(os); + begin_inset(os, "IPADeco " + t.cs().substr(4) + "\n"); + os << "status open\n"; + parse_text_in_inset(p, os, FLAG_ITEM, outer, context); + end_inset(os); + p.skip_spaces(); + } + + // the TIPA Combining diacritical marks + else if (t.cs() == "textsubwedge" || t.cs() == "textsubumlaut" + || t.cs() == "textsubtilde" || t.cs() == "textseagull" + || t.cs() == "textsubbridge" || t.cs() == "textinvsubbridge" + || t.cs() == "textsubsquare" || t.cs() == "textsubrhalfring" + || t.cs() == "textsublhalfring" || t.cs() == "textsubplus" + || t.cs() == "textovercross" || t.cs() == "textsubarch" + || t.cs() == "textsuperimposetilde" || t.cs() == "textraising" + || t.cs() == "textlowering" || t.cs() == "textadvancing" + || t.cs() == "textretracting" || t.cs() == "textdoublegrave" + || t.cs() == "texthighrise" || t.cs() == "textlowrise" + || t.cs() == "textrisefall" || t.cs() == "textsyllabic") { + context.check_layout(os); + // try to see whether the string is in unicodesymbols + bool termination; + docstring rem; + string content = trimSpaceAndEol(p.verbatim_item()); + string command = t.asInput() + "{" + + trimSpaceAndEol(content) + + "}"; + set req; + docstring s = encodings.fromLaTeXCommand(from_utf8(command), + Encodings::TEXT_CMD | Encodings::MATH_CMD, + termination, rem, &req); + if (!s.empty()) { + if (!rem.empty()) + cerr << "When parsing " << command + << ", result is " << to_utf8(s) + << "+" << to_utf8(rem) << endl; + os << content << to_utf8(s); + for (set::const_iterator it = req.begin(); it != req.end(); ++it) + preamble.registerAutomaticallyLoadedPackage(*it); + } else + // we did not find a non-ert version + output_ert_inset(os, command, context); + } + else if (t.cs() == "phantom" || t.cs() == "hphantom" || t.cs() == "vphantom") { context.check_layout(os);