I want to use the algorithm2e
package in LyX (version 2.2.3). There is a LyX module that makes this task simple. However, I would like to adjust the arguments with which the package is imported.
The LaTeX code generated by LyX reads
\usepackage{algorithm2e}
What I want is something like
\usepackage[lined, algonl, boxed]{algorithm2e}
As pointed out in this post, the options with which a package imported by a module is loaded can be changed by going to Document > Settings > Local Layout
and entering package options like
PackageOptions algorithm2e lined
This adds the line
\PassOptionsToPackage{lined}{algorithm2e}
to the source code before the import of algorithm2e
. Accordingly, I have tried to pass multiple arguments:
PackageOptions algorithm2e lined
PackageOptions algorithm2e algonl
PackageOptions algorithm2e boxed
However, only the last PackageOptions
line is considered in the code, which reads
\PassOptionsToPackage{boxed}{algorithm2e}
\usepackage{algorithm2e}
This might be wanted behaviour (or not - I do not know whether PassOptionsToPackage
can be applied multiple times). Nevertheless, the question remains: How can I add multiple package options?
I have tried to import algorithm2e
in the "Latex-Preamble" in the document settings of LyX. However, this results in a conflict with the internal LyX solution. I get an error stating Command \algorithm already defined
.
Would it be an option to write a new LyX module with adjusted import? How could I do this? The LyX documentation on modules is not detailed. I looked at the code of the algorithm2e
module but did neither understand it completely nor find a line that I could adjust accordingly.