Open hturner opened 1 year ago
LaTeX solutions for reference: https://www.overleaf.com/learn/latex/Algorithms. Some are more like code blocks and some are more like tables. I think a code-like version would be easier with R markdown, perhaps with a pseudocode language engine.
Quick demo of using pseudocode.js (https://saswat.padhi.me/pseudocode.js/) with R Markdown to mimic algorithm from LaTeX https://rpubs.com/cderv/pseudocodejs
Maybe it could help.
Otherwise texPreview is always an option to have an image version of a LaTeX rendering part. They have a nice engine. https://yonicd.github.io/texPreview/
Hope it helps
The pseudocode.js option looks like a good solution as returns proper HTML and MathJax. @ajgodfrey can you read the rendered algorithms in https://rpubs.com/cderv/pseudocodejs?
I guess the style could also be controlled via CSS to be more like the HTML tables.
Main JS library (https://saswat.padhi.me/pseudocode.js/) offers solution for more recent MathJaX or even KaTeX. So if one of those solution is better, I believe it can also be used with R Markdown.
The example on rPubs is quite old - so it could also have been updated since then regarding accessibility. I see there is now support for MathJax 4 even: https://github.com/SaswatPadhi/pseudocode.js
I'm not aware of a tool to format algorithms in markdown, possibly something could be provided by rjtools as a consistent solution.
As an example, I tried to format the algorithm from here: https://tex.stackexchange.com/a/452565/21118.