bool is_latex_command(string const & name)
{
return
+ name == "cite" ||
name == "label" ||
name == "index" ||
name == "printindex";
}
+string curr_env()
+{
+ return active_environments.empty() ? string() : active_environments.top();
+}
+
+
void handle_ert(ostream & os, string const & s)
{
begin_inset(os, "ERT");
if (active_environments.empty())
return;
os << "\n\\layout ";
- string s = active_environments.top();
+ string s = curr_env();
if (s == "document") {
os << "Standard\n\n";
return;
os << wrap("macroarg", string(1, n.character()));
}
- else if (t.cat() == catActive)
- os << wrap("active", string(1, t.character()));
+ else if (t.cat() == catActive) {
+ if (t.character() == '~')
+ os << (curr_env() == "lyxcode" ? ' ' : '~');
+ else
+ os << t.asInput();
+ }
else if (t.cat() == catBegin) {
os << '{';
if (flags & FLAG_END) {
// eat environment name
string const name = p.getArg('{', '}');
- if (name != active_environments.top())
+ if (name != curr_env())
p.error("\\end{" + name + "} does not match \\begin{"
- + active_environments.top() + "}");
+ + curr_env() + "}");
active_environments.pop();
if (name == "document" || name == "abstract")
;