Closed rosshjb closed 1 month ago
Hi, well, the comment now indeed looks bad. How about let them align to the right side like below:
If you are okay with this, I can try to implement.
@ytliu74 Awesome! If the comment is on a separate line, it would be better to display it as before:
\begin{algorithm}
\caption{Merge Sort}
\begin{algorithmic}
\Procedure{Merge-Sort}{$A,p,q,r$}
\State \Comment{zero or one element?}
\If{$p\ge r$}
\State \Return
\EndIf
\State $q \gets \lfloor(p+r)/2\rfloor$
\State \Call{Merge-Sort}{$A,p,q$}
\State \Call{Merge-Sort}{$A,q+1,r$}
\State \Call{Merge}{$A,p,q,r$}
\EndProcedure
\end{algorithmic}
\end{algorithm}
Hi @rosshjb, you can refer to this pull request https://github.com/ytliu74/obsidian-pseudocode/pull/18 for a possible solution. But it's not perfect. But you can use it as a workaround, thanks.
Example here:
Hi @rosshjb, you can refer to this pull request #18 for a possible solution. But it's not perfect. But you can use it as a workaround, thanks.
This change seem to break the layout...
This fix worked for me
.ps-comment {
float: right;
}
Or, to make it even more consistent with LaTeX package documentation (https://ctan.math.washington.edu/tex-archive/macros/latex/contrib/algpseudocodex/algpseudocodex.pdf):
Change it like that:
.ps-root {
font-family: KaTeX_Main, "Times New Roman", Times, serif;
font-weight: 400;
font-variant: normal;
font-style: normal;
text-transform: none;
}
.ps-comment {
font-family: KaTeX_Main, "Times New Roman", Times, serif;
font-weight: 400;
font-variant: normal;
font-style: italic;
text-transform: none;
opacity: 70%;
float: right;
}
Now it looks like this:
I just hacked this file: .obsidian/plugins/pseudocode-in-obs/styles.css
https://github.com/ytliu74/obsidian-pseudocode/pull/22 This could address the issue, but more clean up is possible.
Thanks so much for the support from @anton-dergunov. I've already merged the commit and it's included in the newest version.
Could you support an option to align comments?
Sample: