Help talk:Displaying a formula/Archives/2004

From Meta, a Wikimedia project coordination wiki

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 "&"?
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)

Rightleftharpoons

Why is <math>\rightleftharpoons</math> giving a parser error? According to my TeX-book that is a valid plain TeX symbol already.

Andy

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)

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)

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)

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)

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)

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)

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)

Mathcal extra symbols?

There's a few extra symbols if you do lowercase mathcal. I dunno if they are useful:

Extra characters

\mathcal {1234567890abcdefghijklmnopqrstuvwxyz}

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)

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

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)

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

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

&#x2234; &#x2235; ∴ ∵ 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:
Looks like a bug report is in order.

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)

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)

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)

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

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)

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]