mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-24 13:48:59 +00:00
Fix bug 2786: import of spaces
* src/tex2lyx/text.C (known_spaces): new, LaTeX names of known spaces (known_coded_spaces): new, LyX names of known spaces (parse_text): Recognize all known spaces git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14832 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c70f77354a
commit
d6a42972ea
@ -198,6 +198,15 @@ char const * const known_pdftex_graphics_formats[] = {"png", "pdf", "jpg",
|
|||||||
*/
|
*/
|
||||||
char const * const known_tex_extensions[] = {"tex", 0};
|
char const * const known_tex_extensions[] = {"tex", 0};
|
||||||
|
|
||||||
|
/// spaces known by InsetSpace
|
||||||
|
char const * const known_spaces[] = { " ", "space", ",", "thinspace", "quad",
|
||||||
|
"qquad", "enspace", "enskip", "negthinspace", 0};
|
||||||
|
|
||||||
|
/// the same as known_spaces with .lyx names
|
||||||
|
char const * const known_coded_spaces[] = { "space{}", "space{}",
|
||||||
|
"thinspace{}", "thinspace{}", "quad{}", "qquad{}", "enspace{}", "enskip{}",
|
||||||
|
"negthinspace{}", 0};
|
||||||
|
|
||||||
|
|
||||||
/// splits "x=z, y=b" into a map
|
/// splits "x=z, y=b" into a map
|
||||||
map<string, string> split_map(string const & s)
|
map<string, string> split_map(string const & s)
|
||||||
@ -2184,6 +2193,25 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
skip_braces(p);
|
skip_braces(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (is_known(t.cs(), known_spaces)) {
|
||||||
|
char const * const * where = is_known(t.cs(), known_spaces);
|
||||||
|
context.check_layout(os);
|
||||||
|
begin_inset(os, "InsetSpace ");
|
||||||
|
os << '\\' << known_coded_spaces[where - known_spaces]
|
||||||
|
<< '\n';
|
||||||
|
// LaTeX swallows whitespace after all spaces except
|
||||||
|
// "\\,". We have to do that here, too, because LyX
|
||||||
|
// adds "{}" which would make the spaces significant.
|
||||||
|
if (t.cs() != ",")
|
||||||
|
eat_whitespace(p, os, context, false);
|
||||||
|
// LyX adds "{}" after all spaces except "\\ " and
|
||||||
|
// "\\,", so we have to remove "{}".
|
||||||
|
// "\\,{}" is equivalent to "\\," in LaTeX, so we
|
||||||
|
// remove the braces after "\\,", too.
|
||||||
|
if (t.cs() != " ")
|
||||||
|
skip_braces(p);
|
||||||
|
}
|
||||||
|
|
||||||
else if (t.cs() == "newpage") {
|
else if (t.cs() == "newpage") {
|
||||||
context.check_layout(os);
|
context.check_layout(os);
|
||||||
// FIXME: what about \\clearpage and \\pagebreak?
|
// FIXME: what about \\clearpage and \\pagebreak?
|
||||||
|
Loading…
Reference in New Issue
Block a user