ExampleBlock,AlertBlock,Bibliography,Quotation,Quote,Verse,Corollary,Definition,Definitions,
Example,Examples,Fact,Lemma,Proof,Theorem,LyX-Code
EndAutoNests
+ NeedCProtect -1
End
Style PlainFrame
inpreamble = false;
needprotect = false;
needcprotect = false;
+ nocprotect = false;
needmboxprotect = false;
keepempty = false;
font = inherit_font;
lex >> needprotect;
break;
- case LT_NEED_CPROTECT:
- lex >> needcprotect;
+ case LT_NEED_CPROTECT: {
+ int i;
+ lex >> i;
+ nocprotect = false;
+ needcprotect = false;
+ if (i == -1)
+ nocprotect = true;
+ else if (i == 1)
+ needcprotect = true;
break;
+ }
case LT_NEED_MBOXPROTECT:
lex >> needmboxprotect;
/** true when the verbatim stuff of this layout needs to be
\cprotect'ed. */
bool needcprotect;
+ /** true when the verbatim stuff of this layout never should be
+ \cprotect'ed. */
+ bool nocprotect;
/** true when specific commands in this paragraph need to be
protected in an \mbox. */
bool needmboxprotect;
*/
bool moving_arg = false;
+ /** no_cprotect == true means that the layout in which this is
+ * does not allow \cprotect'ing.
+ */
+ bool no_cprotect = false;
+
/** intitle == true means that the environment in which the
inset is typeset is part of a title (before a \\maketitle).
Footnotes in such environments have moving arguments.
? textinset->hasCProtectContent(runparams.moving_arg)
&& !textinset->text().isMainText()
&& inset->lyxCode() != BRANCH_CODE
+ && !runparams.no_cprotect
: false;
unsigned int count2 = basefont.latexWriteStartChanges(os, bparams,
rp, running_font,
? textinset->hasCProtectContent(runparams.moving_arg)
&& !textinset->text().isMainText()
&& inInset().lyxCode() != BRANCH_CODE
+ && !runparams.no_cprotect
: false;
column += current_font.latexWriteStartChanges(ots, bparams,
runparams, basefont, last_font, false,
// FIXME UNICODE
// FIXME \protect should only be used for fragile
// commands, but we do not provide this information yet.
- if (hasCProtectContent(runparams.moving_arg)) {
+ if (!runparams.no_cprotect && hasCProtectContent(runparams.moving_arg)) {
if (contains(runparams.active_chars, '^')) {
// cprotect relies on ^ being on catcode 7
os << "\\begingroup\\catcode`\\^=7";
void TeXEnvironment(Buffer const & buf, Text const & text,
- OutputParams const & runparams,
+ OutputParams const & runparams_in,
pit_type & pit, otexstream & os)
{
ParagraphList const & paragraphs = text.paragraphs();
depth_type const current_depth = ipar->params().depth();
Length const & current_left_indent = ipar->params().leftIndent();
+ OutputParams runparams = runparams_in;
+ runparams.no_cprotect = current_layout.nocprotect;
+
// This is for debugging purpose at the end.
pit_type const par_begin = pit;
for (; pit < runparams.par_end; ++pit) {
{
switch (style.latextype) {
case LATEX_COMMAND:
- if (par.needsCProtection(runparams.moving_arg)) {
+ if (!runparams.no_cprotect && par.needsCProtection(runparams.moving_arg)) {
if (contains(runparams.active_chars, '^'))
// cprotect relies on ^ being on catcode 7
os << "\\begingroup\\catcode`\\^=7";
// the code is different (JMarc)
if (style.isCommand()) {
os << "}";
- if (par.needsCProtection(runparams.moving_arg)
+ if (!runparams.no_cprotect && par.needsCProtection(runparams.moving_arg)
&& contains(runparams.active_chars, '^'))
os << "\\endgroup";
if (merged_par)
os << runparams.post_macro;
runparams.post_macro.clear();
}
- if (par.needsCProtection(runparams.moving_arg)
+ if (!runparams.no_cprotect && par.needsCProtection(runparams.moving_arg)
&& contains(runparams.active_chars, '^'))
os << "\\endgroup";
if (runparams.encoding != prev_encoding) {
os << runparams.post_macro;
runparams.post_macro.clear();
}
- if (par.needsCProtection(runparams.moving_arg)
+ if (!runparams.no_cprotect && par.needsCProtection(runparams.moving_arg)
&& contains(runparams.active_chars, '^'))
os << "\\endgroup";
if (runparams.encoding != prev_encoding) {