Hello all,
I would really really love to have the ability to use the algorithmic package inside MediaWiki software. I am writing up the details of a bunch of algorithms, and so far I have found it extremely painful to do. If there is a better way to make my algorithms look beautiful, I'd love to hear it. For your convenience, here is a link that shows some nice output of the algorithmic package: http://en.wikibooks.org/wiki/LaTeX/Algorithms_and_Pseudocode
What needs to be done to add support for this? Is this something that can be done, or does it conflict with some design principle behind the current solution?
Thanks!
AJ
On 06/25/2010 07:31 PM, Adrien Guillon wrote:
I would really really love to have the ability to use the algorithmic package inside MediaWiki software. I am writing up the details of a bunch of algorithms, and so far I have found it extremely painful to do. If there is a better way to make my algorithms look beautiful, I'd love to hear it. For your convenience, here is a link that shows some nice output of the algorithmic package: http://en.wikibooks.org/wiki/LaTeX/Algorithms_and_Pseudocode
What needs to be done to add support for this? Is this something that can be done, or does it conflict with some design principle behind the current solution?
I'm not familiar enough with the texvc code to know what it would take to add support for the algorithmic package (and I'm not sure if anyone really is; that code is notoriously low on active maintainers).
However, I'd like to offer an alternative solution (or workaround): why not just do it in plain text? After all, that's what (pseudo)code mostly is. Bold and italic text are easily marked up in wikitext, and Unicode has quite a comprehensive set of arrows and other such symbols.
See a quick example here: http://en.wikipedia.org/w/index.php?oldid=370784718
I'm aware that the result isn't quite as pretty as the one produced by TeX; on the other hand, one thing my version has going for it is that it's actual text, not just an image of text.
The only slightly tricky part is indentation. For my example, I abused the <poem> tag; possible alternatives might include abusing leading colons (possibly too much indentation), manually inserting s (very laborious and hard to edit) or wrapping each line in a span with a margin (somewhat laborious, though easy enough to copy and paste). You could also just indent each line by at least one space and let MediaWiki format it as a code block if you didn't mind the side effects (monospaced font, funny background and border).
On Tue, Jun 29, 2010 at 9:23 AM, Ilmari Karonen nospam@vyznev.net wrote:
I'm not familiar enough with the texvc code to know what it would take to add support for the algorithmic package (and I'm not sure if anyone really is; that code is notoriously low on active maintainers).
It should be trivial. Just add a usepackage in the right place and whitelist the commands. Of course, this will cause a fatal error on any system where the algorithmic package isn't installed, but it shouldn't be too hard to set it up so that this is only triggered in equations that actually try to use the package -- there's already something like that for AMS.
On 29 June 2010 19:58, Aryeh Gregor Simetrical+wikilist@gmail.com wrote:
On Tue, Jun 29, 2010 at 9:23 AM, Ilmari Karonen nospam@vyznev.net wrote:
I'm not familiar enough with the texvc code to know what it would take to add support for the algorithmic package (and I'm not sure if anyone really is; that code is notoriously low on active maintainers).
It should be trivial. Just add a usepackage in the right place and whitelist the commands. Of course, this will cause a fatal error on any system where the algorithmic package isn't installed, but it shouldn't be too hard to set it up so that this is only triggered in equations that actually try to use the package -- there's already something like that for AMS.
I'd been hoping to do similar things in the next few days, as part of a clean up of the trivial bugs that have accumulated for texvc - adding new features is trivial, it's just if we want to change old ones that https://bugzilla.wikimedia.org/show_bug.cgi?id=16719 starts to get in the way.
Agreeing with Ilmari Karonen, I'd hugely prefer not to use LaTeX for algorithms, there are a large number of programming languages with defined (or at least reasonably widely agreed upon) semantics, all of which can be beautified by GeSHi, using a custom pseudo-code and then converting the text to an image seems like a huge step backwards in terms of making something easily readable by the largest number of people. Many modern (i.e. post 1990) languages are comparable to pseudo-code in conciseness, and it's usually possible to write algorithms that don't make use of less standard features of such languages.
Conrad
My research has come up with a much better package than algorithmic, the styles for "Introduction to Algorithms" is available at http://www.cs.dartmouth.edu/~thc/clrscode/. I've perused wikipedia a bit, and I really don't like how algorithms look there. The appeal of the use of LaTeX, is mostly for the use of boolean algebra and set theory symbols.... although sometimes other symbols like floor or ceiling would be highly useful.
I really like the pseudo-code style used in Introduction to Algorithms. I think that using an actual programming language to show an algorithm will hide the elegance of the algorithm itself, and introduce messy details. See for yourself: http://en.wikipedia.org/wiki/Ford-Fulkerson_algorithm#Python_implementation vs. http://www.mpi-inf.mpg.de/~sanders/courses/algdat03/maxflow.pdf (if you skim through that, you can see some very nice algorithm descriptions using mathematical symbols).
It would be nice if there was an <algo> tag which supported a subset of LaTeX specifically for the implementation of algorithms, suitably wikified. If you look at http://www.cs.dartmouth.edu/~thc/clrscode/clrscode.pdf it could be used as the basis for a simple algorithm markup. The other thing I like about using a pseudo-code style very similar to that of the one in Introduction of Algorithms, is the fact that most CS students have probably used that book... and are already comfortable with the syntax.
Some part of me thinks it is silly to introduce an <algo> tag though, because you get something very specific to solving one problem that isn't so useful to others. It would probably be best just to suitably adjust the LaTeX output so that you can directly implement your algorithms as shown in the above PDF.
AJ
On Tue, Jun 29, 2010 at 6:45 PM, Conrad Irwin conrad.irwin@gmail.com wrote:
On 29 June 2010 19:58, Aryeh Gregor Simetrical+wikilist@gmail.com wrote:
On Tue, Jun 29, 2010 at 9:23 AM, Ilmari Karonen nospam@vyznev.net wrote:
I'm not familiar enough with the texvc code to know what it would take to add support for the algorithmic package (and I'm not sure if anyone really is; that code is notoriously low on active maintainers).
It should be trivial. Just add a usepackage in the right place and whitelist the commands. Of course, this will cause a fatal error on any system where the algorithmic package isn't installed, but it shouldn't be too hard to set it up so that this is only triggered in equations that actually try to use the package -- there's already something like that for AMS.
I'd been hoping to do similar things in the next few days, as part of a clean up of the trivial bugs that have accumulated for texvc - adding new features is trivial, it's just if we want to change old ones that https://bugzilla.wikimedia.org/show_bug.cgi?id=16719 starts to get in the way.
Agreeing with Ilmari Karonen, I'd hugely prefer not to use LaTeX for algorithms, there are a large number of programming languages with defined (or at least reasonably widely agreed upon) semantics, all of which can be beautified by GeSHi, using a custom pseudo-code and then converting the text to an image seems like a huge step backwards in terms of making something easily readable by the largest number of people. Many modern (i.e. post 1990) languages are comparable to pseudo-code in conciseness, and it's usually possible to write algorithms that don't make use of less standard features of such languages.
Conrad
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
On 06/30/2010 06:14 AM, Adrien Guillon wrote:
I've perused wikipedia a bit, and I really don't like how algorithms look there. The appeal of the use of LaTeX, is mostly for the use of boolean algebra and set theory symbols.... although sometimes other symbols like floor or ceiling would be highly useful.
Unicode does have those; see http://en.wikipedia.org/wiki/Unicode_mathematical_operators_and_symbols
The main area where plain HTML + Unicode fails for mathematical typesetting is notation requiring fancy vertical layout, such as matrices, fractions or binomials. Algorithmic code rarely uses those, making plain HTML a feasible solution there.
On 06/30/2010 09:32 PM, Ilmari Karonen wrote:
On 06/30/2010 06:14 AM, Adrien Guillon wrote:
I've perused wikipedia a bit, and I really don't like how algorithms look there. The appeal of the use of LaTeX, is mostly for the use of boolean algebra and set theory symbols.... although sometimes other symbols like floor or ceiling would be highly useful.
Unicode does have those; see http://en.wikipedia.org/wiki/Unicode_mathematical_operators_and_symbols
Actually, the floor and ceiling symbols appear to be in the "miscellaneous technical" block:
http://en.wikipedia.org/wiki/Miscellaneous_Technical_(Unicode)
Okay, I've played around a bit with my wiki and unicode. It is indeed the best option. Resized text looks nice, and for my purposes this works quite well. Inserting the unicode text is a bit of a pain, since right now I am copying and pasting the text... but I recently found that there are entity definitions, like ∉ which make this much easier to edit.
The only thing to do now, is to check how indentation is going to work, along with line numbering. I'll play with it a bit more, and I will see about sharing an example of a typeset algorithm here.
On Wed, Jun 30, 2010 at 2:37 PM, Ilmari Karonen nospam@vyznev.net wrote:
On 06/30/2010 09:32 PM, Ilmari Karonen wrote:
On 06/30/2010 06:14 AM, Adrien Guillon wrote:
I've perused wikipedia a bit, and I really don't like how algorithms look there. The appeal of the use of LaTeX, is mostly for the use of boolean algebra and set theory symbols.... although sometimes other symbols like floor or ceiling would be highly useful.
Unicode does have those; see http://en.wikipedia.org/wiki/Unicode_mathematical_operators_and_symbols
Actually, the floor and ceiling symbols appear to be in the "miscellaneous technical" block:
http://en.wikipedia.org/wiki/Miscellaneous_Technical_(Unicode)
-- Ilmari Karonen
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Okay, I'm not sure how to get the formatting quite right... but here is a sample:
'''{{Smallcaps| Average}}''' (numbers) # total = 0 # '''for''' number ∈ numbers '''do''' #: total = total + number # '''end for''' # return numbers / {{Smallcaps | Length}}(numbers)
this isn't *too* bad to write... I want to figure out how to get explicit spacing with the numbering... and then I'll try it on a collection of algorithms that I need to wikify and report back the results.
Does anyone know how to get the numbering to work better?
AJ
On Fri, Jul 2, 2010 at 2:37 PM, Adrien Guillon aj.guillon@gmail.com wrote:
Okay, I've played around a bit with my wiki and unicode. It is indeed the best option. Resized text looks nice, and for my purposes this works quite well. Inserting the unicode text is a bit of a pain, since right now I am copying and pasting the text... but I recently found that there are entity definitions, like ∉ which make this much easier to edit.
The only thing to do now, is to check how indentation is going to work, along with line numbering. I'll play with it a bit more, and I will see about sharing an example of a typeset algorithm here.
On Wed, Jun 30, 2010 at 2:37 PM, Ilmari Karonen nospam@vyznev.net wrote:
On 06/30/2010 09:32 PM, Ilmari Karonen wrote:
On 06/30/2010 06:14 AM, Adrien Guillon wrote:
I've perused wikipedia a bit, and I really don't like how algorithms look there. The appeal of the use of LaTeX, is mostly for the use of boolean algebra and set theory symbols.... although sometimes other symbols like floor or ceiling would be highly useful.
Unicode does have those; see http://en.wikipedia.org/wiki/Unicode_mathematical_operators_and_symbols
Actually, the floor and ceiling symbols appear to be in the "miscellaneous technical" block:
http://en.wikipedia.org/wiki/Miscellaneous_Technical_(Unicode)
-- Ilmari Karonen
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
wikitech-l@lists.wikimedia.org