Simple algorithm displays

1,184 views
Skip to first unread message

Charles Martin

unread,
Apr 10, 2017, 2:19:46 PM4/10/17
to MathJax Users
I need to create an algorithm-like display of equations, for things such as a while loop, etc. This could be done by starting with multiple equations that are left justified, and being able to indent subsections of the equations.

There doesn't seem to be an algorithm extension for MathJax. Can someone suggest how to approach this type of display in MathJax? Maybe some CSS hacks would be needed?

Thanks,
Charlie


Peter Krautzberger

unread,
Apr 25, 2017, 5:13:46 AM4/25/17
to mathja...@googlegroups.com
Hi,

As you already noted, there's nothing build into MathJax for this. The main reason is that this kind of thing is usually text-mode in TeX, and relatively easy to do with HTML (<pre>, <code> etc) -- while MathJax focuses on the challenges of math mode.

In any case, it might help get more responses if you shared which packages you have in mind.

Regards,
Peter.


--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Charles Martin

unread,
Apr 27, 2017, 6:11:58 PM4/27/17
to MathJax Users
Thanks Peter,

I ended up doing essentially what you suggested, defining a set of indented classes that I switch between using <div class="math-level_n">, and then inserting my MathJax within them. The resulting source is not very easy on the eyes,  but it works well enough.

I am not very familiar with Tex, but I think that the algorithmic environment is what I'm looking for. I realize this isn't exactly math, but documentation often has need for both types of rendering. It would be a very useful extension for MathJax.

And by the way, the more I use it, the more I am impressed with MathJax. It is an amazing package.

Regards,
Charlie


To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.

Christophe BAL (via GMAIL)

unread,
Apr 28, 2017, 4:56:10 AM4/28/17
to mathja...@googlegroups.com

Hello.


The algorithm algorithm2e does a really good formatting of algorithms. This could be a source of inspiration.


On the other I think that it would be better to build a JS package which will be done for this and uses MathJAX when it is necessary.


Best regards.

-- 
Christophe BAL
Enseignant Agrégé de Mathématiques
Programmeur Python Amateur

Peter Krautzberger

unread,
Apr 28, 2017, 5:56:28 AM4/28/17
to mathja...@googlegroups.com
A quick google search yields a seemingly abandoned project https://github.com/tatetian/pseudocode.js.

Maybe that's a good place to start.

Best,
Peter.

To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
-- 
Christophe BAL
Enseignant Agrégé de Mathématiques
Programmeur Python Amateur

--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-users+unsubscribe@googlegroups.com.

Christophe BAL (via GMAIL)

unread,
Apr 28, 2017, 5:59:46 AM4/28/17
to mathja...@googlegroups.com

That's look great !


Thanks for sharing this.

Peter Krautzberger

unread,
Apr 28, 2017, 6:11:11 AM4/28/17
to mathja...@googlegroups.com
I forgot to share my source -- https://stackoverflow.com/questions/15994354/how-to-write-algorithms-pseudo-code-in-html

Other answers suggest using a modern templating engine, which sounds like a pretty easy idea as well.

Best,
Peter.

Reply all
Reply to author
Forward
0 new messages