Help talk:Displaying a formula
From Meta
Adapted from en:Wikipedia:TeX markup. --Maveric149 00:50, 7 Sep 2003 (UTC)
[edit] Math formulae question
(from the village pump)
Hi. I hope this belongs here. If not, please move elsewhere. My question is whether it is possible to modify the following math formula in such a way that the equations in each row are left-aligned:
Thanks for any help. -- Timwi 13:52, 13 Feb 2004 (UTC)
- Well, the original author (not you?) has used a load of spacing ("\ " and "\qquad") to force it to be right-aligned (it goes to the centre otherwise), so to put it on the left, you need to move that spacing to after rather than before the text:
- I suspect there's a better way of doing this though - for one thing, this isn't really a matrix, so probably shouldn't be marked up as one - but I don't know much about TeX, I'm afraid. Also, doesn't the last line equal the second one, rather than equalling the left-hand side, as implied? But I'm going outside the scope of your question now. - IMSoP 16:15, 13 Feb 2004 (UTC)
- What you want is an eqnarray (or eqnarray* to avoid numbering every line). That does what you need without the full matrix markup. - Frodo42
<math> \begin{align} \log_2(n!) = &\log_2(n) + \log_2(n-1) + \log_2(n-2) + ... + \log_2(1) \\ < &\log_2(n) + \log_2(n) + \log_2(n) + ... + \log_2(n) \\ = n \log_2(n) \end{align} </math> Which gives:
-
(Not a meta-wiki member, just a modereately heavy user of AMS-LaTeX.
-
-
- IMSoP wishes to note that the above was added by "Recentchanges", presumably as a suggested solution to the problem. Also, "Theresa knott" "suggested" replacing "..." with "\cdots". Initially, both users decided to edit other people's comments, and I reverted them as I feel this is a breach of etiquette. - IMSoP 16:54, 13 Feb 2004 (UTC)
-
-
- Using matrices to align multiline equations is standard TeX practice, AFAIK. See Wikipedia:TeX markup for details. As for getting them to align to the left, why not use "
&"?
- Using matrices to align multiline equations is standard TeX practice, AFAIK. See Wikipedia:TeX markup for details. As for getting them to align to the left, why not use "
-
- Not perfect, but a little closer to what you want... -- Wapcaplet 19:32, 13 Feb 2004 (UTC)
-
-
- While I notice that this is an old discussion, this may be of use to others, it is the proper method of doing this:
-
Insert non-formatted text here

Thanks for all your suggestions, although I'm afraid to say I find none of them satisfactory. I didn't add those "\ "s and "\qquad"s; when I inserted the formula, it was all centered. Thanks for your help anyway. -- Timwi 22:29, 13 Feb 2004 (UTC)
- I added the \'s (i accidently added the spaces to the wrong side). Sorry about that. I think thats the only way to do what you want, however. --Ed Senft! 22:43, 13 Feb 2004 (UTC)
Using matrices to align equations is long-deprecated in the field of mathematics. The standard method is using \begin{align*}, as the user above noted, which is part of the AMS Math package. Unfortunately, Wikipedia does not seem to currently support this. --Delirium 02:04, Feb 14, 2004 (UTC)
I've also commonly come across the use of \begin{array}{rrr} (where the rrr are the alignments of various columns) but that is also part of the AMS package not supported. Odd bloke 03:43, 9 January 2006 (UTC)
[edit] Rightleftharpoons
Why is <math>\rightleftharpoons</math> giving a parser error? According to my TeX-book that is a valid plain TeX symbol already.

- It fails because TeX markup is based on some strange, unspecified TeX flavor. Many things from The TeXbook don't work. I can offer no suggestion for harpoons.
- —Herbee 12:24, 4 Mar 2004 (UTC)
[edit] Small fractions
Is there a way to make small fractions? The standard fractions look too big in many situations, e.g.,
What I'm thinking of is a fraction where the numerator and denominator are typeset in the same font size as superscripts and subscripts.
—Herbee 02:49, 3 Mar 2004 (UTC)
I actually found several ways to produce small fractions. The best I could do is:
- s = {}^1_\overline2 a t^2
This works typographically, but it obscures the mathematical meaning. It might frustrate conversion to MathML, for instance. This is not the way to do it. I'll keep looking for something better.
—Herbee 12:10, 3 Mar 2004 (UTC)
-
- Hi Herbee, one way to make the fraction smaller is to use \textstyle (I think that's the command). However WP's TeX markup doesn't seem to support \textstyle or \displaystyle -- see my comment on the latter below. Happy editing, Wile E. Heresiarch 02:40, 26 Mar 2004 (UTC)
A less hacky way of doing this (which I'm sure is more robust than the above) is now on the help page
- s = \begin{matrix} \frac{1}{2} \end{matrix} a t^2

PizzaMargherita 19:50, 19 November 2005 (UTC)
[edit] Align math with normal text flow
That's whay I'd call "kick myself in the balls": how to align

with normal text flow. Since we have no SPAN I had to DIV it, and even that sucks since <IMG align="middle"> would be probably the easiest way. But it would require <math align="whatever"> form, right? :) But until then, feel free to use "my way" if you need it. I put it in the article, but if someone doesn't like it, it's getting archived here :) --grin 20:52, 3 Mar 2004 (UTC)
- Cool! But does it render the same in all browsers? For me (IE 6) it looks just about right. By the way, I noticed that inlining fails (again, IE 6 *sigh*) if there is an empty line just above the line with the equation.
- —Herbee 12:15, 4 Mar 2004 (UTC)
Did something just change, so that this <div> .. </div> business is no longer necessary? If so, I've got a lot of manually-aligned math to fix. --Wwoods 09:11, 30 May 2004 (UTC)
[edit] Rendering different between meta and WP?
The a^{2+2} renders (in HTML) with an extra hyphen at the end on Wikipedia, but not on meta. Why? - Omegatron 18:04, 11 Mar 2004 (UTC)
- This was fixed. - Omegatron 19:14, 12 Jul 2004 (UTC)
[edit] Big fractions
Hi, I notice that using \frac in displayed equations makes the numerator and denominator smaller, and in a lot of cases that doesn't look right (IMHO). For example --
I sometimes put \displaystyle into equations like that to make the numerator and denominator bigger, but the WP TeX processor doesn't seem to understand that. Does anyone have a solution to this problem? Thanks for your help, Wile E. Heresiarch 02:40, 26 Mar 2004 (UTC)
[edit] Caret symbol (^)
Is there a way to place a caret symbol over a character, as for unit vectors in physics? Smack 02:55, 13 Apr 2004 (UTC)
- Try \hat a:
. If you need a hat over more than one letter, try \widehat{foo}:
or
. Grendelkhan 17:35, 19 Apr 2004 (UTC)
[edit] Proportional to


There is still no "proportional to". A few other very important things are missing. Who do we complain about this to? - Omegatron 16:32, 1 Jun 2004 (UTC)
- Probably should send bug report to bugzilla.wikipedia.org ; left message on Talk page. -- Creidieki 22:19, 17 Aug 2004 (UTC)
[edit] Mathcal extra symbols?
There's a few extra symbols if you do lowercase mathcal. I dunno if they are useful:
[edit] Extra characters
\mathcal {1234567890abcdefghijklmnopqrstuvwxyz}

[edit] Tilde is funny
\mathcal {~}
<math>
\mathcal {~}
</math>
- The above code was originally inserted inline by Omegatron. Apparently it produces a form-feed character, which is rendered as a very large white .png. -- en:Aponar Kestrel (talk) 01:54, 16 Sep 2004 (UTC)
I think most are already available though. - Omegatron 14:06, 10 Jun 2004 (UTC)
[edit] Forced PNG
Do we want to force the examples on this page to render as PNG, leave them the way they are, or maybe put both in separate columns? - Omegatron 17:20, 30 Mar 2004 (UTC)
- Someone forced PNG for a few examples. Do we want it done for all of them? If no one replies, I am going to (somehow) show both "natural" and forced PNG for the ones that render in HTML. - Omegatron 19:17, 12 Jul 2004 (UTC)
Sorry, I just saw this. I've removed the trailing \, from the formulae that already contained one, and therefore didn't need to force PNG. PizzaMargherita 20:03, 19 November 2005 (UTC)
For others having this issue, the solution can be found here:
http://en.wikibooks.org/wiki/Help:Formula#Forced_PNG_rendering
[edit] Forced PNG rendering
above mentioned section is wrong. \approx will not force rendering. have a look at the table [1]. -- 84.56.217.214 09:43, 31 October 2007 (UTC) (user: de:lustiger_seth)
[edit] Formatting
how do I keep the fractions from appearing so small? perhaps some compromise between the size shown for them and the normal size rendered in the PNGs would be perfect. -ub3rm4th <-- at en.wikipedia, obviously not meta.wikipedia
[edit] Missing Symbol
How do you write a "therefore", and come to think of it, other similar symbols? For clarification, I mean the three small dots forming a triangle. Also, the "because", which is inverted. Grab a logic text that uses symbols. I want all of those. -ub3rm4th <-- at en.wikipedia, obviously not meta.wikipedia
- ∴ ∵ ∴ ∵ See the links at Help:Special characters.--Patrick 02:58, 19 Aug 2004 (UTC)
-
- I meant in the TeX, so I can use it in my equations.
-
-
- Here's a list of all symbols. The official ones are \therefore and \because but Wikipedia doesn't seem to support them:

- Here's a list of all symbols. The official ones are \therefore and \because but Wikipedia doesn't seem to support them:
-
-
-
- Looks like a bug report is in order.
-
[edit] simpler nonitalics
It was pointed out that something like:
should technically be:
since things like A and source are not variables, and only variables should be in italics. Of course, adding \mathrm or \mbox to every little thing makes the code unreadable and super long. Are there shorter alternatives? Could they be added to the TeX program? - Omegatron 04:22, 14 Sep 2004 (UTC)
- To the best of my knowledge, that's the only way to do it. --Aponar Kestrel (talk) 01:50, 16 Sep 2004 (UTC)
[edit] Antialiasing
So I've noticed that the images produced seem to be inconsistent in style. For example,
and
have been antialiased inconsistently. Playing around with \, or \! usually solves the problem, but it's rather inelegant. Does anyone know what causes this, and if it can be fixed? --Aponar Kestrel (talk) 01:50, 16 Sep 2004 (UTC)
- I think it has to do with the fact that the renderer has been changed, but images are still cached (on the wikipedia side, not your machine) from the old configuration. I've seen this asked about before. I don't even know who runs this stuff. It seems like they could regenerate all the old ones for consistency. - Omegatron 00:58, 19 Sep 2004 (UTC)
[edit] Examples section
All of the examples in the examples section are basically the same, and don't show much more than the above examples. Can we remove a bunch of them and then add some more that show other things like integrals or crazy formatting options. Try to show several features in one equation, in other words. - Omegatron 00:58, 19 Sep 2004 (UTC)
There's lots of math at my site - www.exampleproblems.com.
I totally agree with Omegatron, a lot of examples can be nuked and won't be missed. Examples in this article should not be added just because they look cool, especially if they are wrong (see recent corrections). If somebody wants to add an example, I think they should
- Make sure it's correct and that they know what they are doing - this is a tutorial
- Make sure it brings in new value to the reader - i.e. there are features that are not covered by previous examples.
- Possibly provide a meaningful title (other than "Example")
Thanks PizzaMargherita 18:41, 2 November 2005 (UTC)
I removed the examples that didn't add any new value. Some of them are borderline cases, so I left them in. PizzaMargherita 20:06, 19 November 2005 (UTC)
[edit] Inserting equations inline
Inserting equations inline with text without any additional tags looks fine to me, besides the obvious font and size changes.
Without additional tags:
The magnitude of the analytic signal,
, will return the
With the font tag stuff it looks wrong:
The magnitude of the analytic signal,
, will return the
[edit] Special subscripts break within matrices and fractions
"Special" subscripts and superscripts, such as with \sum or \lim, break within containers such as \begin{matrix} or within an \over{}.
For example:
| \sum_{i=1}^n | ![]() |
| \begin{matrix}\sum_{i=1}^n\end{matrix} | ![]() |
| \lim_{n\to0}f(n) | ![]() |
| {\lim_{n\to0}f(n)} | ![]() |
| x\over{\lim_{n\to0}f(n)} | ![]() |
- KeithTyler 20:34, 21 Sep 2004 (UTC)
This is expected TeX behaviour. There are four math styles in TeX:
- display - for standalone formulae
- text - for in-line formulae as well as (it would seem) inside \matrix and \frac
- script - for sub/superscripts
- scriptscript - for higher-order sub/superscripts
You can force TeX to use each of them with the following commands, respectively
- \displaystyle
- \textstyle
- \scriptstyle
- \scriptscriptstyle
Unfortunately, at present they are not supported. Hence the need of recurring to the "matrix" trick to force small fractions—i.e. force text style in a display environment. I myself would be interested to know how to force display style in a text environment. We can then add both tricks to the help page. PizzaMargherita 20:31, 19 November 2005 (UTC)
[edit] is there a shortcut for differential d in roman?
In astronomy journals, e.g. look up any preprint which is openly published at e.g. http://arxiv.org/list/astro-ph/new and download an article in the format you like (ps, pdf, compile from latex source,...), you'll see that most astronomers (at least those who want to avoid having their texts retyped from scratch by publishers with lots of creative errors introduced) will follow the official convention for differential d which, AFAIR, is supposed to be in a roman, not italic, font, because it's to be more like a function than a variable.
Anyway, my question is: is there an easier way to do this than with \mbox?
{\mbox{d} \over \mbox{d} y} \left({\mbox{d} \over \mbox{d} x} x^2 \right) = 0

is a bit heavy in typing all those mboxes...
priority:low (Sure, it's not really that important, just a question of convenience.) Boud 12:38, 3 Oct 2004 (UTC)
I thought little-delta (\partial) was the standard way to do differentials, e.g.:

- KeithTyler 23:42, 8 Oct 2004 (UTC)
Those are parital differentials, Keith. They're talking about the 'd' for a full derivative. -Todd.
In LaTeX I define:
\newcommand{\ud}{\mathrm{d}}
Then I just use \ud
I would like some help. I was trying to put in K = ([C]^c[D]^d)/([A]^a[B]^b)(hope you understant) but I keep getting errors. If anyone can help, please put the correct formula in [2]
[edit] Request: Higher quality math font
My website is math-intensive, and I'd like to upgrade my font to a higher quality one with super smooth integrals. Even Green's formula looks bad with this font.
http://www.exampleproblems.com/wiki/index.php?title=PDE8
-Thanks -Todd Smith
- What don't you like about it? - Omegatron 17:49, 24 Jan 2005 (UTC)
Well, here's the best scan I could get for a comparison:
http://www.exampleproblems.com/wiki/index.php?title=Talk:PDE9
But I can imagine even sharper, smoother images for each symbol.
-Todd
- I think the font is pretty nice, except
. What does "mbox" mean, anyway?- Omegatron 21:54, 26 Feb 2005 (UTC)
[edit] How would I be able to produce the Å in mathematical formula's ?
I need to reproduce the Å symbol in a math formula, I believ that in TeX it is \AA, how is it done in <math></math> tags? --Riaan 12:56, 18 Mar 2005 (UTC)
- We probably don't have that symbol.

- Yeah. We didn't have \propto for a while, either. I don't know why. You can complain about it. - Omegatron 15:43, 18 Mar 2005 (UTC)
- Tried the following, but none are really satisfactory:
- <math>\dot \mathrm{A}\!\,</math> gives

- <math>\mathrm{A}\!^\circ\!\,</math> gives

- <math>\mathrm{A}\!\!^\circ + b\!\,</math> gives

- <math>\mathrm{A}\!\!\!^\circ + b\!\,</math> gives

- Urhixidur 13:12, 2005 Mar 24 (UTC)
- Looks like it exists now, but the ring is off-center. <math>\AA</math>:
. maybe <math>\mathrm{\AA}</math>:
? - Omegatron 15:21, 3 Jun 2005 (UTC)
This problem is old (formula engine not rendering non-standard characters, albeit they exist in the font), and it has been pending for ages. Ramir 06:23, 23 March 2006 (UTC)
[edit] Strike inside TeX
Are there any way to add strikes (<s></s>) inside a TeX markups? I'm trying to explain reducing in fractions. -- WB 08:33, 21 Mar 2005 (UTC)
- If not, you might be able to kludge something with negative spaces?

- If it was supported, it would look like this?
- Failed to parse (unknown function\strikeout): \strikeout {foo}
- Failed to parse (unknown function\sout): \sout {foo}
- Failed to parse (unknown function\xout): \xout {foo}
- - Omegatron 14:41, Mar 21, 2005 (UTC)
Strikethroughs would also be welcome for en:Units conversion by factor-label. Superm401 | Talk 02:56, 15 December 2007 (UTC)
[edit] Dotless j
Is this suppored by Wikipedia as I think it is a part of Latex (not that for the life of me I can remember what the hell the code for it is)...
The reason I want it is as
looks a bit weird as its normal for j to lose its dot when something else goes on top.
Thanks for any help. --84.13.215.133 19:04, 25 Mar 2005 (UTC)
- \imath gives

- and
- \jmath gives

- So you can use
- \vec \imath which gives

- but not
- \vec \jmath which gives

- Looks like it lacks of DOTLESS J
- Xmlizer 13:14, 2 Apr 2005 (UTC)
-
- That's right, \jmath is a valid TeX command but it's not supported here for some reason. PizzaMargherita 13:14, 19 November 2005 (UTC)
[edit] Inequalities?
Is it possible to render the "is not equal to" sign, in TeX markup? I'm not even sure how to make it in HTML... Phoenix-forgotten 23:37, 21 May 2005 (UTC)
. Done by <math>a \neq b</math> \Mike(z) 12:53, 3 Jun 2005 (UTC)
[edit] Why do standard HTML characters force PNG ?
I wonder why people did not (yet) add symbols like \in (∈), \infty (∞),... to the list of things that can be easily translated to HTML.
Also, I wonder why so much effort is made in truncating some TeX capacities, e.g. the \limits directive (to put something under a \mathop{=}, e.g.) or \textstyle etc. 194.199.97.94 17:01, 24 May 2005 (UTC)
- I prefer writing inline formulae with
<math>tags instead of doing it by hand for various reasons (see Help:Formula#TeX_vs_HTML). It is very tiresome that some very simple TeX symbols are not translated into HTML, such as\dots,\cdots,\dotand similar symbols. Is there any chance this might be fixed? Can I help in some way? Klem fra Nils Grimsmo 21:53, 14 December 2006 (UTC) - I agree those characters should be translated into the HTML character references. --70.131.218.104 01:29, 31 December 2006 (UTC)
- My settings are "Recommended for modern browsers" which I assume means "has Unicode font support", or else I would choose "HTML if very simple or else PNG". I just wanted to clarify that I understand that not all people have Unicode fonts. --70.131.218.104 06:38, 5 February 2007 (UTC)
[edit] Arrows for chemical equations
I wonder if Tex has arrows for chemical equilibrum equations? That is:
-----> -----> --> <-- <----- <------
Longer arrow to the right
-
-
- Equally long arrows to both directions
-
-
-
- Longer arrow to the left?
-
-
-
- Equally long arrows to both directions
-
--Samulili 20:29, 31 May 2005 (UTC)
You really need \stackrel (not supported), but try this as a starting point:
It's horrible, I know. I'm sure there are dedicated LaTeX packages out there, presumably not supported at present. Have a look at ppchtex. PizzaMargherita 13:52, 20 November 2005 (UTC)
[edit] Sorry
I accidentally changed the page - should be back to normal. Sorry
[edit] xypic
can we expect xypic support anytime soon? would be awfully nice. ---bgohla
- I second this request. Actually, anything that supports commutative diagrams would be awesome. Who are the right people to be asking (read: hassling) about this? Dmharvey 24.60.52.22 10:32, 30 Jun 2005 (UTC)
-
- You need support for package amscd. Alternatively, you may be able to manage with matrix and \stackrel (not supported) and stuff. For feature requests, see Help:Formula#Bug_reports. PizzaMargherita 13:11, 20 November 2005 (UTC)
[edit] Maynard Handley's suggestions
- Moved here from Help:Formula. -- Jitse Niesen 13:51, 4 August 2005 (UTC)
[edit] HOW TO MAKE TRANSPARENT PNGs
(MediaWiki developers. You should roll this into the released versions ASAP. It works and it is easy.)
In the file render.ml in the wiki/math directory, change the third line to
let cmd_convert tmpprefix finalpath = "convert -quality 100 -density 120 -matte -fuzz 1% -fill None -opaque White " ^ tmpprefix ^ ".ps " ^ finalpath ^ " >/dev/null 2>/dev/null"
Note that we have told convert to apply the commands -matte -fuzz 1% -fill None -opaque White to the conversion. This gibberish has the effect of converting whitespace in the png image to transparency. You will then have to make again.
If you have built up a cache of images in wiki/images/math, you may have to throw them away so that the wiki recreates them, now with transparency. (Maynard Handley)
Hmm... I was trying to make these changes on my wiki, the Knot Atlas, but only got this far before running into trouble. The images produced were blurry and black, like this:
. Any ideas? --Semorrison 04:31, 31 August 2005 (UTC) I'm running ImageMagick v. 5.5.6, which may be the problem? --Semorrison 04:43, 31 August 2005 (UTC)
[edit] HOW TO MAKE FONT-SIZED PNGs
OK so we have transparency. Next problem is that we would like the pngs to be appropriately scaled to the surrounding text. This means that the png looks like it fits in even if the page is using larger or smaller fonts, or if the user has cranked up or cranked down the overall font scaling in the browser.
How do we do this? The strategy (which is simple-minded but in practice works well enough) is essentially the following. Suppose we knew the height of the png, and suppose we had some sort of general ratio along the lines of "height of an x in the png, as created by texvc with the settings it uses" relative to "the height of an x on our web page under certain conditions". Then we could express the height of png (in the <img> tag) in terms of ex units and, voila, everything scales appropriately.
So let's put that into practice. Step one is to write the following tiny shell script:
#!/bin/bash
identify $1 | awk '{print$3}' | awk -F"x" '{print $2*0.11}'
and save it, changed to executable, in wiki/math as getTexImageHeightInEx.sh. This script takes the name of a png as argument, uses the identify command (part of ImageMagick, so presumably already on your system) to generate a line of text about the png, and uses some awk to grab from that the height in pixels of the png. The factor of .11 is a magic value, determined empirically, that gives the visually-appropriate height of this png in ex units. If you want, run this script on a png and verify that it gives kinda sane values. For a png of a simple integral I think you get a value of around 4 or 5ex of height.
Step 2 is to open wiki/include/Math.php, which is the php code that deals with calling texvc and so on, and look for
function _linkToMathImage()
which should be at about line 200. Change this to
global $wgMathPath, $wgMathDirectory;
$url = htmlspecialchars( "$wgMathPath/{$this->hash}.png" );
$alt = trim(str_replace("\n", ' ', htmlspecialchars( $this->tex )));
# return "<img class='tex' src=\"$url\" alt=\"$alt\" />";
$wgGetTexImageHeightInEx = './math/getTexImageHeightInEx.sh';
$cmd = $wgGetTexImageHeightInEx.' '.
wfEscapeShellArg( "$wgMathDirectory/{$this->hash}.png" );
$heightInEx = chop(`$cmd`)."ex";
return "<img class='tex' src=\"$url\" alt=\"$alt\" style=\"height:$heightInEx\" />";
So what we have changed is
- note $wgMathDirectory as a global since we will need it, as well as just $wgMathPath
- call $wgGetTexImageHeightInEx, the script we defined in step 1,
- shove a style specifier that specifies height of the png in ex units at the end of the created URL.
(When/if this gets formalized into the code base, the maintainers will probably want to move the definition of $wgGetTexImageHeightInEx out to DefaultSettings.php, but for explaining and testing it's obviously easier to define it here as I did.)
That's it, we're done! Open a page displaying TeX pngs and ooh and aah with wonder as they scale larger and shrink smaller as you increase/decrease the size of the browser font scaling. (On Firefox or Safari on MacOS X you do this with command+ or command-, no idea about windows/linux browsers). (Ctrl++/Ctrl+- or Ctrl+Scroll wheel.) (CSS for images that scale with text)
- What are the reasons for scaling via shell scripts instead of via CSS's ex and em (using height and width)? Daphne A 20:38, 6 February 2006 (UTC)
-
- The point of the above code is not to actually carry out the scaling. The point of the code is to work out that, for example, the image
is (I guess) three times as high as the "x". Once you know that, you can use either CSS or put the size in the HTML directly. Anyway, the issue is moot, because most modern browsers (Safari being a notable exception) have very nasty scaling code, and the result looks terrible. Dmharvey 23:20, 6 February 2006 (UTC)
- The point of the above code is not to actually carry out the scaling. The point of the code is to work out that, for example, the image
-
-
- Kind thanks for explaining. I don't agree, though, that most browsers make scaled PNGs look terrible. Rather, I think that most browsers make scaled-up PNGs look terrible. So how about making the PNGs three times (for example) the size needed. (The browser will then scale down by default.) Using even double sizes would probably be adequate. I've tested this with Firefox and IE6, and gotten decent results from both. —Daphne A 17:35, 28 February 2006 (UTC)
-
-
-
-
- I tried this some time ago, using the scaling down as you suggest. As I recall, my experience was that in equations involving thin horizontal objects, like minus signs and equal signs, the horizontal bits sometimes went missing altogether (including on the browsers you listed). So minus signs would sometimes vanish, and equal signs would sometimes turn into minus signs. Does that happen on your system? Dmharvey 17:45, 28 February 2006 (UTC)
-
-
-
-
-
-
- Okay, here's the test I just did. I used GIMP 2.2 to create PNG images of text "a-b=4", using Trebuchet MS font and 0 compression. Browsers were IE 6.0 and Firefox 1.5. With IE, I found that text "a-b=4" displayed on my system at about the same size as GIMP-text font size of 20 pts. I then scaled an image of 20-pt "a-b=4" using the HTML height="20%" (which actually displayed larger than 20% of original size, but still quite small). All horizontal bars (in minus, equals, and four) in the down-scaled image were visible.
-
-
-
-
-
-
-
- Repeating this in Firefox, I found that "a-b=4" displayed at about the same size as a GIMP-text font size of 22 pts. I then scaled an image of 22-pt "a-b=4" to 20%. Again, the down-scaled horizontal bars were all visible.
-
-
-
-
-
-
-
- Note that this test does not use the enlarged PNGs that I was suggesting. (Because there were no problems, I didn't try.) — Daphne A 20:06, 28 February 2006 (UTC)
-
-
-
-
-
-
-
-
- This is mighty curious. A few questions: (1) Are you saying you scaled down 20pt text down to 4pts? And at 4pts it was still readable at all? (2) Since you mention IE, I assume you are running all this on Windows. In fact I recall Windows was the platform where things looked worst when I did my tests. What version of Windows are you running? (3) Do you have Windows' ClearType functionality turned on? (It's in something like display or desktop settings.) I thought ClearType only applied to font rendering, but maybe it does something to bitmapped graphics as well. Dmharvey 20:26, 28 February 2006 (UTC)
-
-
-
-
-
-
-
-
-
-
- Sure.... (1a) Theoretically, yes, but as I said, it actually displayed larger than 20% of the original size, though still quite small. (1b) Just barely; actually, the minus sign was visible as something, but would have had trouble identifying it if I wasn't psychic: it was definitely not invisible though. (2) Windows XP SP2. (3) Yes. I've just now tried the IE test without ClearType or even standard antialiasing, and the horizontal lines were still visible (or at least not invisible).
-
-
-
-
-
-
-
-
-
-
-
- Maybe it is the OS display technology? (What OS did you use?) —Daphne A 22:00, 28 February 2006 (UTC)
-
-
-
-
-
-
-
-
-
-
-
-
- I did my tests both on some edition of winXP and Mac OS probably 10.3.something. What you're saying is all very interesting. I should mention, in case you didn't know about it already, that I'm working on developing some actual MathML support for mediawiki. (See Blahtex and try http://wiki.blahtex.org). The blahtex software can also generate PNGs, much the same way as texvc does. Right now, coincidentally, I've been working on the PNG output, and in particular studying issues to do with heights and depths of the output image. I'm considering switching to using latex+dvipng instead of the latex+dvips+imagemagick+ghostscript quartet that texvc currently uses. One nice thing about dvipng is that it can output the height and depth of the image very reliably. (Height is what you think it is; depth tells you where the "baseline" of the equation is within the image.) So if/when blahtex is used on wikipedia, it should be much easier to allow for rescaling of images to the correct size, without all the trickery discussed earlier in this section. Perhaps this could even be something in the user's preferences. Anyway, thanks for pointing out to me that it shouldn't be considered a lost cause. I'll keep it in mind. Dmharvey 22:27, 28 February 2006 (UTC)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- MathML support would sure be nice. Good luck! Daphne A 21:52, 2 March 2006 (UTC)
-
-
-
-
-
-
-
[edit] Update Patch for MediaWiki 1.10.0
In Mediawiki 1.10 (and perhaps earlier) the paths for reaching math PNG images have changed, so the above patch must be changed slightly. Step 1 (above) involving the shell script remains the same. But now replace step 2 (in /wiki/includes/Math.php) with this:
function _linkToMathImage() {
global $wgMathPath;
$url = htmlspecialchars( "$wgMathPath/" . substr($this->hash, 0, 1)
.'/'. substr($this->hash, 1, 1) .'/'. substr($this->hash, 2, 1)
. "/{$this->hash}.png" );
$alt = trim(str_replace("\n", ' ', htmlspecialchars( $this->tex )));
# return "<img class='tex' src=\"$url\" alt=\"$alt\" />";
$wgGetTexImageHeightInEx = './math/getTexImageHeightInEx.sh';
$cmd = $wgGetTexImageHeightInEx .' '. wfEscapeShellArg( $this->_getHashPath() . "/{$this->hash}.png" );
$heightInEx = chop(`$cmd`)."ex";
return "<img class='tex' src=\"$url\" alt=\"$alt\" style=\"height:$heightInEx;\" />";
}
Note that we no longer must declare $wgMathDirectory to be global because the path to PNG images is now built by the new function _getHashPath() in Math.php. --Jhaile 13:41, 28 June 2007 (UTC)
[edit] HOW TO MAKE PRETTIER FONT-SIZED PNGs
So the above works, but the pngs can look a little ugly. (At least they do on Safari 1.3, and probably on some other browsers.) Can we do something to fix this? Of course we can.
If you spend some time screwing around with this stuff, you will see that the PNGs produced by texvc are created at a size that is kinda-sorta about the right size for what the texvc author hopes is the most common font size they'll be used with. Since we are now getting the browser to scale them for us, we can change this to create them at whatever size we think makes sense. In an ideal world what one would do is something like create the png at the largest practical size at which it might be displayed, and rely on the browser to scale it down appropriately. This would provide the maximum amount of information in the png for the scaling operation. The problem is that for this to work, the browser has to do a decent job of scaling down the image, in particular it has to use a scaling algorithm that does not generate aliasing (in the good old sampling theorem sense), eg some sort of multi-tap filter. Unfortunately it seems that at least Safari 1.3, and I'm guessing other browsers, do not utilize such an algorithm but appear to use old-fashioned linear interpolation. It is this lame-assed interpolation that makes our newly scaled pngs sometimes look not-so-great. What can we do about this?
Option one is to say screw it; tell the browser vendors to bring their products into the 21st century. Firefox does the scaling correctly. I don't know if Safari 2.0 does or not --- if not, someone should write a bug report because Apple clearly has code to do this right, since Preview.app does it correctly (even better than Firefox). The big issue is presumably whether IE does it right or not.
Option two is to accept lame browsers and ask: what's the best we can do to generate a good image?
The answer is that we want a png that is
- appropriately sized and
- dark enough.
Appropriately sized means that it should be a little larger than the smallest size we'd expect to be used, but not much larger. If it's a little larger than the smallest value we expect it to be used at, then its display under normal sizes will be at scalings of around 1x, while small scalings will be at around .75x and large scalings at up to maybe 1.5x. Even linear interpolation can do an acceptable job in that range of scaling.
Dark enough refers to the fact that scaling (linear interpolation or multi-tap-filter based) is usually done using raw RGB values, not gamma-corrected RGB values. For most images this works fine, but for TeX type images with very strong black-white transitions, the scaled images result in greys, and the non-linearity of gamma correction means the scaled image doesn't seem as dark as the non-scaled image. We can generate darker images by forcing TeX to create its dvi file using smaller point fonts (which are, as should be obvious) darker on average than larger point fonts.
So putting these together and performing a whole lot of experimentation, we arrive at the following set of optimal parameters:
- we tell convert to use a density of 150 rather than texvc's original value of 120. This means the images created by convert (and thus ultimately by texvc) are 25% larger than they used to be.
- but we tell TeX to create the image using smaller fonts, in particular using the \footnote sized fonts.
The net result of this is that our empirical scaling-to-ex magic value of 0.11 is still valid, but we land up creating png's that are a little darker and that thus display better at smaller sizes.
How to actually do this? First we modify wiki/math/render.ml. We already modified this earlier to give us transparent pngs, now we modify it again to scale those pngs differently. Change the third line to
let cmd_convert tmpprefix finalpath = "convert -quality 100 -density 150 -matte -fuzz 1% -fill None -opaque White " ^ tmpprefix ^ ".ps " ^ finalpath ^ " >/dev/null 2>/dev/null"
The change here is from -density 120 to -density 150.
Second we modify wiki/math/texutil.ml to tell it to tell text to use smaller fonts. Change the line 52, the fourth line of the function get_preface() to
"\\pagestyle{empty}\n\\begin{document}\n\\footnotesize\n$$\n"
The change is that we added \\footnotesize\n into the stream of TeX this file generates, and \footnotesize is a LaTeX command that sets a smaller overall size for all subsequent text.
You will now need to cd to wiki/math and type make to rebuild texvc withh these two changes. You will also, and this is important, need to go to wherever you have your system storing the TeX pngs, usually wiki/images/math, and throw all those pngs away, otherwise those pngs will be used when pages are displayed rather than having new pngs created according to the new specifications we have given texvc. After the make, and the png disposal, you can now try to look at some TeX png pages. If you're using Firefox they probably won't look much different, but on Safari 1.3 (and I'm guessing IE 5) they will look quite a bit better.
-
- You also need to clear out the "math" table in the wiki database. Dmharvey 22:41, 18 August 2005 (UTC)
- Idea: How about generating PNG's in several different sizes and loading the right size using JavaScript? -- 143.229.1.42 16:40, 6 December 2007 (UTC)
[edit] HOW TO FIX THE VERTICAL ALIGNMENT?
Now that we have transparent, properly-scaled, nice-looking pngs, it is harder to ignore the last remaining visual discrepancy which is that text-inline pngs don't line up quite right with the main text baseline. I also wanted to fix this.
Note that unlike the three fixes above, which are basically theoretically motivated and should probably work across all systems, what I'm going to propose for vertical alignment is something of a hack that may have to be tuned for different browsers, or even for different "main" fonts (ie a page based on Helvetica vs one based on Arial). I offer it as a starting point, with the idea that as other people try it we may find that it works pretty well across all real-world configs, or alternatively that there's a fairly easy way to parameterize it, either by site or by browser, to have it still work OK.
My first though for this was to dick around with the vertical-align of the image, setting it to something that looked OK, like -36%. The problem is that what generates a good base line for a line like sin(x) + abs(y) does not generate a good base line for integrals.
On looking at various samples further, it seemed to me that while the current (vertical-align:middle) scheme works well, it seems to consistently (at least with Safari 1.3 and monobook style) have the TeX baseline just a shade below the HTML baseline. So I figured that if I stick the image vertically centered in a span, and I nudge the span up that slight amount, I'll get the better alignment I want, and the nudge up won't really affect TeX pngs that are stuck on a line by themselves.
So how do we implement this?
Return to file wiki/includes/math.php that we touched a little earlier, look again for
function _linkToMathImage()
and change the last line to
return "<span style=\"vertical-align:+.185ex\"> <img class='tex' src=\"$url\" alt=\"$alt\" style=\"height:$heightInEx\" /> </span>";
This does what I just discussed, and the .185ex is an empirical value that works well, as I said, for Safari 1.3 and monobook across a large range of font scaling.
So the end result of all our hard work is TeX pngs that are no longer second class citizens. They're transparent, scale like text, look reasonably good, and integrate organically enough into the surrounding text that, to first glance, they look just like standard text.
(Sorry to make such an ugly obviously shouting edit, but I think this stuff is important enough to be acted upon right away, and writing it up as a bug didn't seem appropriate.)
(Maynard Handley)
- Hi there Maynard, I don't know how else to contact you but I'll try here.
- I think your ideas here possibly have some merit, but the best way for all of use to gauge them is if you can find a way to set up a public wiki somewhere with your code plugged in. I would be interested in seeing it running on a live site, but probably it needs to be tested before running on the REAL live site. Dmharvey 16:59, 4 August 2005 (UTC)
[edit] Whitespace details
It says "Spaces and newlines are ignored", but this obviously isn't completely true:
- \sin x
- sinx
- \sinx
- Failed to parse (unknown function\sinx): \sinx
What are the details of where spaces are important and where they are not? - Omegatron 15:35, 10 August 2005 (UTC)
- I can speak for LaTeX (and blahtex), and I believe texvc's rules are very similar.
- In math mode, there are only three places that whitespace means anything at all:
- As you've pointed out above, to separate a command whose name consists of a sequence of alphabetic characters from any subsequent alphabetic characters, and
- The command "\begin{ matrix}" is not identical to "\begin{matrix}", and
- The command "\ ", which is equivalent to "\" followed by any nonzero amount of whitespace.
- Apart from that, all whitespace is completely ignored. (I think. Maybe you can point out something I've forgotten!)
- In text mode the rules are slightly different. LaTeX collapses consecutive whitespace in text mode into single whitespace characters, but these remaining whitespaces are not ignored for the output. However I don't completely trust texvc's implementation of text mode. For example \mbox and \textrm differ in how they accept special characters like "^" and "{" and "\{". Dmharvey 16:46, 10 August 2005 (UTC)
- Also, of course "\ sin" is not equivalent to "\sin", and "\ ," is not equivalent to "\," (ditto with "\\"). Dmharvey 16:49, 10 August 2005 (UTC)
-
- I just changed this to:
- Similarly to HTML, in TeX extra spaces and newlines are ignored.
- PizzaMargherita 13:38, 20 November 2005 (UTC)
- I just changed this to:
[edit] \mathrm for mathematical constants
I know there are more important issues to think about, but.
I know that a lot of respectable publishers ignore this rule, but.
If we are feeling really really anal, it is considered good typography to write mathematical constants upright (i.e. using \mathrm).
The only references I can find to this rule are on the web, in newsgroups about TeX, but I'm sure I've read it somewhere autoritative.
Mathematical constants include:
- e (Euler's constant)
- i (imaginary unit)
The rationale is:
- They can otherwise be confused with a variable, e.g. the index in a sum
- Better semantics
- More consistent
Also, as somebody already noted above, the differential operator should be \,\mathrm{d}. In the comp.text.tex newsgroup, one of the authors of the amsmath package Michael J Downes admits that they should have provided a \diffd command earlier on and now they don't do it for backward compatibility.
Interesting reads (but I'm sure there are a million others): [article #1] [article #2]
What do you think? Also, I'd be grateful if someone can find a decent reference. PizzaMargherita 18:45, 20 November 2005 (UTC)
- Sorry Pizza, I humbly and strongly disagree. This conversation -- regarding "i" in any case, not sure about "e" -- has been had before, probably somewhere in the math wikiproject talk archives on en. The conclusion was that the person who was changing them all to upright was mistaken and a big effort took place to change them all back. I will repeat here what I said there. The vast majority of math texts I have seen use italic i and e and d. I don't think this is because they aren't "anal" enough, or because they are poor typesetters. I think this really is the convention in serious mathematical writing. One may ask, who is Dmharvey to say? Well, the best I can do is that I'm engaged in a PhD in pure mathematics at the moment, and I spend an awful lot of my time buried in math textbooks and journals, seeing italicised i and e and d pretty much everywhere. Perhaps in different fields or different languages it's different, but in pure mathematics in English I think italics wins. You should try and track down that conversation, see what people's arguments were either way. Dmharvey 21:22, 20 November 2005 (UTC)
-
- Sure, sure no big deal. I'm really frustrated because I can't remember where I first read about it. So far the best I could find in the usenet thread above is that it is the "ISO style".
- Incidentally, I just found out this in the Italian entry for LaTeX:
\int_0^\infty f(x)\,\mathrm{d}x \approx \sum_{i=1}^n w_i \mathrm{e}^{x_i} f(x_i), to give - I'd be interested to read the exchange you mentioned... PizzaMargherita 22:11, 20 November 2005 (UTC)
-
-
- It might well be a geographical thing. Here's the conversation I meant: en:Talk:Complex_number#The_non-italic_writing_style_of_the_imaginary_unit Dmharvey 22:38, 20 November 2005 (UTC)
-
-
- Thanks for that. I totally understand where the minority was coming from and I agree with them. I added my thoughts there. PizzaMargherita 00:32, 21 November 2005 (UTC)
[edit] Using Times instead of Computer Modern
Has anyone considered using TeX's \mathptmx package for default output? It outputs math set in Times, which AFAIK is the default serif font on most platforms (as opposed to TeX's default Computer Modern, which is available on no platforms). Considering some formulae are output as plain HTML in a serif face, and some are rendered as images, using Times in the images might make them much more consistent. --Anonymous, 29 Nov 2005
- Plain HTML on my browser with my settings on my OS is rendered as Wingdings. Just kidding, but definitely no serifs. PizzaMargherita 22:34, 29 November 2005 (UTC)
-
- Are you talking about the math rendered in HTML, e.g. E = mc2, or the rest of the article text? I'm looking at the source, and math in HTML is wrapped in a
<span class="texhtml">, and the default Wikipedia CSS has the declarationspan.texhtml {font-family: serif}. What I was trying to say was that on most platforms, in the default configuration, this would be displayed in some variant of Times, so it makes sense to have the images also be set in Times.
- Are you talking about the math rendered in HTML, e.g. E = mc2, or the rest of the article text? I'm looking at the source, and math in HTML is wrapped in a
-
-
- Well? Any thoughts? -- Anonymous, 5 Dec 2005
-
[edit] \mathrm for labels
It's good typography to use \mathrm around labels, like Vref. But this makes the TeX a lot harder to read. Apparently we have some extras in texvc, like changing the names of special characters to coincide with HTML entities. Is there a way we could add functionality so that anything preceded by a backslash is rendered upright, like the difference between sin and sin, and only use mathrm when that doesn't work, or is that a really bad, hackish idea?
They say LaTeX and TeX are "extendable" with macros. Is that what the HTML entity thing is? — Omegatron 15:19, 1 December 2005 (UTC)
- I think that's a "really bad, hackish idea". :-) The difficulty is that we may want to add commands in future, which might conflict with "commands" that people have already used. It's very un-TeX.
- What you say about macros, that's not exactly what texvc does. Texvc actually itself translates these nonstandard commands. TeX never sees them. For example, "\part" gets translated by texvc into "\partial", which is standard TeX for the partial derivative symbol. (This is a particularly bad choice of abbreviation, because "\part" is also a standard LaTeX command which divides a document into "parts" (like chapters or something)). Dmharvey 23:19, 1 December 2005 (UTC)
[edit] Surface integral
- Is there a way to use TeX to render one of those symbolic surface integral symbols? It's unicode character 0222F, a double integral with a closed loop around the two integral symbols.
-
- I believe this is not implemented in texvc (the software driving the TeX implementation on wikipedia). In fact I can't even find a standard LaTeX or AMS-LaTeX command which does this. The best you can do is
(and for some reason it gets cut off these days...). Dmharvey 18:55, 8 December 2005 (UTC)
- I believe this is not implemented in texvc (the software driving the TeX implementation on wikipedia). In fact I can't even find a standard LaTeX or AMS-LaTeX command which does this. The best you can do is
-
- ∯ should work with correct browser settings and an appropriate font.
-
-
- Speaking of which, someone suggested on the technical village pump that unicode special characters be allowed in math expressions, which would be translated by texvc into the appropriate \characters for tex. Is this possible?
-
For instance, instead of
- 2πr2
you could type
- Failed to parse (lexing error): 2 π r^2
to make the markup easier to read. — Omegatron 17:34, 20 December 2005 (UTC)
[edit] Why More Complicated formula not working?
The following works fine:
ax2 + bx + c = 0a2 + 2ai,j
But the following will give the original writing (please see www.bancova.com)
They do not appear as

but as: >{}_1^2\!X_3^4 \begin{matrix} \sum_{k=1}^N k^2 \end
Any suggestions, please email me to johnuseast@yahoo.com Thanks!!!
- If I understand you correctly, you're asking why this formula:
- <math>{}_1^2\!X_3^4 \begin{matrix} \sum_{k=1}^N k^2 \end{matrix}</math>
- works under en.wikipedia but not at www.bancova.com? Obviously, this would have to be because bancova.com has not installed the requisite wiki software.
- Urhixidur 16:21, 19 December 2005 (UTC)
THANK YOU!!! Could you kindly let me know what softwar i need? I installed mediawiki, and wiki version of Latex....do I miss any thing? PLEASE advise! THANK you again!
CAN ANY BODY HELP PLEASE?
---Thank you! I have the whole package installed...then my hosting company also installed "Latex"...just does not work....
- Have you compiled texvc? Dmharvey 22:08, 21 December 2005 (UTC)
math formula Description: Some one suggested that my mediawiki is not supporting math formula because some other software needs to be installed, would you please have a quick look and see what is missing from my installation?
http://cvs.sourceforge.net/viewcvs.py/*checkout*/wikipedia/phase3/math/README
Problem solved, THANK YOU ALL!!
My web site now can display very nice math formula, due to all your guys hard work!
My special thanks go to www.SiteGround.com support team, a team that I have never seen in the whole hosting world. 1) They response within 5 minutes, all the times; 2) they take care of many things that other hosting companies would walk away from; 3) they have the patience, courage! If there is one Super hosting company, that is www.Siteground.com. They have a wonderul team. They have wonderful open sources software: the best CMS Typo3, the best wiki MediaWiki, the SMS, etc, etc. If you are not web expert and want to have real helps, I would strongly suggest that siteground is one!
Especially for MEDIAWIKI!
BTW: this is the list of team members I got a in the past week:
Kenny: Team Suport Supervisor
Tom: Suport Manage
Val Palmer
Brandon
Terry
Nick
Bill
SiteGround---No.1 Service Hosting Company!
- (most of the above unsigned comments were by IP 12.104.10.143) Dmharvey 14:09, 22 December 2005 (UTC)
[edit] Missing Symbol
Is it possible to get a symbol added to the dialect of TeX that wikipedia uses? At the moment, we have \bigodot, but not \odot. \odot is useful because it is the solar symbol, and \bigodot is a bit large for that purpose. 171.66.131.133 07:32, 12 January 2006 (UTC)
- Yes, things can be added. I think you need to file a bug report on Mediazilla? — Omegatron 14:05, 21 March 2006 (UTC)
[edit] Sans-serif font
See en:Wikipedia:Village_pump_(proposals)#Proposed_change_to_MediaWiki:Common.css for a discussion about changing the site-wide font to sans-serif. — Omegatron 03:58, 15 March 2006 (UTC)
[edit] <math> tag not recognized
my Wiki installation does not recognize <math\> tag. i.e. whenever I try to use, it just spits out the characters, not the formulae. like this: <math>{t_max}</math> (of course I try it without nowikis, here they are just to display it)
- Have you read the following link? http://cvs.sourceforge.net/viewcvs.py/*checkout*/wikipedia/phase3/math/README. (by the way, please sign your messages with four tilde signs: ~~~~, makes the conversation easier to follow) Dmharvey 02:29, 21 March 2006 (UTC)
[edit] I need superscript for \to
... but not this
kind. Rather, I want the O to be right above the arrow, implemented nicely without hacks. Please help. Ramir 06:23, 23 March 2006 (UTC)
- I found the proper TeX way to do it:
\buildrel P \over \to, but it does not work in this bloody renderer. Could anyone add a bug-report or something? I am too lazy to do that, knowing that developers rarely take notice (see, for instance bugzilla:2458). Ramir 06:43, 23 March 2006 (UTC)
[edit] phantom
I noticed that the \phantom command doesnt' work in wikipedia. Is there another way to leave some space in subscripts and superscripts? Thanks
[edit] math environment in different lines causes Failed to parse (unknown error):
My mediawiki is set up on windows machine, texvc is enabled, MikTex, ImageMagick, ghostscript, and Cygwin are all installed.
When I use
<math> \sqrt{10} </math>
in single line as a test, everything works fine. But when I tried to use the math environment in multiple lines
<math>
\sqrt{10}
</math>
Failed to parse (unknown error): sqrt{10} appears. Suppose LaTex ignores newlines and spaces, so this should work,. Anyone knows how to fix this problem in windows environment?
I tried to use http://meta.wikimedia.org/wiki/LaTex_on_a_shared_host to test which part of mediawiki on windows went wrong. This method hacked the includes/Math.php renderMath($tex) {...}, and the only difference is the render() part. Instead of using the Math.php's render() function, it uses the result from the outside cgi. And the improperly parse problem is solved in this way, though the generated math is not good. So I think there must be something wrong in render() function in Math.php which can't parse the following condition properly in windows environment. Could anyone help to trace the render() function?
Josephsieh 03:15, 2 April 2006 (UTC)
[edit] Symbols fail to display
Can anybody please suggest why certain symbols fail to render correctly in my install. Something like
- P(r)αrn − 1exp( − kr2 / 2σ2)
renders beautifully whereas replacing the \alpha with a \propto causes the whole equation to be shown without rendering as
P(r) \propto r^{n-1} \exp(-kr^2/2\sigma^2)
Certain other symbols also don't work e.g. \nabla and \sim. The strange thing is that perfect png images are created in my images/math folder - just for some reason they are not correctly displayed.
Many thanks in advance.
Joejk2 18:55, 3 May 2006 (UTC)
[edit] tensor ?
Is there a way to display tensor indices properly in a wiki without the (very useful!) tensor package ?LeYaYa 11:36, 6 May 2006 (UTC)
[edit] Equation numbering
Is there a good way to number equations? In math textbooks, equations usually have an equation number that is aligned to the right side of the page. For example, the (2.1.1) below would be right aligned.
(2.1.1)
I have a large number of ms-word documents with equations in them, what's the easiest way to get these into our Wiki? The best I've come up with so far is Word -> TeX conversion software (http://www.grindeq.com/), automated search/replace using sed or something and a whole lot of manual editing.
- If you want to manually align equation numbers, you can do this:

- I don't recommend it, however, because it's a whole lot of CSS and there's no automatic numbering going on. It wouldn't be too difficult, however, to create a parser extension to automatically number equations, so you may want to go bug the developers.
- Thanks. For reference, someone else beat me to it: http://bugzilla.wikimedia.org/show_bug.cgi?id=5600 — User:DanielZee, 00:30, 22 May 2006 (UTC)
- Regarding your Word documents, I really can't help you. I'm surprised that there are even Word to TeX convertors out there. I would just rewrite the whole things (catching whole lot of other possible errors along the way). — Ambush Commander(Talk) 14:22, 21 May 2006 (UTC)
- That's a whole lot of work that I don't want to do. We'll probably use the method above + a math student to manually fix the output.
On italian wikibooks we created a Template to do this, B:it:Template:Equazione The Doc 15:16, 21 May 2006 (UTC)
- I didn't know about templates, but a combination of AC's HTML and your solution looks exactly what I was looking for.
I created an English variant of this Italian template, at [[3]]. This Eq template provides a way to add an equation number or label, right justified on the page. It doesn't automatically renumber equations, but at least it provides a way to refer to an equation to that a reader can click on a reference to an equation and jump to that equation. If it's useful, perhaps it could be moved to Wikipedia's main collection of templates. --Plasma g 19:41, 29 July 2006 (UTC)
I've also added W:en:Template:Equation; it's based on B:it:Template:Equazione, and is simple to use. 142.58.206.114 20:05, 7 February 2007 (UTC)
[edit] PNG -> SVG
Hi, I was just thinking up that It should be possible to render the TeX formulas as w:en:SVG files. AFAIK, TeX uses vector based fonts for rendering, therefore it should be possible to render vector based images of a formula instead of the bitmap based PNG. This would be a great improvement when zooming in a website in a zoomable browser (f.e. Firefox with addons). TeX formulas would zoom in and out accordant to the text around it. --Abdull 13:18, 4 June 2006 (UTC)
- Most of the time, SVN gets rasterized to PNG anyway for display inside the text, so the zoomable SVG point is basically null. That being said, it's an interesting idea, but needs an implementation. — Ambush Commander(Talk) 02:31, 5 June 2006 (UTC)
- You might be interested in blahtex which provides en:MathML support. This would allow zooming as you describe. There's a test wiki at http://wiki.blahtex.org. Dmharvey 12:00, 5 June 2006 (UTC)
[edit] Over leftright harpoons
Any way of getting a leftright harpoon over something as to define a line? It only shows how to get an arrow going in one direction or the other on top of two letters, but not in both.68.34.41.32 13:12, 21 June 2006 (UTC)
- I'm not sure exactly what you mean, but maybe when/if m:blahtex is installed, you'll be able to do this: [4] Dmharvey 13:43, 21 June 2006 (UTC)
[edit] Help in lining up equation
Hi,
I've tried to use the math statements to look into some binary floating point explanations. So far I have

Ideally i would like to have the 1s and 0s lined up like so, with the braces beneath them 
Can you do this in math or would it be best to make it into a picture? pluke 87.194.13.209 21:25, 28 June 2006 (UTC)
- *sigh*. Unfortunately because the TeX implementation here is a bit broken, you can't quite do it. You can get pretty close with m:blahtex, see for example















