Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LComment without line numbering #7

Open
LeCyberDucky opened this issue Apr 1, 2022 · 4 comments
Open

LComment without line numbering #7

LeCyberDucky opened this issue Apr 1, 2022 · 4 comments

Comments

@LeCyberDucky
Copy link

LeCyberDucky commented Apr 1, 2022

Hi there!

I'm wondering if there is a way to create an LComment without the line numbering. I'm trying to write down an algorithm, where the individual steps can be sectioned into a few different groups. Basically, I'm trying to (mis-) use LComments to create small headings for different parts of the algorithm, and I would like to do that without line numbers.

Also, I would like to thank you for creating this package.

Update: Due to what appears to be a bug in algorithmicx, I ended up making my own commands for these headings. One command for the first heading directly after a \Procedure, and one for headings after \State has been used:

\algnewcommand{\AlgHeading}[1]{\Statex \textcolor{gray}{\textit{#1}}}
\algnewcommand{\AlgHeadingInitial}[1]{\Statex \hspace{\algorithmicindent}\textcolor{gray}{\textit{#1}}}
@chrmatt
Copy link
Owner

chrmatt commented Apr 1, 2022

Hey!

It would be nice to have a variant of the command that does not produce a line number. Similarly as the issue #5 . I will add such feature in a new release once I have some time.

In the meantime, you man use \Statex to produce a normal line without a number or even an empty line:

\documentclass{article}
\usepackage{algpseudocodex}

\begin{document}
    \begin{algorithmic}[1]
        \State numbered line
        \Statex % empty line
        \Statex \textbf{unnumbered line}
        \State numbered line
    \end{algorithmic}
\end{document}

@LeCyberDucky
Copy link
Author

Hey!

Thanks for the super quick response. After some more experimentation, I just realized on my own as well, that I should probably be using \Statex. So I'm happy to hear that this idea was in the right direction.

In trying to do that, however, I noticed, that \Statex does not produce the desired indentation if it is the first command after a \Procedure. There needs to be a \State after the \Procedure before I can use \Statex to write something without a line number. If the \State is missing, the text without line number will be aligned with the \Procedure. Is that the intended behavior?

@chrmatt
Copy link
Owner

chrmatt commented Apr 1, 2022

That appears to be a bug to me. However, the behavior is inherited from the package algorithmicx on which algpseudocodex is based. You can see that the same is happening when using \usepackage{algpseudocode}. So I'm not sure how much I can do about it.

@LeCyberDucky
Copy link
Author

Alright, thanks for your help! I'll try to see if I can find a place to report that. In the mean time I'll search around, to see if other people have experienced the same and perhaps come up with a workaround.

Have a nice day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants