mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
algorithm2e.module: Add Algorithm style to typeset algorithms
Do not output \begin and \end if there is not environment name. We only need the nesting feature.
This commit is contained in:
parent
517cd50e05
commit
5452c53e9b
@ -1,7 +1,8 @@
|
||||
#\DeclareLyXModule[algorithm2e.sty]{Algorithm2e}
|
||||
#DescriptionBegin
|
||||
# Use the algorithm2e package for algorithm floats rather
|
||||
# than LyX's home-brewed algorithm floats.
|
||||
# than LyX's home-brewed algorithm floats. Use the Algorithm
|
||||
# style to enter and indent the algorithm.
|
||||
#DescriptionEnd
|
||||
#
|
||||
#Author: Jürgen Spitzmüller
|
||||
@ -26,3 +27,14 @@ Float
|
||||
RefPrefix alg
|
||||
End
|
||||
|
||||
Style Algorithm
|
||||
Category List
|
||||
Margin Static
|
||||
LatexType Environment
|
||||
NextNoIndent 1
|
||||
ParbreakIsNewline 1
|
||||
ToggleIndent Never
|
||||
KeepEmpty 1
|
||||
LeftMargin MM
|
||||
Align Left
|
||||
End
|
||||
|
@ -258,8 +258,10 @@ static TeXEnvironmentData prepareEnvironment(Buffer const & buf,
|
||||
data.leftindent_open = true;
|
||||
}
|
||||
|
||||
if (style.isEnvironment()) {
|
||||
if (style.isEnvironment())
|
||||
state->nest_level_ += 1;
|
||||
|
||||
if (style.isEnvironment() && !style.latexname().empty()) {
|
||||
os << "\\begin{" << from_ascii(style.latexname()) << '}';
|
||||
if (!style.latexargs().empty()) {
|
||||
OutputParams rp = runparams;
|
||||
@ -324,7 +326,9 @@ static void finishEnvironment(otexstream & os, OutputParams const & runparams,
|
||||
}
|
||||
}
|
||||
state->nest_level_ -= 1;
|
||||
os << "\\end{" << from_ascii(data.style->latexname()) << "}\n";
|
||||
string const & name = data.style->latexname();
|
||||
if (!name.empty())
|
||||
os << "\\end{" << from_ascii(name) << "}\n";
|
||||
state->prev_env_language_ = data.par_language;
|
||||
if (runparams.encoding != data.prev_encoding) {
|
||||
runparams.encoding = data.prev_encoding;
|
||||
|
Loading…
Reference in New Issue
Block a user