1

Following is my MWE

\RequirePackage{luatex85} % needed of lualatex
\documentclass[]{standalone}
% \usepackage{algorithm}
\usepackage{algpseudocode}

\begin{document}
% \begin{algorithm}
\begin{algorithmic}[1]
    \Procedure{SequenceResponse}{$S_n$}\Comment{Hellow}
        \State $a \gets b$
    \EndProcedure
\end{algorithmic}
% \end{algorithm}
\end{document}

Even on this simple example, it fails:

Document Style algorithmicx 1.2 - a greatly improved `algorithmic' style
)
Document Style - pseudocode environments for use with the `algorithmicx' style
) (./algorithm.aux)

! LaTeX Error: Something's wrong--perhaps a missing \item.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.8     \Procedure
                {SequenceResponse}{$S_n$}\Comment{Hellow}
? 

I guess it is related to this. I tried wrapping it between algorithm environment but no success. Probably standalone is doing something.

I am using Texlive-2017. I updated it today (Aug 07, 2017) using tlmgr.

  • Wrapping it between \begin{figure} \end{figure} seems to fix it. – Dilawar Aug 7 '17 at 12:46
2

You can use the varwidth option:

\RequirePackage{luatex85} % needed of lualatex
\documentclass[varwidth]{standalone}
% \usepackage{algorithm}
\usepackage{algpseudocode}

\begin{document}
% \begin{algorithm}

\begin{algorithmic}[1]
    \Procedure{SequenceResponse}{$S_n$}\Comment{Hellow}
        \State $a \gets b$
    \EndProcedure
\end{algorithmic}
% \end{algorithm}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.