- // This implements the standard way of handling the LaTeX output of
- // a collapsable inset, either a command or an environment. Standard
- // collapsable insets should not redefine this, non-standard ones may
- // call this.
- if (!getLayout().latexname().empty()) {
- if (getLayout().latextype() == InsetLayout::COMMAND) {
- // FIXME UNICODE
- if (runparams.moving_arg)
- os << "\\protect";
- os << '\\' << from_utf8(getLayout().latexname());
- if (!getLayout().latexparam().empty())
- os << from_utf8(getLayout().latexparam());
- os << '{';
- } else if (getLayout().latextype() == InsetLayout::ENVIRONMENT) {
- os << "%\n\\begin{" << from_utf8(getLayout().latexname()) << "}\n";
- if (!getLayout().latexparam().empty())
- os << from_utf8(getLayout().latexparam());
- }
- }
- OutputParams rp = runparams;
- if (getLayout().isPassThru())
- rp.verbatim = true;
- if (getLayout().isNeedProtect())
- rp.moving_arg = true;
- int i = InsetText::latex(os, rp);
- if (!getLayout().latexname().empty()) {
- if (getLayout().latextype() == InsetLayout::COMMAND) {
- os << "}";
- } else if (getLayout().latextype() == InsetLayout::ENVIRONMENT) {
- os << "\n\\end{" << from_utf8(getLayout().latexname()) << "}\n";
- i += 4;
- }
- }
- return i;