skip to main content.

i was thinking on using latex in maybe some blog entries, maybe here or maybe somewhere else. so i decided to see what existing plugins there are. after a bit of searching, i stumbled over wp-latex, which is apparently also used by wordpress.com. unfortunately, it has a kind of clumsy syntax (“$latex formula$” instead of simply “$formula$”). and it has no support for display style formulae, i.e. something centered in its own line, as opposed to inline formulae which try to fit neatly into the text.

so i tried to fix that. and it worked out, and i can still use a “normal” $ by appending a blackslash in front of it. well, euler's identity is e^{i \pi} + 1 = 0, as simple as that. if you want to see something more complicated:

let K be a number field or an algebraic function field. then, we have the following commutative diagram with exact rows and columns:

\xymatrix{ & 0 \ar[d] & 0 \ar[d] & 0 \ar[d] & \\ 0 \ar[r] & \calO^* / k^* \ar[r] \ar[d] & \Div^0_\infty(K) \ar[r] \ar[d] & T \ar[r] \ar[d] & 0 \\ 0 \ar[r] & K^* / k^* \ar[r] \ar[d] & \Div^0(K) \ar[r] \ar[d] & \Pic^0(K) \ar[r] \ar[d] & 0 \\ 0 \ar[r] & K^* / \calO^* \ar[r] \ar[d] & \Id(\calO) \ar[r] \ar[d] & \Pic(\calO) \ar[r] \ar[d] & 0 \\ & 0 & H \ar@{=}[r] \ar[d] & H \ar[d] & \\ & & 0 & 0 & }

here, T simply denotes the cokernel of the map \calO^* \to \Div^0_\infty(K) which assigns to every unit \varepsilon \in \calO^* its principal divisor (\varepsilon); in particular, T \cong \Div^0_\infty(K) / (\Princ(K) \cap \Div^0_\infty(K)). finally, H denotes the cokernel of the degree map \Div(K) \to \G, where in the number field case, \G = \R, and in the function field case, \G = \Z.

this is written as follows:

 1 let \$K\$ be a number field or an algebraic function field. then,
 2 we have the following commutative diagram with exact rows and 
 3 columns: 
 4 \$\$\xymatrix{ & 0 \ar[d] & 0 \ar[d] & 0 \ar[d] & \\ 0 \ar[r] & 
 5 \calO^*  / k^* \ar[r] \ar[d] & \Div^0_\infty(K) \ar[r] \ar[d] & 
 6 T \ar[r] \ar[d] & 0 \\ 0 \ar[r] & K^* / k^* \ar[r] \ar[d] & 
 7 \Div^0(K) \ar[r] \ar[d] & \Pic^0(K) \ar[r] \ar[d] & 0 \\ 0 \ar[r]
 8 & K^* / \calO^* \ar[r] \ar[d] & \Id(\calO) \ar[r] \ar[d] & 
 9 \Pic(\calO) \ar[r] \ar[d] & 0 \\ & 0 & H \ar@{=}[r] \ar[d] & H 
10 \ar[d] & \\ & & 0 & 0 & }\$\$
11 here, \$T\$ simply denotes the cokernel of the map \$\calO^* \to
12 \Div^0_\infty(K)\$ which assigns to every unit \$\varepsilon \in 
13 \calO^*\$ its principal divisor \$(\varepsilon)\$; in particular, 
14 \$T \cong \Div^0_\infty(K) / (\Princ(K) \cap \Div^0_\infty(K))\$. 
15 finally, \$H\$ denotes the cokernel of the degree map \$\Div(K) \to 
16 \G\$, where in the number field case, \$\G = \R\$, and in the 
17 function field case, \$\G = \Z\$.

note that this example also shows a problem: namely, the vertical alignment of the inline formulae sucks bigtime. let's see how to fix this...

posted in: math www
tags:
places:

comments.

felix wrote on february 28, 2009 at 22:06:

oh, and the formulae graphics are not transparent. well, maybe i’ll try to fix that later…

andreas wrote on february 28, 2009 at 22:40:

also, it is very strange to read the entry in a feed reader using black fonts on white background instead of the other way around in your blog. the diagram is okay, but the in-line formulas are hardly readable.

felix wrote on march 01, 2009 at 00:12:

that’s true, but feed readers screw up most things anyway which are not plain text. so why care? ;)
well, one possibility is to modify the latex plugin to return different code (namely: links to others pictures) in case the test is requested for a feed and not for displaying on the site itself. i don’t know what’s the best way to solve this in wordpress…

felix wrote on march 01, 2009 at 01:01:

well, that’s changed. was easier than i thought to change, the hardest part was testing whether it really changed.

felix wrote on may 04, 2009 at 01:41:

i just upgraded the wp-latex package and put my own modifications mostly into an own plugin. now also formulae in comments should work, like $e^{i t} = \cos t + i \sin t$.

felix wrote on may 04, 2009 at 01:46:

note that the formulae now have transparent background, whence they probably suck if your feed reader shows the pngs on black background :)

spielwiese. » Blog Archive » another project. wrote on may 04, 2009 at 05:52:

[...] which interest me, for example things related to my research. the formulae will be rendered with latex; mathml is simply unuseable so far. an example post shows a feature with i added to my wp-latex [...]

felix wrote on may 05, 2009 at 02:51:

another update. i added support for align* math environments to the latex plugin. this required hacking the latex renderer part of the wp-latex plugin; i just did that for the dvipng part. in case anyone is interested in my version of the plugin (including my wrapper plugin), contact me.