mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
tex2lyx/text.cpp: support for the commands \fboxsep etc.
It is impossible handle all cases because the closing brace of an \fboxsep block can be everywhere. Therefore the braces remain in ERT.
This commit is contained in:
parent
52a158b6d7
commit
5449a5b837
@ -157,6 +157,18 @@ blabla \doublebox{doublebox} blabla
|
|||||||
|
|
||||||
$\boxed{\int A=B}$
|
$\boxed{\int A=B}$
|
||||||
|
|
||||||
|
\subsection{Boxes with custom settings}
|
||||||
|
|
||||||
|
\fboxsep 35pt
|
||||||
|
|
||||||
|
\framebox[1cm]{www}
|
||||||
|
|
||||||
|
\fboxsep 20pt \framebox[1cm]{www}
|
||||||
|
|
||||||
|
{\fboxsep 1pt \fboxrule 10pt \framebox[1cm]{www}}
|
||||||
|
|
||||||
|
{\fboxsep 35pt\shadowsize 15pt\shadowbox{\centering www}}
|
||||||
|
|
||||||
\subsection{Color Boxes}
|
\subsection{Color Boxes}
|
||||||
|
|
||||||
\colorbox{blue}{www}
|
\colorbox{blue}{www}
|
||||||
|
@ -124,6 +124,9 @@ string parse_text_snippet(Parser & p, unsigned flags, const bool outer,
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string fboxrule = "";
|
||||||
|
string fboxsep = "";
|
||||||
|
string shadow_size = "";
|
||||||
|
|
||||||
char const * const known_ref_commands[] = { "ref", "pageref", "vref",
|
char const * const known_ref_commands[] = { "ref", "pageref", "vref",
|
||||||
"vpageref", "prettyref", "nameref", "eqref", 0 };
|
"vpageref", "prettyref", "nameref", "eqref", 0 };
|
||||||
@ -849,8 +852,20 @@ void parse_box(Parser & p, ostream & os, unsigned outer_flags,
|
|||||||
string latex_width;
|
string latex_width;
|
||||||
string width_special = "none";
|
string width_special = "none";
|
||||||
string thickness = "0.4pt";
|
string thickness = "0.4pt";
|
||||||
string separation = "3pt";
|
if (fboxrule != "")
|
||||||
string shadowsize = "4pt";
|
thickness = fboxrule;
|
||||||
|
else
|
||||||
|
thickness = "0.4pt";
|
||||||
|
string separation;
|
||||||
|
if (fboxsep != "")
|
||||||
|
separation = fboxsep;
|
||||||
|
else
|
||||||
|
separation = "3pt";
|
||||||
|
string shadowsize;
|
||||||
|
if (shadow_size != "")
|
||||||
|
shadowsize = shadow_size;
|
||||||
|
else
|
||||||
|
shadowsize = "4pt";
|
||||||
string framecolor = "black";
|
string framecolor = "black";
|
||||||
string backgroundcolor = "none";
|
string backgroundcolor = "none";
|
||||||
if (frame_color != "")
|
if (frame_color != "")
|
||||||
@ -1190,6 +1205,17 @@ void parse_box(Parser & p, ostream & os, unsigned outer_flags,
|
|||||||
// in this case we have to eat the the closing brace of the color box
|
// in this case we have to eat the the closing brace of the color box
|
||||||
p.get_token().asInput(); // the '}'
|
p.get_token().asInput(); // the '}'
|
||||||
}
|
}
|
||||||
|
if (p.next_token().asInput() == "}"
|
||||||
|
&& (fboxrule != "" || fboxsep != "" || shadow_size != "")) {
|
||||||
|
// in this case we assume that the closing brace is from the box settings
|
||||||
|
// therefore reset these values for the next box
|
||||||
|
if (fboxrule != "")
|
||||||
|
fboxrule = "";
|
||||||
|
if (fboxsep != "")
|
||||||
|
fboxsep = "";
|
||||||
|
if (shadow_size != "")
|
||||||
|
shadow_size = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4206,6 +4232,27 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
parse_box(p, os, 0, 0, outer, context, "", "", "", "", backgroundcolor);
|
parse_box(p, os, 0, 0, outer, context, "", "", "", "", backgroundcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (t.cs() == "fboxrule" || t.cs() == "fboxsep"
|
||||||
|
|| t.cs() == "shadowsize") {
|
||||||
|
p.skip_spaces(true);
|
||||||
|
if (t.cs() == "fboxrule")
|
||||||
|
fboxrule = "";
|
||||||
|
if (t.cs() == "fboxsep")
|
||||||
|
fboxsep = "";
|
||||||
|
if (t.cs() == "shadowsize")
|
||||||
|
shadow_size = "";
|
||||||
|
while (p.good() && p.next_token().cat() != catSpace
|
||||||
|
&& p.next_token().cat() != catNewline
|
||||||
|
&& p.next_token().cat() != catEscape) {
|
||||||
|
if (t.cs() == "fboxrule")
|
||||||
|
fboxrule = fboxrule + p.get_token().asInput();
|
||||||
|
if (t.cs() == "fboxsep")
|
||||||
|
fboxsep = fboxsep + p.get_token().asInput();
|
||||||
|
if (t.cs() == "shadowsize")
|
||||||
|
shadow_size = shadow_size + p.get_token().asInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//\framebox() is part of the picture environment and different from \framebox{}
|
//\framebox() is part of the picture environment and different from \framebox{}
|
||||||
//\framebox{} will be parsed by parse_outer_box
|
//\framebox{} will be parsed by parse_outer_box
|
||||||
else if (t.cs() == "framebox") {
|
else if (t.cs() == "framebox") {
|
||||||
|
Loading…
Reference in New Issue
Block a user