tex2lyx: support further TIPA characters

- support for \textdoublevertline, \textvertline, \textglobfall
- support \!o and \!b and \!d and \!g and \!G and \!j
- support  and \*k and \*r and \*t and \*w
- register the package "tipa" if \textipa is detected in an equation
- add a \textipa equation to the testfile

(I failed to implement support for the TIPA character "\t*{ }" and the command "\=*".)
This commit is contained in:
Uwe Stöhr 2013-02-19 00:07:24 +01:00
parent 4367d81b01
commit 6deb2b7680
5 changed files with 90 additions and 167 deletions

View File

@ -51,10 +51,7 @@ 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 \=*{a}, \*r and \*w, \!o InsetTIPA
and \!b and \!d and \!g and \!G,
\textvertline, \t*{ },
\textdoublevertline, \textglobfall
438 \t*{ } and \=*{a} InsetTIPA
439 MinionPro.sty \font_roman, \font_osf
440 MinionPro.sty, \font_math
443 unicode-math.sty InsetMath*

View File

@ -237,6 +237,11 @@ void parse_math(Parser & p, ostream & os, unsigned flags, const mode_type mode)
preamble.registerAutomaticallyLoadedPackage("varioref");
}
else if (t.cs() == "textipa") {
os << t.asInput();
preamble.registerAutomaticallyLoadedPackage("tipa");
}
else
os << t.asInput();

View File

@ -5915,19 +5915,7 @@ PmMnnɲNNBrRR
\begin_inset IPA
\begin_layout Standard
ɮV
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
\backslash
*
\end_layout
\end_inset
rRhɰllLL
ɮVɹRhɰllLL
\end_layout
\end_inset
@ -5940,79 +5928,7 @@ rRhɰllLL
\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'
ʘ|!ǂ||ɓɗʄɠʛe'
\end_layout
\end_inset
@ -6042,19 +5958,7 @@ Ueø987o@Eœ3ɞ2Oæ5aɶA6
\begin_inset IPA
\begin_layout Standard
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
\backslash
*
\end_layout
\end_inset
ww4HʢʡCʑɺɧ
ʍw4HʢʡCʑɺɧ
\begin_inset IPADeco toptiebar
status open
@ -6087,51 +5991,7 @@ tz
\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
.
:;eˈˌ|‖.
\begin_inset ERT
status collapsed
@ -6181,24 +6041,7 @@ status collapsed
\IPAChar \tone{45}
\IPAChar \tone{12}
\IPAChar \tone{454}
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
\backslash
textglobfall
\end_layout
\end_inset
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
{}
↗↘
\end_layout
\end_inset
@ -6206,6 +6049,9 @@ status collapsed
\end_layout
\begin_layout Standard
TIPA code in math:
\begin_inset Formula $\textipa{\tone{55}|\text{\!b{}\!d{}\!g{}\!G{}\textglobfall{}\textvertline{}\textdoublevertline{}}}$
\end_inset

View File

@ -584,6 +584,8 @@ e\textcorner{}
\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{}}
TIPA code in math:
$\textipa{\tone{55}|\text{\!b{}\!d{}\!g{}\!G{}\textglobfall{}\textvertline{}\textdoublevertline{}}}$
\subsection{Line breaks\sindex[breaks]{Line breaks}}

View File

@ -3305,6 +3305,14 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
output_ert_inset(os, command, context);
}
else if (t.cs() == "textvertline" ) {
// this TIPA character does not occur in
// unicodesymbols because it is in the ASCII range
context.check_layout(os);
os << "|";
skip_braces(p);
}
else if (t.cs() == "phantom" || t.cs() == "hphantom" ||
t.cs() == "vphantom") {
context.check_layout(os);
@ -4586,7 +4594,72 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
bool termination;
docstring rem;
set<string> req;
docstring s = encodings.fromLaTeXCommand(from_utf8(t.asInput()),
string name = t.asInput();
// handle some TIPA special characters
if (name == "\\textglobfall") {
name = "End";
skip_braces(p);
}
if (name == "\\textdoublevertline") {
name = "\\textbardbl";
skip_braces(p);
}
if (name == "\\!" ) {
if (p.next_token().asInput() == "b") {
p.get_token(); // eat 'b'
name = "\\texthtb";
skip_braces(p);
}
if (p.next_token().asInput() == "d") {
p.get_token();
name = "\\texthtd";
skip_braces(p);
}
if (p.next_token().asInput() == "g") {
p.get_token();
name = "\\texthtg";
skip_braces(p);
}
if (p.next_token().asInput() == "G") {
p.get_token();
name = "\\texthtscg";
skip_braces(p);
}
if (p.next_token().asInput() == "j") {
p.get_token();
name = "\\texthtbardotlessj";
skip_braces(p);
}
if (p.next_token().asInput() == "o") {
p.get_token();
name = "\\textbullseye";
skip_braces(p);
}
}
if (name == "\\*" ) {
if (p.next_token().asInput() == "k") {
p.get_token();
name = "\\textturnk";
skip_braces(p);
}
if (p.next_token().asInput() == "r") {
p.get_token(); // eat 'b'
name = "\\textturnr";
skip_braces(p);
}
if (p.next_token().asInput() == "t") {
p.get_token();
name = "\\textturnt";
skip_braces(p);
}
if (p.next_token().asInput() == "w") {
p.get_token();
name = "\\textturnw";
skip_braces(p);
}
}
// now get the character from unicodesymbols
docstring s = encodings.fromLaTeXCommand(from_utf8(name),
Encodings::TEXT_CMD, termination, rem, &req);
if (!s.empty()) {
if (!rem.empty())