New answers tagged

2

You need to place the algorithm inside a frame. Even then the content is too much to fit on a regular slide. As such, I've placed it inside a box - using an [H] float specifier - and resized it to fit within the frame height. \documentclass[dvipsnames,svgnames]{beamer} \usepackage[ruled,vlined,linesnumbered]{algorithm2e} \begin{document} \begin{frame}[...


5

You have several errors, I fixed the most important ones. All the \def should better be \newcommand. Don't load geometry, it doesn't make sense, as beamer already loads it with its own options Don't load xcolor, rather pass the options to the class as shown Don't load graphicx Don't load url, it's already coming with hyperref Since you need a frame, it ...


2

Here is one option that sets up a block called \BEGIN as part of a substeps environment*. The environment is constructed using environ, for ease-of-use. \documentclass{article} \usepackage[linesnumbered,nosemicolon,noline]{algorithm2e} \usepackage{environ} \newcounter{parentAlgoLine} \SetKwBlock{BEGIN}{}{} \makeatletter \NewEnviron{substeps}{% \...


2

i don't know any reason not to use align* for this; requires amsmath. \documentclass[twocolumn]{article} \usepackage{algorithm2e} \usepackage{amsmath} \begin{document} \noindent Some text preceding. \begin{algorithm} \DontPrintSemicolon \caption{Computing Levenshtein edit distance } \abovedisplayskip=0pt \begin{align*} D(i,j) = \min\bigl\{& D(...


2

Don't use the [H]ere specifier, since it's not allowed in twocolumn mode by-design. Also, I've used some \phantoms to provide the appropriate layout of the function across three lines. Note that \State is used by algorithmicx's algpseudocde package, not algorithm2e. Instead, algorithm2e uses an end-of-line \; without a \State. In order to make the math ...


2

There is an optional argument you can supply to \tcp that updates the way it displays in terms of the alignment. For more details, see section 10.3 comments (p 32) of the algorithm2e documentation. Below I've used [h] and [l] to have a left-aligned comment without/with a line-end. \documentclass{article} \usepackage{algorithm2e,mathtools} \newcommand{\...


6

There is a problem in line 1061 of algorithm2e.sty, that reads \newboolean{algocf@displaygroupmarkers}{\setboolean{algocf@displaygroupmarkers}{false} but the { brace before \setboolean is wrong (and unbalanced). This gets mostly unnoticed, just causing a warning in the log file; in the case of xeCJK, the tons of assignments it does are performed in the ...


1

Your notation for \If is incorrect. You're using \If(..){...} while you should be using \If{..}{...}: \documentclass{article} \usepackage{algorithm2e} \begin{document} \begin{algorithm}[H] \SetAlgoLined \KwData{x} \KwResult{y} \ForEach{Subject in Subjects}{% \If{G(Subject, rdf:type, d ) $\notin$ T}{% violation = true\; BREAK\; }...


1

You can't mix the use of the algorithms bundle (which provides an algorithm environment/float) with algorithm2e. Use either the one, or the other. \documentclass{article} \usepackage[ruled]{algorithm2e} \begin{document} \begin{algorithm}[H] \SetKwInput{Initialization}{Initialisation} \LinesNumbered \Initialization{} \For{}{} \end{algorithm} \...



Top 50 recent answers are included