os << " ";
}
break;
+ case LATEX_ENVIRONMENT:
+ if (runparams.for_search) {
+ os << "\\latexenvironment{" << style.latexname() << "}{";
+ }
+ break;
case LATEX_BIB_ENVIRONMENT:
// ignore this, the inset will write itself
break;
if (style.pass_thru) {
Font const outerfont = text.outerFont(pit);
parStartCommand(par, os, runparams, style);
+ if (style.isCommand() && style.needprotect)
+ // Due to the moving argument, some fragile
+ // commands (labels, index entries)
+ // are output after this command (#2154)
+ runparams.postpone_fragile_stuff = true;
if (intitle_command)
os << '{';
// (see #10849); thus open the command here.
if (intitle_command) {
parStartCommand(par, os, runparams, style);
+ if (style.isCommand() && style.needprotect)
+ // Due to the moving argument, some fragile
+ // commands (labels, index entries)
+ // are output after this command (#2154)
+ runparams.postpone_fragile_stuff = true;
os << '{';
}
}
runparams.moving_arg |= style.needprotect;
+ if (style.needmboxprotect)
+ ++runparams.inulemcmd;
Encoding const * const prev_encoding = runparams.encoding;
bool const useSetSpace = bparams.documentClass().provides("SetSpace");
// For InTitle commands, we already started the command before
// the language switch
- if (!intitle_command)
+ if (!intitle_command) {
parStartCommand(par, os, runparams, style);
+ if (style.isCommand() && style.needprotect)
+ // Due to the moving argument, some fragile
+ // commands (labels, index entries)
+ // are output after this command (#2154)
+ runparams.postpone_fragile_stuff = true;
+ }
Font const outerfont = text.outerFont(pit);
os << '}';
if (!style.postcommandargs().empty())
latexArgInsets(par, os, runparams, style.postcommandargs(), "post:");
+ if (!runparams.post_macro.empty()) {
+ // Output the stored fragile commands (labels, indices etc.)
+ // that need to be output after the command with moving argument.
+ os << runparams.post_macro;
+ runparams.post_macro.clear();
+ }
if (runparams.encoding != prev_encoding) {
runparams.encoding = prev_encoding;
os << setEncoding(prev_encoding->iconvName());
os << '}';
if (!style.postcommandargs().empty())
latexArgInsets(par, os, runparams, style.postcommandargs(), "post:");
+ if (!runparams.post_macro.empty()) {
+ // Output the stored fragile commands (labels, indices etc.)
+ // that need to be output after the command with moving argument.
+ os << runparams.post_macro;
+ runparams.post_macro.clear();
+ }
if (runparams.encoding != prev_encoding) {
runparams.encoding = prev_encoding;
os << setEncoding(prev_encoding->iconvName());
else
runparams_in.encoding = runparams.encoding;
+ // Also pass the post_macros upstream
+ runparams_in.post_macro = runparams.post_macro;
+
// we don't need a newline for the last paragraph!!!
// Note from JMarc: we will re-add a \n explicitly in
if (maintext && !is_child && !bparams.useNonTeXFonts
&& (bparams.encoding().package() == Encoding::CJK
|| (bparams.encoding().name() == "utf8"
- && bparams.language->encoding()->package() == Encoding::CJK)
- // FIXME: should test if any language requires CJK
- // && LaTeXFeatures::mustProvide("CJK"))
- // error: cannot call member function ‘bool lyx::LaTeXFeatures::mustProvide(const string&) const’ without object
- )) {
+ && runparams.use_CJK))
+ ) {
docstring const cjkenc = bparams.encoding().iconvName() == "UTF-8"
? from_ascii("UTF8") : from_ascii(bparams.encoding().latexName());
os << "\\begin{CJK}{" << cjkenc
Encoding const & oldEnc = *runparams.encoding;
bool moving_arg = runparams.moving_arg;
- // If we switch from/to CJK, we need to switch anyway, despite custom inputenc,
- // except if we use CJKutf8 or explicitely set inputenc to a CJK encoding
- bool const from_to_cjk =
- ((oldEnc.package() == Encoding::CJK && newEnc.package() != Encoding::CJK)
- || (oldEnc.package() != Encoding::CJK && newEnc.package() == Encoding::CJK))
- && bparams.encoding().iconvName() != "UTF8"
- && bparams.encoding().package() != Encoding::CJK;
- if (!force && !from_to_cjk
+ if (!force
&& ((bparams.inputenc != "auto" && bparams.inputenc != "default") || moving_arg))
return make_pair(false, 0);
os << "\\egroup";
count += 7;
}
- docstring const cjkenc = (bparams.encoding().iconvName() == "UTF-8"
- ? from_ascii("UTF8") : from_ascii(newEnc.latexName()));
- os << "\\begin{CJK}{" << cjkenc << "}{"
+ os << "\\begin{CJK}{"
+ << from_ascii(newEnc.latexName()) << "}{"
<< from_ascii(bparams.fonts_cjk) << "}";
state->open_encoding_ = CJK;
return make_pair(true, count + 15);