chrmatt / algpseudocodex

LaTeX package for typesetting pseudocode.
38 stars 2 forks source link

Issue with comments at the end of a block of code #6

Closed louisjac closed 2 years ago

louisjac commented 2 years ago

Hello,

When adding comment to the end of a block of code, the comment is not right aligned as the other comments but rather it is shifted right by one indentation. I have attached an example showing comments wrongly placed on \EndIf and \Until using the parameter noEnd=false but the problem also happens when issuing comments on \Until even if noEnd=true.

Thank you for the support! There are several ways of fixing this manually or globally but I don't know which is the most idiomatic way nor which will not break something else…

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[noEnd=false]{algpseudocodex}
\usepackage{algorithm}

\begin{document}
\begin{algorithm}[H]

  \begin{algorithmic}[1]
    \If{test}\Comment{ok}
    \State \Comment{ok}
    \Else \Comment{still ok}
    \State aaaa\Comment{...}
    \EndIf  \Comment{shifted right}
    \Repeat  \Comment{fine}
    \Repeat  \Comment{fine}
    \State stmt \Comment{also fine}
    \Until{very very very very very long test}  \Comment{broken}
    \Until{short test} \Comment{broken}
    \State \Comment{fine again}
  \end{algorithmic}

\end{algorithm}
\end{document}

OUTPUT.pdf

chrmatt commented 2 years ago

Thanks for reporting! Should be fixed in the next release (v1.0.1).