mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-13 22:49:20 +00:00
Fix cprotect with Slovak
babel-slovak makes ^ active, though cprotect relies on it being catcode 9 ("ignored"). Thus we locally change the catcode with Slovak.
This commit is contained in:
parent
ce447e1760
commit
f995fba310
@ -1336,7 +1336,7 @@ Language slovak
|
|||||||
BabelName slovak
|
BabelName slovak
|
||||||
PolyglossiaName slovak
|
PolyglossiaName slovak
|
||||||
QuoteStyle german
|
QuoteStyle german
|
||||||
ActiveChars -
|
ActiveChars -^
|
||||||
Encoding iso8859-2
|
Encoding iso8859-2
|
||||||
FontEncoding T1|OT1
|
FontEncoding T1|OT1
|
||||||
DateFormats "d. MMMM yyyy|d. MMM yyyy|d.M.yyyy"
|
DateFormats "d. MMMM yyyy|d. MMM yyyy|d.M.yyyy"
|
||||||
|
@ -396,6 +396,7 @@ void InsetBox::latex(otexstream & os, OutputParams const & runparams) const
|
|||||||
if (stdwidth && !(buffer().params().paragraph_separation))
|
if (stdwidth && !(buffer().params().paragraph_separation))
|
||||||
os << "\\noindent";
|
os << "\\noindent";
|
||||||
|
|
||||||
|
bool needendgroup = false;
|
||||||
switch (btype) {
|
switch (btype) {
|
||||||
case Frameless:
|
case Frameless:
|
||||||
break;
|
break;
|
||||||
@ -439,9 +440,15 @@ void InsetBox::latex(otexstream & os, OutputParams const & runparams) const
|
|||||||
} else {
|
} else {
|
||||||
if (params_.framecolor != "black" || params_.backgroundcolor != "none")
|
if (params_.framecolor != "black" || params_.backgroundcolor != "none")
|
||||||
os << "\\fcolorbox{" << params_.framecolor << "}{" << params_.backgroundcolor << "}";
|
os << "\\fcolorbox{" << params_.framecolor << "}{" << params_.backgroundcolor << "}";
|
||||||
else
|
else {
|
||||||
|
if (!cprotect.empty() && contains(runparams.active_chars, '^')) {
|
||||||
|
// cprotect relies on ^ being ignored
|
||||||
|
os << "\\begingroup\\catcode`\\^=9";
|
||||||
|
needendgroup = true;
|
||||||
|
}
|
||||||
os << cprotect << "\\fbox";
|
os << cprotect << "\\fbox";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
os << "{";
|
os << "{";
|
||||||
break;
|
break;
|
||||||
case ovalbox:
|
case ovalbox:
|
||||||
@ -592,6 +599,8 @@ void InsetBox::latex(otexstream & os, OutputParams const & runparams) const
|
|||||||
os << "}";
|
os << "}";
|
||||||
if (separation_string != defaultSep || thickness_string != defaultThick)
|
if (separation_string != defaultSep || thickness_string != defaultThick)
|
||||||
os << "}";
|
os << "}";
|
||||||
|
if (needendgroup)
|
||||||
|
os << "\\endgroup";
|
||||||
break;
|
break;
|
||||||
case ovalbox:
|
case ovalbox:
|
||||||
os << "}";
|
os << "}";
|
||||||
|
@ -454,14 +454,20 @@ void InsetText::latex(otexstream & os, OutputParams const & runparams) const
|
|||||||
InsetLayout const & il = getLayout();
|
InsetLayout const & il = getLayout();
|
||||||
if (il.forceOwnlines())
|
if (il.forceOwnlines())
|
||||||
os << breakln;
|
os << breakln;
|
||||||
|
bool needendgroup = false;
|
||||||
if (!il.latexname().empty()) {
|
if (!il.latexname().empty()) {
|
||||||
if (il.latextype() == InsetLayout::COMMAND) {
|
if (il.latextype() == InsetLayout::COMMAND) {
|
||||||
// FIXME UNICODE
|
// FIXME UNICODE
|
||||||
// FIXME \protect should only be used for fragile
|
// FIXME \protect should only be used for fragile
|
||||||
// commands, but we do not provide this information yet.
|
// commands, but we do not provide this information yet.
|
||||||
if (hasCProtectContent(runparams.moving_arg))
|
if (hasCProtectContent(runparams.moving_arg)) {
|
||||||
|
if (contains(runparams.active_chars, '^')) {
|
||||||
|
// cprotect relies on ^ being ignored
|
||||||
|
os << "\\begingroup\\catcode`\\^=9";
|
||||||
|
needendgroup = true;
|
||||||
|
}
|
||||||
os << "\\cprotect";
|
os << "\\cprotect";
|
||||||
else if (runparams.moving_arg)
|
} else if (runparams.moving_arg)
|
||||||
os << "\\protect";
|
os << "\\protect";
|
||||||
os << '\\' << from_utf8(il.latexname());
|
os << '\\' << from_utf8(il.latexname());
|
||||||
if (!il.latexargs().empty())
|
if (!il.latexargs().empty())
|
||||||
@ -522,6 +528,8 @@ void InsetText::latex(otexstream & os, OutputParams const & runparams) const
|
|||||||
os << "}";
|
os << "}";
|
||||||
if (!il.postcommandargs().empty())
|
if (!il.postcommandargs().empty())
|
||||||
getArgs(os, runparams, true);
|
getArgs(os, runparams, true);
|
||||||
|
if (needendgroup)
|
||||||
|
os << "\\endgroup";
|
||||||
} else if (il.latextype() == InsetLayout::ENVIRONMENT) {
|
} else if (il.latextype() == InsetLayout::ENVIRONMENT) {
|
||||||
// A comment environment doesn't need a % before \n\end
|
// A comment environment doesn't need a % before \n\end
|
||||||
if (il.isDisplay() || runparams.inComment)
|
if (il.isDisplay() || runparams.inComment)
|
||||||
|
@ -679,8 +679,12 @@ void parStartCommand(Paragraph const & par, otexstream & os,
|
|||||||
{
|
{
|
||||||
switch (style.latextype) {
|
switch (style.latextype) {
|
||||||
case LATEX_COMMAND:
|
case LATEX_COMMAND:
|
||||||
if (par.needsCProtection(runparams.moving_arg))
|
if (par.needsCProtection(runparams.moving_arg)) {
|
||||||
|
if (contains(runparams.active_chars, '^'))
|
||||||
|
// cprotect relies on ^ being ignored
|
||||||
|
os << "\\begingroup\\catcode`\\^=9";
|
||||||
os << "\\cprotect";
|
os << "\\cprotect";
|
||||||
|
}
|
||||||
os << '\\' << from_ascii(style.latexname());
|
os << '\\' << from_ascii(style.latexname());
|
||||||
|
|
||||||
// Command arguments
|
// Command arguments
|
||||||
@ -794,8 +798,13 @@ void TeXOnePar(Buffer const & buf,
|
|||||||
// I did not create a parEndCommand for this minuscule
|
// I did not create a parEndCommand for this minuscule
|
||||||
// task because in the other user of parStartCommand
|
// task because in the other user of parStartCommand
|
||||||
// the code is different (JMarc)
|
// the code is different (JMarc)
|
||||||
if (style.isCommand())
|
if (style.isCommand()) {
|
||||||
os << "}\n";
|
os << "}";
|
||||||
|
if (par.needsCProtection(runparams.moving_arg)
|
||||||
|
&& contains(runparams.active_chars, '^'))
|
||||||
|
os << "\\endgroup";
|
||||||
|
os << "\n";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
os << '\n';
|
os << '\n';
|
||||||
if (!style.parbreak_is_newline) {
|
if (!style.parbreak_is_newline) {
|
||||||
@ -1116,6 +1125,9 @@ void TeXOnePar(Buffer const & buf,
|
|||||||
os << runparams.post_macro;
|
os << runparams.post_macro;
|
||||||
runparams.post_macro.clear();
|
runparams.post_macro.clear();
|
||||||
}
|
}
|
||||||
|
if (par.needsCProtection(runparams.moving_arg)
|
||||||
|
&& contains(runparams.active_chars, '^'))
|
||||||
|
os << "\\endgroup";
|
||||||
if (runparams.encoding != prev_encoding) {
|
if (runparams.encoding != prev_encoding) {
|
||||||
runparams.encoding = prev_encoding;
|
runparams.encoding = prev_encoding;
|
||||||
os << setEncoding(prev_encoding->iconvName());
|
os << setEncoding(prev_encoding->iconvName());
|
||||||
@ -1280,6 +1292,9 @@ void TeXOnePar(Buffer const & buf,
|
|||||||
os << runparams.post_macro;
|
os << runparams.post_macro;
|
||||||
runparams.post_macro.clear();
|
runparams.post_macro.clear();
|
||||||
}
|
}
|
||||||
|
if (par.needsCProtection(runparams.moving_arg)
|
||||||
|
&& contains(runparams.active_chars, '^'))
|
||||||
|
os << "\\endgroup";
|
||||||
if (runparams.encoding != prev_encoding) {
|
if (runparams.encoding != prev_encoding) {
|
||||||
runparams.encoding = prev_encoding;
|
runparams.encoding = prev_encoding;
|
||||||
os << setEncoding(prev_encoding->iconvName());
|
os << setEncoding(prev_encoding->iconvName());
|
||||||
|
Loading…
Reference in New Issue
Block a user