New answers tagged

0

There might be multiple reasons and corresponding solutions: algorithm2e allows to customize the amount of extra vertical spaces before and after the algorithm block by \SetAlgoSkip{skip command}. For example, \SetAlgoSkip{} removes all the additional skips. Check out the documentation for more details. It seems to me making the algorithm environment not ...


1

You are using an elsed if hence the name \eIf already. So it expects an else statement \documentclass[]{article} \usepackage[ruled]{algorithm2e} \begin{document} \begin{algorithm}[H] \While{true:} { pl = Poll() \\ sd = PollSd() \\ \eIf{time}{ ok; } %<----- Here it expects an else block, basically ...


2

Here is a way to achieve what you want... Use \addtocounter{algocf}{-1} to reduce the Algorithm counter before setting a countinued algorithm. Use \strut as part of the caption to ensure that they present at a similar height if you want to avoid a "jumping" effect when skipping between pages. Mark the end of an algorithm with a \label that you can use to ...


0

I have found a solution from other topics, though not the most elegant one I suppose. You can do it with minpages but then you have to give your algorthm environment the [H] specifier such that it isn't a float anymore. I'd prefer if it would remain a float but it will do... Here's an example \begin{center} \begin{minipage}{0.7\textwidth} ...


0

Do not auto-enumerate the lines. Instead, set those that require a number using \nl and those that require something else with \nlset{<stuff>}: \documentclass[conference]{IEEEtran} \usepackage[ruled]{algorithm2e} \begin{document} \begin{algorithm} \nl $\pi=1$\; \nlset{*} $\Phi = 2$\; \nl $\pi = 3$\; \end{algorithm} \end{document} Another ...


0

I was using \usepackage{stfloats}. Removing the package solved my issue.


0

\documentclass{article} \usepackage{amsmath} \begin{document} \begin{verbatim} if (some condition) P=P+($W_i*((W-P)/W_i$))\\ end \end{verbatim} \begin{align*} P &= P + W_{i}*((W-P)/W_{i})\\ P &= P + \frac{W_{i}*(W-P)}{W_{i}}\\ \end{align*} \end{document}


1

The example you showed has unbalanced braces and $. Generally, if you want to to type multiline maths, it is not sufficient to separate the lines with blank line as you do in ordinary text. You need to use special environments like align, gather, split, aligned, gathered etc. The new lines / rows are signalled with \\ instead of blank lines (like you do in ...


2

algorithm2e's \caption has the following format: \AlCapSty{\AlCapFnt Algorithm 1:}\AlCapNameSty{\AlCapNameFnt my algorithm} Taken from the "change log": By default, \AlCapSty is \textbf and \AlCapFnt is nothing. \AlCapNameSty keep text as it is, and \AlCapNameFnt do nothing also. You can redefine \AlCapFnt and \AlCapNameFnt by giving macro to ...


0

Well, I do not know what you want to do with the command \useothernumberingtrue, but that command throws in the following compiling MWE (I have commented this command out!) 5 errors. Please explain in your question what the given code should do ... The following MWE compiles without errors (please see my changings, I commented all packages or commands not ...


2

In my point of view this is best achieved with a SubAlgoLine counter and an conditional within \theAlgoLine (which prints the line number) \documentclass{article} \usepackage{amsmath, amsfonts, amssymb, amsthm, bm} \usepackage{commath} \usepackage{xcolor} \usepackage[most]{tcolorbox} \usepackage{tikz} \usetikzlibrary{backgrounds} ...


1

You have to use \titlecontents{algocf} because the package algorithm2e stores the captions as \contentsline{algocf}{...} in the .loa file. However, this package doesn't seem to be wanting to cooperate with titletoc that's unable to initialize one of its variables, so we need to give some help. \documentclass{book} ...


4

Some points: align cannot see a & that is inside a TikZ node. Put E_s &= outside the \tikz-picture. \subnode should be used as \subnode{d4}{$X$}, not \subnode(d4){$X$} (note braces). And you need to set the baseline of the the tikzpicture to something useful. \documentclass{article} \usepackage{amsmath, amsfonts, amssymb, amsthm, bm} ...



Top 50 recent answers are included