1

My algorithmicx (more concretely: algpseudocode) lines contain quite a lot of sub-/superscripts, which makes them look quite "squeezed" onto each other.

How can I have them spaced a little apart without adding it manually after every line?

\documentclass[11pt,paper=a4,parskip=half]{scrartcl}

\usepackage{algpseudocode}

\begin{document}

have:
\begin{algorithmic}[1]
\State do()
\State some()
\State stuff()
\end{algorithmic}

want:
\begin{algorithmic}[1]
\State do()\vskip 3pt
\State some() \vskip 3pt
\State stuff()
\end{algorithmic}

\end{document}

I already found out that when I prepend stuff to \ALG@step, it gets prepended to the line, but when I use \vskip or \vspace there, I get errors like missing } inserted which I don't understand…

1

Maybe you can use \onehalfspacing from setspace package in the algorithmic environment.

\documentclass[11pt,paper=a4,parskip=half]{scrartcl}

\usepackage{algpseudocode}
\usepackage{setspace}
\begin{document}

have:
\begin{algorithmic}[1]\onehalfspacing
\State do()
\State some()
\State stuff()
\end{algorithmic}

want:
\begin{algorithmic}[1]
\State do()\vskip 3pt
\State some() \vskip 3pt
\State stuff()
\end{algorithmic}

\end{document}

enter image description here

  • That was easy, thank you :) I had inbetween made some hackery using a 0pt-width \rule to force a minimum height but this is way better – Marian Apr 14 at 14:00
  • @Marian I'm happy it works, thank you for accepting my answer! – CarLaTeX Apr 14 at 14:06

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.