Do not use math commands from unicodesymbols in tex2lyx text mode,

since they are usually invalid in text mode (partial fix of bug 6797).
Also, prepare proper translation of \\slash{} and \nobreakdash.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36840 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2010-12-12 13:23:05 +00:00
parent a4a7502769
commit 1b04aa7301
2 changed files with 17 additions and 2 deletions

View File

@ -147,7 +147,8 @@ or by a defined page break \pagebreak[4]
\section{Special characters\index{Special characters}}
Then one has those macros with a long name for a short meaning, like
\textasciitilde, \textasciicircum{} or \textbackslash{}, and the characters
\textasciitilde, \textasciicircum{} or \textbackslash{}, \slash{},
\nobreakdash and the characters
that LaTeX wants to espace because they are active, like \_\&\#\$\{\}\%.
And what about special characters like hyphe\-nation mark,

View File

@ -2330,6 +2330,17 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
skip_braces(p);
}
else if (LYX_FORMAT >= 307 && t.cs() == "slash") {
context.check_layout(os);
os << "\\SpecialChar \\slash{}\n";
skip_braces(p);
}
else if (LYX_FORMAT >= 307 && t.cs() == "nobreakdash") {
context.check_layout(os);
os << "\\SpecialChar \\nobreakdash\n";
}
else if (t.cs() == "textquotedbl") {
context.check_layout(os);
os << "\"";
@ -2695,8 +2706,11 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
else {
// try to see whether the string is in unicodesymbols
// Only use text mode commands, since we are in text mode here,
// and math commands may be invalid (bug 6797)
docstring rem;
docstring s = encodings.fromLaTeXCommand(from_utf8(t.asInput()), rem);
docstring s = encodings.fromLaTeXCommand(from_utf8(t.asInput()),
rem, Encodings::TEXT_CMD);
if (!s.empty()) {
if (!rem.empty())
cerr << "When parsing " << t.cs()