New answers tagged

1

The algorithm2e package has a noresetcount option, but this has the effect of numbering all algorithms continuously. You can define a \rememberlines macro that will store the line number that was current at the end of an algorithm environment and a \resumenumbering macro that uses that value. \documentclass[paper=a4,toc=bibliography,parskip=true]{scrreprt} ...


3

Place a \mbox{} before the algorithm environments (after each \item) The itemize environment should be replaced by enumerate which provides the numbering instead of \item[1.] etc. \documentclass{article} %\usepackage{german,t1enc} % Is this needed? \usepackage{enumitem} \usepackage[linesnumbered,ruled,vlined]{algorithm2e} \usepackage{amsmath} ...


0

I had the same issue with the If block. For me, it turned out, that using \phantom was the solution. Just insert letters and characters until the indent and the wrapping is OK. Then put \phantom before these artificial letters. \documentclass{article} \usepackage{algpseudocode} \begin{document} \begin{algorithmic}[1] \Procedure{Demo}{} \If{This is a very ...


1

The intended way to do this in the algorithmicx package is with the \Call macro, ex: \begin{algorithm} \begin{algorithmic} \Function{Fix}{f} f(\Call{Fix}{f}) \EndFunction \end{algorithmic} \end{algorithm}


1

If you use a label and a ref, you need to compile your document twice. Otherwise an error may occur. \documentclass{article} \usepackage{algorithm} \usepackage{algorithmic} \begin{document} \begin{algorithm}[tb] \caption{Algorithm} \label{alg} \begin{algorithmic}[1] \STATE blalblabla \label{cond1} \STATE blablabla ...


5

You need to make sure that the equation sides have equal width. That can be achieved by placing the smaller elements inside a box of larger width via \makebox (X_x is wider than A_x and B_x +/- C_x is wider than Y_x +/- Z_x): \documentclass{article} \usepackage{algpseudocode} \usepackage{algorithm,calc} ...


0

This is because there is no algorithms package, only algorithmic and algorithm packages. So you should do this instead: % "algorithms" bundle \usepackage{algorithmic} \usepackage{algorithm} It is really confusing because the official doc calls "algorithms" a bundle: http://mirror.its.dal.ca/ctan/macros/latex/contrib/algorithms/algorithms.pdf but then ...


0

Between two algorithms, use the code below: \vspace{-0.5cm} You can set what ever number you want in {}, a negative value will shrink the spacing.



Top 50 recent answers are included