# WorkingWiki/LaTeXML Notes

### Notes on using LaTeXML with WorkingWiki

• When you import a latex document, it tends to complain about a lot of missing packages. This is because LaTeXML doesn't actually read latex style files, only the .ltxml files it provides to emulate the known style files. This should be considered harmless in itself — the problem is if something you need turns out to be undefined, like the \subfig command or something. The full solution to this is to write a latexml style file to emulate the .sty or .cls file, but a reasonable workaround is often to stick a \providecommand into your .tex file, after the style file is included but before it's used. That gives a definition of the problem command if there isn't one, i.e. when latexml is blundering its way through the file, but doesn't do anything in the case that it has been successfully defined, i.e. when latex is reading the document with the style files included. For example, \providecommand\subfloat[2][]{#1\\#2} allows latexml to handle a line like \subfloat{graphics code}{subfigure caption} without choking. It doesn't actually make a subfigure, it just puts the graphics and then the text, so you can have an approximate rendition in the wiki.
Another workaround that has proved useful is using the --includestyles flag to latexml: this gets it to read .sty and .cls files directly, but is dangerous, because a lot of them are full of low-level TeX commands that it can't handle. You can activate this flag by including in your makefile: LATEXMLFLAGS=--includestyles.
• I've had some issues with subscripts and superscripts not being super well aligned in equations that include a vertical bar, as in f(u|v). This apparently is because LaTeXML's parsing gets confused and doesn't know to treat the | as if it were a comma. This problem is resolved by including \usepackage{latexml} in the top of the document, and then putting "\lxPunct{|}" in place of "|". That tells it it's a punctuation mark, and for whatever reason, fixes everything up.
• \cal and \mathrsfs are hard to do with current web browsers, apparently. We currently have a situation where they're working in Firefox but probably not in IE and Opera.
• spacing commands in math don't do anything. Would be nice to be able to use "\ " and "~", but it might be a while.

### For the extension programmer (me -lw)

• Is there a way to provide \wikinote (a note to appear in the wiki but not in the pdf) or anything else that appears in LaTeXML but not in regular latex, without using \usepackage{latexml}? That would be better, so we can export the latex project to computers that don't have the latexml package.

### Questions for Bruce Miller (LaTeXML author)

• How to detect LaTeXML vs. latex from within the paper?
• Not sure I understand this question; is \iflatexml the answer? JoDu 13:56, 19 April 2013 (UTC)
• probably, but you can only use \iflatexml on systems that have latexml.sty, i.e. systems that have latexml. Like the question above, ideally I'd like to be able to write documents that work on a standard latex installation, but can also sense when latexml is in use and do something special.
• How to add commands that output custom HTML — I guess I can't do it without writing an XSLT file?