# Tag Info

2


0

Since you're using the ruled style, the caption is always placed on the top. As such, we can patch the start of the algorithm environment and insert the aid provided by Equivalent to hypcap for [ruled]{algorithm2e}?. The following patch is provided by xpatch, since the definition of algorithm takes an optional argument: \documentclass{scrbook}% ...

0

As long as the algorithm is set using a package that manages it as a list, then it will be breakable across columns or page boundaries. If a package manages the algorithm in a box, then it won't break. algorithmic and algorithmicx manages its algorithms inside lists, as can listings. Here's an example using algpseudocode from algorithmicx: ...

1

The indentation issues are answered by a simple extension to the solution to Forced indentation in algorithmicx. The vertical lines pose a harder problem. One cannot introduce any solution that creates a group where the vertical line should start and ends the group where the vertical line should end, because this breaks algorithmicx. Therefore, the only ...

4

algorithmic creates all of the necessary pseudocode macros at the start of the algorithmic environment. As such, it's not as easy to merely patch \REPEAT and/or \UNTIL in the "usual" way. The following MWE inserts the patch after the algorithmic environment starts. The patch uses a "no step" \item in the form of \ALC@it@nostep rather than the default ...

4

While algorithm2e does supply an \If(..)-style conditional (for commenting), you're probably after \If{..}{...} inside your nested if. The reason for the failure is because the \If(..)-style usage requires more arguments than you are currently supplying. Mere's a MWE: \documentclass{article} \usepackage{algorithm2e}% http://ctan.org/pkg/algorithm2e ...

4

Here are two possibilities. In both cases the trick is to use the float specifier H for the algorithm environment so to avoid it to float. In this way you can place it inside a figure environment. With algorithm2e Code: \documentclass{article} \usepackage[ruled]{algorithm2e} \begin{document} \listoffigures \bigskip \begin{figure}[htbp] ...

2

Here's a more natural (automatic and better-behaved) implementation of the vertical lines, where I have used Werner's answer to the linked question as a starting point. It works for the noend case too, but there is a fudge factor of \addvspace{-3pt} in the printing code to prevent unwanted gaps in lines that don't get printed. This is not very robust but I ...

1

I'm new to this package, but perhaps the following may be close to what you're after: \documentclass{article} \usepackage{clrscode3e} \begin{document} \begin{codebox} \Procname{$\proc{ConnectTwoSamplePoints}(Graph, S1, S2, connectionCostMat, cost)$} \li cost[S1][S2] $= \infty$ \li \Comment cost holds the length of the shortest path between S1 and S2 \li ...

3

You're probably combining the use of algorithmic and algorithmicx package. The latter can be used as a full replacement of the former, so you should not load them together (the error is reproduced when they are loaded in sequence \usepackage{algorithmic,algcompatible}). I would suggest using it in the following way: \documentclass{article} ...

4

You can follow this way. First of all, you need to use the H specifier so to force the algorithm environment not to float. Then, since the H specifier is not allowed in two-column mode, you can use the workaround described by Werner in this answer, that is add the following lines in the preamble \makeatletter ...

0

Gnumeric is itself powerful enough to build a template and convert it into LaTeX tabular using concatenation of strings. Check out, for example, this gnumeric-table.xml created with Gnumeric Spreadsheet 1.10.17: <?xml version="1.0" encoding="UTF-8"?> <gnm:Workbook xmlns:gnm="http://www.gnumeric.org/v10.dtd" ...

5

You have asked two separate (interesting) questions. The first is about names. In general, mathematicians prefer generic names ("n", "r", x") while programmers prefer longer, more meaningful ones. In your case I'd go for meaningful. Your second question is about typography. There I think the computer programmer's practice of delayed commitment will serve ...

2

You can redefine the \alglinenumber macro: \documentclass{article} \usepackage{algorithm} % http://ctan.org/pkg/algorithms \usepackage[noend]{algpseudocode} % http://ctan.org/pkg/algorithmicx \algrenewcommand\alglinenumber[1]{\tiny #1:} \begin{document} \begin{algorithm} \caption{a}\label{alg:drs} \begin{algorithmic}[1] \Procedure{a}{} ...

3

Preventing end keywords from being typeset Simply pass the noend option to the algpseudocode package: substitute \usepackage[noend]{algpseudocode} for \usepackage{algpseudocode} in your code and you get To avoid having to use \EndIf and \Endfor in your input file (After clarification by the OP, this turns out to be off-topic.) Missing \EndIf and ...

3

According to algpseudocode, these two are structurally the same, apart from their name: \algdef{SE}[PROCEDURE]{Procedure}{EndProcedure}% [2]{\algorithmicprocedure\ \textproc{#1}\ifthenelse{\equal{#2}{}}{}{(#2)}}% {\algorithmicend\ \algorithmicprocedure}% \algdef{SE}[FUNCTION]{Function}{EndFunction}% [2]{\algorithmicfunction\ ...

2

This is not at all a TeX-related question, but a function returns a value while a procedure does not (void in C++). A procedure only performs some actions, it is invoked because of its side effects.

Top 50 recent answers are included