Want to take part in these discussions? Sign in if you have an account, or apply for one below
Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.
would it be possible to set up an nLab page with something like an upload box or a blank text box where one can drop in a latex file cick a button and get back its itex conversion? I see that Andrew’s script is still in a developing stage, but it alredy works very nicely (much better than by-hand conversion), so maybe such an automatic conversion page can already be set up.
Yes, it would be possible, but no I’m not going to do it. If someone else wants to take the script and host it, then that’s up to them.
The reason is simple: since TeX is actually a programming language, it is really easy to tie it up in knots. \def\a{\a}
will do it. This is a major argument for not having \newcommand
in iTeX, by the way (the other is to do with ensuring ease of editing others’ work).
On the other hand, I am quite happy to make my script publicly available, and to have proper “stable” and “unstable” versions. It is a perl script so all you need is a working installation of perl in order to use it.
(Also, as it is still very much at the development stage, it isn’t really possible yet to take a LaTeX document and just drop it in; one starts by doing that and then working backwards to implement all the macros that were used but that haven’t been put in to the script yet.)
The reason is simple: since TeX is actually a programming language, it is really easy to tie it up in knots.
I see the point.
On the other hand, I am quite happy to make my script publicly available, and to have proper “stable” and “unstable” versions. It is a perl script so all you need is a working installation of perl in order to use it.
good! so, Andrew, could you please make a beta version available? (or at least send me a copy via email.. :) ) thanks!
I too would find such a script very useful. It’d be great if you could make it available for download.
With mild apologies for taking a while to do this, I’m pleased to announce the alpha release of this script. You can download it, and read some details about what it can (and can’t) do at the following page:
http://www.math.ntnu.no/~stacey/HowDidIDoThat/LaTeX/LaTeX2iTeX.html
Comments, bugs, and other random witterings can be made here, of course.
Thanks for this. One minor bug – the latex2itex.pl
script refers to the module tex
instead of Text::TeX
. I changed it and the errors from Perl went away, but I get no output at all (the program seems to hang) from a small-ish LaTeX file that uses external packages. Does the script choke on commands (like usepackage
) that it doesn’t recognise, or could I have tied it up in knots some other way?
Whoops! Thanks for the bug report on the location. I originally had everything in the same directory, and then I decided that I ought to put things in their “standard” place. Obviously, I didn’t move everything.
No, external packages aren’t supported. In particular, the \usepackage
command isn’t defined. It ought to complain when it reaches something it doesn’t understand rather than just hang. Did you pass the file to it as standard input, or just on the command line?
latex2itex.pl filename
won’t work, it has to be
latex2itex.pl < filename
(I ought to fix it so that the first one does work, I’ll put that on the TODO list.)
Regarding packages, the webpage says:
In particular, importing a standard package file is almost certainly not going to work. (Indeed, at present, the \usepackage command is not implemented, though the \input primitive is.) The issue is less about the input as the output: it is not possible to automatically know what the correct output should be for the commands from an arbitrary package.
But that’s not to say that one couldn’t figure out what a package should do and implement a substitute. What packages are you trying to use?
It’s also worth saying that most of the amsmath
stuff is implemented because it’s already supported by iTeX so gets passed straight through.
Please email (or paste here if it’s short enough) me any file that it chokes on so that I can see if it chokes because of something that ought to be implemented, or something that oughtn’t.
It seems my impatience was my undoing – the script runs OK, but quite slowly. It takes about 45 seconds to process the latex.sty
and itex.sty
files alone. I’ll do a bit more experimenting and let you know how it goes.
Yes, I forgot to mention that it is incredibly slow. There’s a couple of places I know about that I need to implement a bit better to speed it up, but this is never going to be a fast system: it’s a scripting language, not a compiled program.
I have a new approach to this problem. There is a saying:
The only thing that can parse TeX is tex.
In writing the Perl script, I had to write a style file so that it would know what to do with the itex commands (ie pass them through). I realised that that was actually valid TeX (almost) and so could be run on an ordinary LaTeX document. With a few modifications, that’s what I’ve now done. By sending the result through pdftotext
, I get a text file which can then be pasted in to the nLab. The first experiment was equivariant tubular neighbourhoods.
I finally think that I’ve hit upon the right approach to this problem! (It’s also much, much faster than the Perl script.)
I’ll post the style file, with instructions, soon.
Just to make sure I understand what this means – you would write a LaTeX document, then by changing the style file you would cause it to compile, not to the way that LaTeX ouptut usually looks, but instead to iTeX input?
Yup!
Genius, sheer genius!
Okey-dokey, my LaTeX package is now on my webpage. It is very much alpha software, but it’s what I used to do Tom’s article. What you see on converting latex to itex (doriath) is the raw output. I should say, to be absolutely clear, that I had to modify some bits of Tom’s article to make the itex output correct, but I could do those modifications before running it through latex, and also in such a way that it is also possible to produce the original PDF with only one change.
If anyone has a Wordpress blog, there’s rudimentary support for Wordpress as well (partly because of the new TeX blog). It does the basics, but not maths as yet because I don’t know what output formats I should do first - so if someone here does have a Wordpress blog and would like to use this package to produce their blog posts then tell me what maths system you use and I’ll take it from there.
Support for other systems is certainly possible to add (such as the cafe!).
Here’s the link: http://www.math.ntnu.no/~stacey/HowDidIDoThat/LaTeX/internet.html. The content of that page was also written using this package.
Lieven Le Bruyn would be interested in Wordpress/LaTeX interaction - you might drop him a line.
1 to 15 of 15