lf- / typst-algorithmic

Algorithm pseudocode typesetting library for Typst
14 stars 1 forks source link

Inline comments? #2

Open dantechguy opened 5 months ago

dantechguy commented 5 months ago

Hi, Thanks for the superb package. I'm currently writing my dissertation (due in 3 weeks!) and was wondering if it's possible to have inline comments, which are also styled like this?

image

Any help is greatly appreciated, even if it's a no.

Thanks for your time! Dan

lf- commented 5 months ago

I have a dissatisfying answer to this, unfortunately. As far as I can tell, Typst doesn't have facilities for right-aligning within a line. We could make the table have another column for them, but that feels bad since it would wrap actual content.

In responding to this issue I came up with a really bad prototype of inline comments here that has obvious design flaws and I will not release as an official version (see the commit message for details). But it may solve your problem for you: https://github.com/lf-/typst-algorithmic/tree/jade/inline-comments-bad

Feel free to just copy the code into your project and hack it up as necessary <3

Thanks for flying with typst-algorithmic.

TimotheAlbouy commented 4 months ago

Hi, thanks for your package, I like the syntax way more than other algorithm packages such as typst-algorithms and lovelace.

Do you know if the technique used in typst-algorithms to make inline comments could also be used for this package?

Also, why is there a Ic function in the API for inline comments if this feature is not yet implemented?

lf- commented 4 months ago

I don't know, as I've not had to do academic writing for a year and haven't looked into the others.

If you wanted you could probably write the API surface for typst-algorithmic for the other ones.

As for why it's called Ic, it's because it's, if I recall correctly, not wrapped in a list so it's only usable in contexts expecting plain content.

TimotheAlbouy commented 4 months ago

If you wanted you could probably write the API surface for typst-algorithmic for the other ones.

What do you mean? Do I try to write the feature for inline comments in typst-algorithmic based on the technique used by typst-algorithms, or do I try to implement the syntax of typst-algorithmic in typst-algorithms?

lf- commented 4 months ago

The latter, you can see the trick we used here (single element lists which get +'d together when they wind up getting into a {}), and implement it on a potentially better rendering library.

TimotheAlbouy commented 4 months ago

Thanks! Are you dropping this project?

lf- commented 4 months ago

It's more "done" than "dropped" tbh.

TimotheAlbouy commented 4 months ago

I see, but there are more features that could be implemented (inline comments, caption styling, vertical lines for indents...). I know that one could still fork the project, but having a lot of different clone projects would confuse the end-users trying to find a pseudocode package IMHO.