Tag Info

New answers tagged

2

You have the wrong syntax in the \FOR line: \documentclass{article} \usepackage{algorithm} \usepackage{algorithmic} \begin{document} \begin{algorithm} \caption{An Algorithm} \label{alg1} \begin{algorithmic}[1] \REQUIRE a set of candidate data records $CDRs$ \ENSURE a set of re-segmented data records $DRs$ \STATE \label{alg:line1}Sort CDRs in ascending ...


2

You can use adjustbox package and its adjustbox environment and to get a caption, use a figure environment: \begin{figure}[htbp] \begin{adjustbox}{max height=0.9\textheight,center} %% adjust max height your tikz code \end{adjustbox} \caption{This is my flow chart} \end{figure} Full code: \documentclass[a4paper,10pt]{article} ...


0

Remove the package setspace. I faced the same problem. Apparently sig-alternate.cls and setspace does not work together properly.


5

This is another option, removing the limitation in Karl Koeller's answer (the environment can freely float if desired, and \algcomment can be used inside the algorithm environment): \documentclass{article}s \usepackage{etoolbox} \usepackage{algorithm} \usepackage{algpseudocode} \usepackage{lipsum} % just for the example \makeatletter ...


1

I don't know how \BlankLines is defined, so I've removed that. If you want an unnumbered, empty line use \Statex. There are numerous problems with your code. \gets must be placed in math mode, i.e. it needs to be within a pair of dollar signs. When outside math mode it generates the missing $ inserted error. In the first \State in the for loop you have ...


8

I've defined a new command \algcomment to be used just after the algorithm environment. \newcommand{\algcomment}[1]{% \vspace{-\baselineskip}% \noindent% {\footnotesize #1\par}% \vspace{\baselineskip}% } The only limitation is that you cannot allow the algorithm to float. MWE: \documentclass{article} \usepackage{algorithm} ...


2

Yes, just don't use a floating environment. \documentclass{article} \usepackage{algpseudocode} \begin{document} \begin{itemize} \item \begin{algorithmic}[1] \Procedure{Euclid}{$a,b$}\Comment{The g.c.d. of a and b} \State $r\gets a\bmod b$ \While{$r\not=0$}\Comment{We have the answer if r is 0} \State $a\gets b$ \State $b\gets r$ \State $r\gets ...


6

An attempt where foreach loop to draw lines is used if possible. a line style is newly added. Code \documentclass[a4paper,10pt]{article} \usepackage[margin=1cm]{geometry} \usepackage[utf8]{inputenc} \usepackage{tikz} \usetikzlibrary{matrix,shapes,arrows,positioning,chains,calc} \begin{document} % Define block styles \tikzset{ desicion/.style={ ...


4

Since your redefinition has the @ character, you need \makeatletter, \makeatother: \makeatletter \renewcommand*{\ALG@name}{Algoritma} \makeatother The code: \documentclass[oneside,a4paper , 12 pt, titlepage]{book} \usepackage{algorithmicx} \usepackage{algorithm} \usepackage{listings} \usepackage{algcompatible} \usepackage{algpseudocode} \makeatletter ...


3

For example: \documentclass[a4paper,10pt]{article} \usepackage[utf8]{inputenc} \usepackage{tikz} \usetikzlibrary{matrix,shapes,arrows,positioning,chains} \begin{document} % Define block styles \tikzset{ desicion/.style={ diamond, draw, text width=4em, text badly centered, inner sep=0pt }, block/.style={ rectangle, draw, ...


4

I wouldn't do this, since there is no consistency with other chapter titles, but if you really want to do this, here is what you can do. You have two commands to control the spacing before and after the chapter titles, \chapterheadstartvskip and \chapterheadendvskip, respectively. You can modify them locally to change only the appearance of the List of ...


5

That is the document default small caps font so \textsc{FooProc} Better would be to use the package defined command \textproc{Fooproc} which will do the same thing, but ensure that if you customise the fonts used in the psuedo-code, the reference will use the same font.


6

You're loading algorithmic, but using the syntax of algpseudocode. \documentclass{article} \usepackage{algorithm,algpseudocode} \begin{document} \begin{algorithm} \caption{PSO} \label{pseudoPSO} \begin{algorithmic}[1] \State Initialize a population of particles with random values positions and velocities from \textit{D} dimensions in the search space ...


3

You're not consistent with delimiting math formulas; for instance, in the second \STATE line, you open a math formula, without closing it. I have tried to make the algorithms more consistent. Note that \LOOP and \Loop are not the same (and the latter is not defined in algorithmic). If you're using a different set of packages, please make it known. ...


3

Two problems: you had a missing closing brace for the \IF and you were using INITIALIZE in a forbidden place (the beginning of the list internally used). Perhaps you could use \STATE INITIALIZE $C = \emptyset$ or any other of the keywords provided by the package. \documentclass{report} \usepackage{algorithmic,algorithm} \begin{document} ...



Top 50 recent answers are included