Tag Info

New answers tagged

0

The breqn package was recently dissociated from mathtools. To see it, you should synchronize the list of files in the package repositories. To do so, launch MiKTeX Package Manager, click on the Repository menu and select Synchronize:


0

Sounds like you are after \SetKwInput, with syntax \SetKwInput{<name>}{<keymord>} which defines the macro \<name>{<arg>} to print <keyword> in keyword typography followed by :, and then argument <arg>. A complete example: \documentclass{article} \usepackage[]{algorithm2e} \SetKwInput{kwInit}{Init} \begin{document} ...


2

You need to add ruled in the option while loading the package. Code \documentclass{article} \usepackage[ruled]{algorithm2e} \begin{document} \begin{algorithm}[H] \SetAlgoLined \KwResult{Write here the result } initialization\; \While{While condition}{ instructions\; \eIf{condition}{ instructions1\; instructions2\; }{ instructions3\; ...


3

You can create a do-while construct using the same technique that a repeat-until construct is generated. They both fall under what algorithm2e calls "Repeat macros": \SetKwRepeat{Do}{do}{while} The above now allows you to use \Do{<end condition>}{<stuff>} Here is a minimal example showing its use/output: \documentclass{article} ...


4

Here's another option giving you two commands \SetAlgoFig to switch to a figure environment and \┼×etAlgoNoFig to switch to the algorithm environment (explanations at the bottom): \documentclass{article} \usepackage{lipsum} \usepackage[ruled,linesnumbered,vlined,scleft]{algorithm2e} \usepackage{adjustbox} \newsavebox{\tempbox} \makeatletter \let\oldnl\nl% ...


2

Both environments use the algocf counter; you can teach LaTeX to use another one for procedures. \documentclass{article} \usepackage[procnumbered,ruled]{algorithm2e} \usepackage{etoolbox} \newcounter{procedure} \makeatletter \AtBeginEnvironment{procedure}{\let\c@algocf\c@procedure} \makeatother \begin{document} \begin{procedure}[!htp] \caption{myproc()} ...


4

I find the solution here fairly straight-forward. Instead of using an algorithm environment with switches, just use a figure environment whenever you need it. Potentially (perhaps encouraged), you could hide the floating figure environment inside a differently-named one figalgorithm (say): \documentclass{article} ...


0

These options are set when loading the package and is meant to promote consistency. However, it's fairly trivial to adjust the algorithm style. Below I've introduced \algorithmstyle{<style>} where you can specify/update the algorithm style to match any of the existing ones provided by the package: \documentclass{article} ...


0

Put \IncMargin{1em} \DecMargin{1em} around your algorithm. \IncMargin{1em} \begin{algorithm} \end{algorithm} \DecMargin{1em}



Top 50 recent answers are included