mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-14 06:57:01 +00:00
Increase tex2lyx output format to 320.
320: Support protected hfill Detect other horizontal spaces that are already part of format 319 Add forgotton use_parbox tag to boxes (confuses lyx2lyx, but no lyx) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36949 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
58fde18a9f
commit
300cd0dedd
@ -284,6 +284,7 @@ raggedleft 2 raggedleft 2 raggedleft 2 raggedleft 2 raggedleft 2
|
|||||||
\subsection{Horizontal spaces}
|
\subsection{Horizontal spaces}
|
||||||
|
|
||||||
Lines can have an hfill \hfill in the middle.
|
Lines can have an hfill \hfill in the middle.
|
||||||
|
Lines can have an hfill \hspace{\fill} in the middle.
|
||||||
Lines can have a protected hfill \hspace*{\fill} in the middle.
|
Lines can have a protected hfill \hspace*{\fill} in the middle.
|
||||||
Lines can have a dotted fill \dotfill in the middle.
|
Lines can have a dotted fill \dotfill in the middle.
|
||||||
Lines can have a rule fill \hrulefill in the middle.
|
Lines can have a rule fill \hrulefill in the middle.
|
||||||
@ -320,7 +321,8 @@ qquad\qquad{}a
|
|||||||
|
|
||||||
\subsection{Vertical spaces}
|
\subsection{Vertical spaces}
|
||||||
|
|
||||||
Lines can have an vfill \vfill in the middle.
|
Lines can have a vfill \vfill in the middle.
|
||||||
|
Lines can have a vfill \vspace{\fill} in the middle.
|
||||||
Lines can have a protected vfill \vspace*{\fill} in the middle.
|
Lines can have a protected vfill \vspace*{\fill} in the middle.
|
||||||
Lines can have vertical space \vspace{2cm} in the middle.
|
Lines can have vertical space \vspace{2cm} in the middle.
|
||||||
Lines can have protected vertical space \vspace*{2cm} in the middle.
|
Lines can have protected vertical space \vspace*{2cm} in the middle.
|
||||||
|
@ -114,7 +114,7 @@ extern CommandMap known_math_environments;
|
|||||||
///
|
///
|
||||||
extern bool noweb_mode;
|
extern bool noweb_mode;
|
||||||
/// LyX format that is created by tex2lyx
|
/// LyX format that is created by tex2lyx
|
||||||
int const LYX_FORMAT = 319;
|
int const LYX_FORMAT = 320;
|
||||||
|
|
||||||
/// path of the master .tex file
|
/// path of the master .tex file
|
||||||
extern std::string getMasterFilePath();
|
extern std::string getMasterFilePath();
|
||||||
|
@ -831,6 +831,7 @@ void parse_environment(Parser & p, ostream & os, bool outer,
|
|||||||
"hor_pos \"c\"\n"
|
"hor_pos \"c\"\n"
|
||||||
"has_inner_box 0\n"
|
"has_inner_box 0\n"
|
||||||
"inner_pos \"t\"\n"
|
"inner_pos \"t\"\n"
|
||||||
|
"use_parbox 0\n"
|
||||||
"width \"100col%\"\n"
|
"width \"100col%\"\n"
|
||||||
"special \"none\"\n"
|
"special \"none\"\n"
|
||||||
"height \"1in\"\n"
|
"height \"1in\"\n"
|
||||||
@ -2729,16 +2730,18 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (t.cs() == "vspace") {
|
else if (t.cs() == "hspace" || t.cs() == "vspace") {
|
||||||
bool starred = false;
|
bool starred = false;
|
||||||
if (p.next_token().asInput() == "*") {
|
if (p.next_token().asInput() == "*") {
|
||||||
p.get_token();
|
p.get_token();
|
||||||
starred = true;
|
starred = true;
|
||||||
}
|
}
|
||||||
|
string name = t.asInput();
|
||||||
string const length = p.verbatim_item();
|
string const length = p.verbatim_item();
|
||||||
string unit;
|
string unit;
|
||||||
string valstring;
|
string valstring;
|
||||||
bool valid = splitLatexLength(length, valstring, unit);
|
bool valid = splitLatexLength(length, valstring, unit);
|
||||||
|
bool known_hspace = false;
|
||||||
bool known_vspace = false;
|
bool known_vspace = false;
|
||||||
bool known_unit = false;
|
bool known_unit = false;
|
||||||
double value;
|
double value;
|
||||||
@ -2746,21 +2749,31 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
istringstream iss(valstring);
|
istringstream iss(valstring);
|
||||||
iss >> value;
|
iss >> value;
|
||||||
if (value == 1.0) {
|
if (value == 1.0) {
|
||||||
if (unit == "\\smallskipamount") {
|
if (t.cs()[0] == 'h') {
|
||||||
unit = "smallskip";
|
if (unit == "\\fill") {
|
||||||
known_vspace = true;
|
if (!starred) {
|
||||||
} else if (unit == "\\medskipamount") {
|
unit = "";
|
||||||
unit = "medskip";
|
name = "hfill";
|
||||||
known_vspace = true;
|
}
|
||||||
} else if (unit == "\\bigskipamount") {
|
known_hspace = true;
|
||||||
unit = "bigskip";
|
}
|
||||||
known_vspace = true;
|
} else {
|
||||||
} else if (unit == "\\fill") {
|
if (unit == "\\smallskipamount") {
|
||||||
unit = "vfill";
|
unit = "smallskip";
|
||||||
known_vspace = true;
|
known_vspace = true;
|
||||||
|
} else if (unit == "\\medskipamount") {
|
||||||
|
unit = "medskip";
|
||||||
|
known_vspace = true;
|
||||||
|
} else if (unit == "\\bigskipamount") {
|
||||||
|
unit = "bigskip";
|
||||||
|
known_vspace = true;
|
||||||
|
} else if (unit == "\\fill") {
|
||||||
|
unit = "vfill";
|
||||||
|
known_vspace = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!known_vspace) {
|
if (!known_hspace && !known_vspace) {
|
||||||
switch (unitFromString(unit)) {
|
switch (unitFromString(unit)) {
|
||||||
case Length::SP:
|
case Length::SP:
|
||||||
case Length::PT:
|
case Length::PT:
|
||||||
@ -2782,8 +2795,23 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (known_unit || known_vspace) {
|
if (t.cs()[0] == 'h' && (known_unit || known_hspace)) {
|
||||||
// Literal length or known variable
|
// Literal horizontal length or known variable
|
||||||
|
context.check_layout(os);
|
||||||
|
begin_inset(os, "Space \\");
|
||||||
|
os << name;
|
||||||
|
if (starred)
|
||||||
|
os << '*';
|
||||||
|
os << '{';
|
||||||
|
if (known_hspace)
|
||||||
|
os << unit;
|
||||||
|
os << "}\n";
|
||||||
|
if (known_unit && !known_hspace)
|
||||||
|
os << "\\length "
|
||||||
|
<< translate_len(length) << '\n';
|
||||||
|
end_inset(os);
|
||||||
|
} else if (known_unit || known_vspace) {
|
||||||
|
// Literal vertical length or known variable
|
||||||
context.check_layout(os);
|
context.check_layout(os);
|
||||||
begin_inset(os, "VSpace ");
|
begin_inset(os, "VSpace ");
|
||||||
if (known_unit)
|
if (known_unit)
|
||||||
@ -2793,8 +2821,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
os << '*';
|
os << '*';
|
||||||
end_inset(os);
|
end_inset(os);
|
||||||
} else {
|
} else {
|
||||||
// LyX can't handle other length variables in Inset VSpace
|
// LyX can't handle other length variables in Inset V?Space
|
||||||
string name = t.asInput();
|
|
||||||
if (starred)
|
if (starred)
|
||||||
name += '*';
|
name += '*';
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
Loading…
Reference in New Issue
Block a user