Encyclopedia > Wikipedia talk:TeX markup

  Article Content

Wikipedia talk:TeX markup

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

Note you can just do \mathbf{} everywhere you need it: e.g. \mathbf{F} = q \mathbf{v} \times \mathbf{B} : <math>\mathbf{F} = q \mathbf{v} \times \mathbf{B}</math>. Kind of a pain, but it works. I suspects renewcommand is disabled to prevent some kind of nasty security issue. -- DrBob

And, of course, that should be rendered as F = qv × B wherever possible. -- 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

integrals over curves

<math>\int_C {a \over b }</math> 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:

<math>\int\nolimits_C {a \over b }</math>
Ap Sun Jan 19 02:30:11 UTC 2003


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

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


Suggestion: where possible, <math>(a_1,b_1] \times (a_2,b_2]</math> 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


<math>\mathfrak{Hello Wikipedia!}</math>

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)


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:

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

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
<math>|\mathbf{a}| = \sqrt{a_{1}^{2} + a_{2}^{2} + a_{3}^{3}}; </math>
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:

<math>\pi(x)=\int_2^x \frac{dt}{\ln(t)} + O\left(\sqrt x\,\ln(x)\right)\quad{\rm as} \quad x\rightarrow\infty</math>
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)



All Wikipedia text is available under the terms of the GNU Free Documentation License

 
  Search Encyclopedia

Search over one million articles, find something about almost anything!
 
 
  
  Featured Article
List of intelligence agencies

... (FSB, successor of KGB) Glavnoye Razvedyvatelnoye Upravlenie[?] (GRU) Sluzhba Vneshney Razvedki[?] (SVR) Union of Soviet Socialist Republics (USSR) Cheka ...

 
 
 
This page was created in 40.3 ms