Wikipedia talk:TeX markup

From Wikipedia, the free encyclopedia

If the page is deprecated, why does it exist? Why not move the contents to the new page? There must be something like 4 or 5 different pages about the wiki TeX markup. --Voodoo 15:54, 9 Apr 2004 (UTC)

I'm in favor of redirecting it. People edit this page and it doesn't get updated in the official version. - Omegatron 15:47, Jul 13, 2004 (UTC)

I don't know if this is the right page to bring this up, but is there a way the <math>-environments could have support for bold vectors?

Apparently you have to introduce a command to do this, such as

 \renewcommand{\v}[1]{\mathbf{#1}}

(taken from http://www.maths.abdn.ac.uk/~jrp/latex_course/firststeps/page5.htm ), but I can't get this to work in an individual formula. Perhaps a similar command should be globally defined? --Martin

The answer is given in the (UK TeX user group's FAQ. In short use either of the packages bm.sty or amsbsy.sty. --Anon

  • Note that there is a standard macro \vec for vectors in LaTeX. If Wikipedia wants to use boldface for vectors, they should \renewcommand{\vec}[1]{\mathbf{#1}}. (This would allow you to change vector formatting down the road, or for different publication venues.) Don't encourage bad LaTeX habits, and please use \vec for vectors! -- Steven G. Johnson.
  • The problem is that Wikipedia isn't really writing in LaTeX. We'd never be able to know if a \renewcommand wouldn't mess something up (without a full search of all of its uses). -- Toby Bartels 03:52 12 Jun 2003 (UTC)

A question: Which TeX software generates the little PNG images? -- Hirzel

The system was written by user:Taw; here's my understanding of it: the formula is first parsed and validated by an Ocaml program called texvc. If texvc decides that the formula should be rendered by TeX, the TeX interpreter will be called (it uses the amstex or amslatex package) and produces a dvi file, which dvips converts to postscript. The program ghostscript then converts it into png. Maybe imagemagick is also involved as the last step, I don't know. AxelBoldt 22:02 Jan 7, 2003 (UTC)

Will these conversion scripts also be included in the Wikimedia software download? I think this kind of functionality makes wikis a lot more attractive to scientists (who are used do doing their formulas with TEX). I suspect a lot of people (and that includes myself) would like to set up intranet sites with this TEX-aware wiki... --Martin
Yes, texvc is included in the Wikipedia source repository and should be in the downloadable snapshot. There are some dependencies, which are noted in the README, but it's all free software. (TEX, ImageMagick, OCaml, GNU Ghostscript) --Brion
texvc doesn't call ghostscript directly, but it calls ImageMagick and ImageMagick in turn calls ghostscript. Taw 17:19 Jan 13, 2003 (UTC)

how about we get the background color of pngs to match wikipedia's -- user_talk:hfastedge

or transparent backgrounds - Omegatron 15:47, Jul 13, 2004 (UTC)
i'd really appreciate being able to use transparent pngs to match the background. even 1bit alpha would be fine if we had to keep IE6 compatibility.--Krackpipe 22:03, 1 December 2005 (UTC)

Contents

[edit] integrals over curves

\int_C {a \over b } doesn't look quite right -- the C should be below the integral sign rather than look like a footnote. Is this possible? -- Tarquin 23:14 Jan 8, 2003 (UTC)

In TeX, this should to the trick, only texvc doesn't recognise it as proper:

Failed to parse (unknown function\displaylimits): \int\displaylimits_C {a \over b }

Ap Sun Jan 19 02:30:11 UTC 2003


Failed to parse (syntax error): H(x) = \left\{ \begin{matrix} 0 : x 0 \\ 1 : x \ge 0 \end{matrix} \right


H(x)=\left\{\begin{matrix} 0 : x < 0 \\ 1 : x \ge 0 \end{matrix}\right.


Suggestion: where possible, (a_1,b_1] \times (a_2,b_2] should be rendered inline as (a1,b1] × (a2,b2], rather than expanded to a graphic.


The result of <math> tags is ugly. The pictures are too big, and the ALT text shows the awful-looking raw markup when people move their mouse over it in most browsers. Any hope of some more user preferences in this area, hopefully with sensible defaults? -- Tim Starling

I tend to agree on the size; font sizes can be manually bumped up on equations that really need it. (But the PNGs are limited to fixed pixel sizes, which does not have a guaranteed relation to a readable font size for any given user.) What other improvements would you suggest? I'm afraid "not ugly" and "more sensible" aren't things we can code. ;) Eventually output as inline MathML is hoped for, but few browsers currently support it and we would need to beef up our wiki->HTML translator to produce proper XHTML. --Brion 06:42 Jan 9, 2003 (UTC)

\left and \right should force output as PNG. If you don't believe me, change your user prefs to HTML whenever possible and look at the last item in each of the tables on this issue. The first table makes a reasonable case, but the second is the killer. It's rendered completely wrong! -- Toby 09:09 Mar 8, 2003 (UTC)

JohnOwens' latest edit has the work-around, but the original was correct LaTeX. -- Toby 10:44 May 13, 2003 (UTC)


How do you do θ in TeX? Please respond on my page LittleDan


\mathfrak{Hello Wikipedia!}

[edit] TeX caching error

Moved from Wikipedia:Village pump

I get a 404 on the TeX images in Wilson's theorem. In all other pages it seems to work fine. This is on the new server. -- Arvindn 07:12 16 May 2003 (UTC)

I've gone ahead and cleared the tex cache table, so it'll regenerate those that were on the old server but not the new one. Should be fine now. --Brion 07:17 16 May 2003 (UTC)

For how long does the cache last? I used Wikipedia:Sandbox 6 months ago and created http://en.wikipedia.org/math/0/c/6/0c608b71826422e03d7715e209f22c00.png and 6 other test formulae png's which remain as png files on server. richardc020 02:31, 6 May 2006 (UTC)

I've gotten into TeX (through LyX) quite a bit lately, and have decided to add math markup to some of the math pages on Wikipedia. I am somewhat concerned about doing this just for the sake of having it look pretty (and be ready for MathML, when the rest of the world is ready for it) - since most of it gets turned into images, which can result in a pretty long load time for big articles (for example, Trigonometric function). I was quite pleasantly surprised to see that the formula images do have "alt" tags for the image-deprived, though! Anyhow, are there any particular guidelines to follow for when it's appropriate to add the TeX-ish math markup, and when it's better to just use standard HTML constructs? Or is it okay to just mark up all of it? -- Wapcaplet 01:41 19 May 2003 (UTC)

There's some discussion of this at Wikipedia:WikiProject Mathematics. (My basic ground rule is that TeX should only be used when there is no other way to write the formula clearly.

But others there may give you other opinions.) -- Toby 11:20 19 May 2003 (UTC)

That's probably a good guideline to follow. One situation I've found is the usage of the square root. It's quite possible to write some square root formulas with normal HTML:

|a| = √(a12 + a22 + a32)

But it looks much better, and is considerably more clear with TeX:

\left|\mathbf{a}\right|=\sqrt{a_1^2+a_2^2+a_3^2}

The former does accurately represent the formula, but it's harder to visually parse (especially since the radical does not extend above the parenthesized expression). Another situation is when there are several fractions, which must be enclosed in parentheses if done in HTML. For large expressions with lots of fractions, it could be parentheses overload! -- Wapcaplet 11:36 19 May 2003 (UTC)

Yes, those are reasonable situations to use LaTeX. Although I might even write:

The magnitude |a| is defined to be the square root of

a12 + a22 + a32.

or at least

The magnitude |a| is defined by

|\mathbf{a}| = \sqrt{a_{1}^{2} + a_{2}^{2} + a_{3}^{3}};
that is, |a| is the square root of a12 + a22 + a32.

-- Toby Bartels 03:05 20 May 2003 (UTC)


How do I make a TeX line break?

Looks like it's a "\\" double backslash, see the Case distinctions and Multiline equations examples. -- John Owens 23:19 22 May 2003 (UTC)
I believe that line breaks (at least in the context of mathematical expression) necessarily generate a multi-line equation, which (someone correct me if I'm wrong, since I'm new at this) is currently unsupported with Wikipedia's TeX interpreter. I suppose the easiest workaround is to make two separate equations; barring that, you could put them into an N-by-1 matrix to get things onto separate lines. John is probably right also, I haven't tried it. -- Wapcaplet 23:23 22 May 2003 (UTC)
P.S. - Oh! Multiline equations are supported? I thought they weren't, for some reason... Silly me :) -- Wapcaplet 23:25 22 May 2003 (UTC)


OK, based on the recent experiment in the Wikipedia:Sandbox, it looks like the double backslash doesn't work outside a matrix, which would be a bit of a kludge. I'll experiment a bit more.... -- John Owens 23:34 22 May 2003 (UTC)

copied from Village Pump


Hello! I try to color the statement of math theorems or conjectures in order to improve readability. However, I have discovered that the image generated by <math>-tag is not transparent and so the effect turns out to be ugly: see Riemann hypothesis. Could anyone give me a helping hand? -- Wshun

Hi Wshun, I don't think there is any good way to assign background colors to formulas. Even if the white areas were transparent, the anti-aliasing effects around the symbols would still cause problems.

I do like the idea, though! I see what you're going for. Since coloring the background of the DIV is not an option, perhaps a colored border would work. Using some padding may also help set the formula out from the surrounding text:


The Riemann zeta function ζ(s) is defined for all complex numbers s≠1. It has certain so-called "trivial" zeros for s = -2, s = -4, s = -6, ... The Riemann hypothesis is concerned with the non-trivial zeros, and states that:

The real part of any non-trivial zero of the Riemann zeta function is 1/2.

Thus the non-trivial zeros should lie on the so-called critical line 1/2 + it with t a real number and i the imaginary unit.

This traditional formulation obscures somewhat the true importance of the conjecture. The zeta function has a deep connection to the distribution of prime numbers and Helge von Koch proved in 1901 that the Riemann hypothesis is equivalent to the following considerable strengthening of the prime number theorem:

\pi(x)=\int_2^x \frac{dt}{\ln(t)} + O\left(\sqrt x\,\ln(x)\right)\quad{\rm as} \quad x\rightarrow\infty

where, π(x) is the prime-counting function, ln(x) is the natural logarithm of x, and the O-notation is the Landau symbol.

The zeros of the Riemann zeta function and the prime numbers satisfy a certain duality property, known as the explicit formulae which show that in the language of Fourier analysis the zeros of the zeta function can be regarded as the harmonic frequencies in the distribution of primes.


Though, this might be the kind of thing that is of interest to other authors working on formulas. Some sort of standard practice would have to be agreed upon. Anyone else have ideas on this? Has something like this been proposed before? It seems to be a great way to highlight math markup that is especially important, just like they do in math textbooks.

-- Wapcaplet 02:37 17 Jun 2003 (UTC)

I've tried a couple other colors above; orange and purple (the blue that was there before seemed too similar to the blue link color). Anyone have a preference? Also, the border could be solid, dashed, thinner or thicker... this thickness (2 pixels) seemed like a good amount, but we could try other stuff too. Comments? -- Wapcaplet 00:23 18 Jun 2003 (UTC)

[edit] Garbled Text

Moved from Wikipedia:Village pump

Laplace transform has the 37-character string "4LIQ9nXtiYFPCSfitVwDw7EYwQlL4GeeQ7qSO", which looks suspiciously like an MD5 string, appearing in several places where it seems there should be something more intelligible. Looking through the edit history, nearly every previous revision of the article is similarly garbled. I can't imagine this has been the case and nobody has noticed for months, leading me to believe something caused both the current version and previous revisions to get garbled recently. Perhaps some problem with the LaTeX rendering? --Delirium 22:40, Jul 29, 2003 (UTC)

It's not actually a MD5 string, it's $unique2, a string used internally to temporarily replace math sections. Quoting it in articles like that will cause weird things to happen, e.g. <math>ha\ ha\ I\ stole\ your\ string</math> -> ha\ ha\ I\ stole\ your\ string. Note that the source wikitext is not garbled, it just happens when it's rendered. It's clearly a bug, well spotted. -- Tim Starling 23:11, Jul 29, 2003 (UTC)
The problem is <math> sections inside headings. As a workaround I've removed them from that article for now. -- Tim Starling 23:16, Jul 29, 2003 (UTC)
Math sections should not occur within headings. They can't be properly displayed in the TOC (PNG images are the wrong size, non-transparent etc.)—Eloquence 06:28, Jul 30, 2003 (UTC)


I think it would be better if <math> tags in headings were escaped, rather than producing the confusing output described above. -- Tim Starling 07:31, Jul 30, 2003 (UTC)
Sure, go for it. Leave me a message as soon as it's committed (preferably to stable as well), and it'll go in with the next bunch of minor updates.—Eloquence 07:47, Jul 30, 2003 (UTC)

Why doesn't WikiTeX support \rtimes? How are we ever going to write down semidirect products then? Phys

Same thing for \slashed. Phys
and \propto - Omegatron

ask on mediazilla. i got propto implemented. - Omegatron 14:28, Sep 1, 2004 (UTC)


I am not sure if this is the right place, but Japanese Wikipedians have been having a problem with TeX. Japanese scripts are in 2byte-letters, and they get the error message "Failed to parse (lexing error)" whenever they try to use Japanese letters.

When they use alphabets, it goes well. And so far, they have been trying to avoid using any Japanese letters with TeX. But for certain things, it makes more sense to use Japanese, they say.

I believe the same applies to Chinese & Korean, and probably some other languages.

Could anyone fix the problem for us? Or would you tell me where to ask this help? (Sourceforge, Wikitech-l, Wikipedia:WikiProject Mathematics?)

regards,
Tomos 16:39, 27 Aug 2003 (UTC) (I don't use TeX myself, but I'm just speaking onbehalf of others I know.)

It seems that I am getting no response, so I posted another message at Wikipedia:TeX requests. Tomos 18:47, 7 Sep 2003 (UTC)

[edit] Plan to move this page to meta soon

We need one place to develop MediaWiki documentation so I'm starting a project-neutral MediaWiki User's Guide in meta and think it would be a good idea to cross wiki redirect this page to meta:MediaWiki User's Guide: Editing mathematical formulae as soon as I'm done with the conversion (before that I will change each link to this page to a direct one to meta so that it appears correctly as an external link). --mav 00:55, 7 Sep 2003 (UTC)



I just tried to take some stuff from http://planetmath.org :

(stuff deleted by MrJones 19:40, 19 Oct 2003 (UTC))

Is this the right way to use TEX in Wikipedia? I notice this doesn't work here. I assume this is something further up the page, as I can't see anything wrong.

MrJones 20:04, 18 Oct 2003 (UTC)

Could you please not use inline TeX markup. TeX markup is best reserved for display formulae. See Wikipedia:WikiProject_Mathematics for general guidelines for mathematics articles. --Zundark 20:16, 18 Oct 2003 (UTC)
Sure. (Later...) Very helpful, particularly section seven. I'm not convinced by the arguments against using TeX, though. What proportion of hits to the wikipedia do text browsers constitute? Formulas add 300b-800b in most cases of trivial usage, assuming they are all different (if not, nothing is added save an img tag). And HTML may be adequate, but TeX may be easier. I'm glad it's available at all, but are the reasons given the only ones?

MrJones 19:40, 19 Oct 2003 (UTC)

I can't think of other reasons at the moment. It's the first reason that I'm most concerned with: the images don't fit very well with the text, so it looks rather ugly. PlanetMath has the same problem, but does at least have a "page images" mode where everything renders nicely. --Zundark 20:19, 19 Oct 2003 (UTC)

[edit] TeX / Math markup rendering problems

I'm currently having a problem with Trimagic square article: it contains some embedded math markup that is not rendered correctly (in fact, not rendered at all) despite having no apparent errors. Can anyone help with this? Thanks. -- Schnee 19:40, 19 Nov 2003 (UTC)

It appears TeX just dies when you try to use more than 10 columns:
\begin{bmatrix} 1&2&3&4&5&6&7&8&9&10 \end{bmatrix}
Failed to parse (PNG conversion failed;

check for correct installation of latex, dvips, gs, and convert): \begin{bmatrix} 1&2&3&4&5&6&7&8&9&10&11 \end{bmatrix}


I don't know why. -- Tim Starling 00:14, Nov 20, 2003 (UTC)
From the AMS-L TeX manual (PDF): "The maximum number of columns in a matrix is determined by the counter MaxMatrixCols (normal value = 10), which you can change if necessary using LaTeX's \setcounter or \addtocounter commands." Unfortunately, \setcounter and \addtocounter can't be used within the Wikipedia math mode, so either wide matrices have to be avoided, or the counter will have to be increased on the backend (which may slightly increase rendering cost in time and/or memory—how much so I have no idea). --Delirium 10:04, Nov 20, 2003 (UTC)


Given that the TeX renderings are cached (they are... aren't they?), this shouldn't be much of a problem. -- Schnee 16:16, 20 Nov 2003 (UTC)
Just an editorial comment regarding complexity of math in some of these articles: please remember this is an encyclopedia and not a post-graduate mathematics textbook. Daniel Quinlan 01:17, Nov 20, 2003 (UTC)
Your general point may have so validity... but trimagic square and its prerequisite magic square require no mathematics beyond that taught to a youngish schoolchild (the age of the schoolchild depends on the country you are in). Now if you were to pick on Weierstrass preparation theorem on the other hand... Pete 08:59, 20 Nov 2003 (UTC)
Regarding "complexity of math" ... surely an article is not to be considered inappropriate simply because it handles complex issues, provided always that it presents them with clarity ? We are told that there are no size limits. There are guidelines for writing a clear mathematics article at WikiProject Mathematics and most of the mathematics articles that I have seen here are very clearly written. Incidentally, I thought Schnee's contributions on magic squares and magic cubes were completely fascinating. -- Gandalf61 13:14, Nov 20, 2003 (UTC)
I don't see any problem at all with presenting even the most complex mathematical topics in Wikipedia. The articles should be written in a way that does not assume that the reader is already intimately familiar with the subject that is being talked about, of course, and thus will probably be written in a less compressed way than a mathematical textbook, but limiting what can have an entry in Wikipedia because it might not be understandable outright and without further reading to a typical person would be silly. -- Schnee 16:16, 20 Nov 2003 (UTC)
Yes, that was sort of my point. I was speaking of the level of mathematics knowledge required and complexity of formulas used with no introduction, not the advanced level of topics. Daniel Quinlan 10:20, Nov 21, 2003 (UTC)

[edit] why do I see square boxes in math formula?

Often a square box appears in math formulas where I would expect a character. I guess this means my browser can't render the charachter. How can I fix this or get around the problem to find out what charachter should be in the place of the square box?

Thanks

If you log in, then you will be able to set the formula rendering style in your user preferences. It sounds like the "always render PNG" option would be best for you. -- Tim Starling 23:25, Dec 2, 2003 (UTC)
FWIW, this is one reason to prefer always using TeX markup, even for relatively short formulas, rather than ∫ and other such HTML entities. Another reason is ease of future conversion to other (non-HTML) formats. --Delirium 04:32, Dec 4, 2003 (UTC)
Setting preferences doesn't help if the markup is html to begin with. Perhaps someone could run a script to convert all html entities unsupported by the major browsers to TeX? Also, the definition of "simple math" in preferences should be based on what is supported by browsers--Voodoo 12:37, 9 Apr 2004 (UTC)

[edit] How do I make semidirect products?

Does anybody know how to render semidirect products? For example a formula like this: HXK.

--User:sander123 22 Dec 2003

You can type that in Math mode as follows $H \rtimes K$

[edit] ^ symbol?

I want to know how to add a caret (^) over a character, as for unit vectors in physics formulas. --Smack 04:28, 12 Apr 2004 (UTC)

\hat a b \widehat {abcd}

\hat a b \widehat {abcd}

someone should add that to the description

- Omegatron 04:54, Apr 12, 2004 (UTC)


[edit] LaTeX rasterizer

On Lp space, the first three displayed LaTeX forumlae keep on looking different to me -- sometimes some forumlas come out "thinner" than others (look at the rendering of the variable x in particular -- sometimes it's really thin) but sometimes when I refresh I get thicker versions. Lately the second forumla's too thin and the first and third look OK. How can I get the thin forumlas regenerated with the thicker rasterizer? Lupin 09:19, 1 Jul 2004 (UTC)

I want "thick" back too, but I'm pretty sure you can't control which is rendered as which. TeX images are cached - you are probably viewing the images created using "thick", and the newer images are created with the newer "thin". Dysprosia 04:09, 3 Jul 2004 (UTC)

[edit] Is there any reason this page has not been turned into a redirect?

Around a year ago, it was suggested that this page be turned into a redirect to the copy at meta. Is there any reason this has not happened yet? If I get no objections, I'll do it. JesseW 10:51, 22 Nov 2004 (UTC)

[edit] Ksi?

How can I make a Ksi greek symbol? (It seems Wiki Markup does't know this letter). You know, Ksi likes this: [|] if you view from <- |-:< here. Gubbubu

Failed to parse (unknown function\Ksi): \Ksi

Failed to parse (unknown function\Chsi): \Chsi

Failed to parse (unknown function\Csi): \Csi

Failed to parse (unknown function\Khsi): \Khsi

Ξ ?

You see, all these are failed.

You seem to have answered your own questions---\Xi and \xi give Ξ and ξ. I remember this being the spelling that TeX uses. If it's not displaying for you, change your math preferences to use images. (So you'll get \Xi\,\!.) grendel|khan 14:07, 2004 Dec 12 (UTC)

[edit] Upright Greek

Why is it that the TeX macros for the uppercase Greek letters which are not ordinarily defined in plain TeX or LaTeX result in slanted letter shapes? I'm talking about the difference between

\Alpha \Beta \Epsilon\!\,

on the one hand (not part of plain TeX, slanted), and

\Gamma \Delta \Theta\!\,

on the other (part of plain TeX, upright). Shouldn't \Alpha be defined as something like

\def\Alpha{\mathrm{A}}

instead? --MarkSweep 06:08, 23 Dec 2004 (UTC)

Well, \Alpha isn't defined in plain TeX or LaTeX. (I just checked.) Must be something in texvc. I'd submit a bug to Bugzilla on this one. grendel|khan 09:59, 2004 Dec 23 (UTC)
Yes, I see it's defined that way in texutil.ml. I'll file a bug report. --MarkSweep 21:13, 23 Dec 2004 (UTC)