Karakas Online

10.2. Writing Mathematics in LyX

You write Mathematics in LyX just as you would write it anyway, i.e. as if it were going to be processed by TeX and not Jade. The whole combined power of TeX/LaTeX/LyX lies at your fingertips! So let 's try some math here! This is a numbered displayed equation:

Equation 10-2. (eq3)

An example of an unnumbered equation:

Equation 10-3. (eq4)

And here is an example of an inline formula: , or again .

This is a partially numbered displayed equation:

Equation 10-4. (eq5)

while in this one all equations are numbered:

Equation 10-5. (eq6)

Now, let's do some more advanced examples:

Equation 10-6. (eq7)

How about these: a matrix

Equation 10-7. (eq8)

a partially filled matrix

Equation 10-8. (eq9)

a continued fraction

Equation 10-9. (eq10)

a limit

Equation 10-10. (eq11)

and some inequalities

Equation 10-11. (eq12)

Equation 10-12. (eq13)

Equation 10-13. (eq14)

Here is an inline inequality, with a proof of non-negativity of relative entropy ( ): show that , for Then observe that (here comes an inequality array):

Equation 10-14. (eq15)

If you are looking at the PDF or PS version of this document, everything will look perfect, because it was typeset directly by TeX. But if you are reading the HTML or RTF version, then you might have noticed that the equation numbering is not continuous. Rather it starts all over from (1) in each multiline equation. This is a bug of the method we use: each equation, be it inline or displayed, one line, or multi-line, will be processed by TeX as a separate document (only for HTML and RTF), starting the numbering from 1 over and over again. Till some TeX Guru (anyone reading?) out there tells me how to work around this, the simplest solution for equation numbering is to follow the rules below:

  1. Don't put more than one labels in a multi-line equation (an equation array in LaTeX jargon). If you absolutely need to, split the equation in two, containing only one label each.

  2. Start each equation label with “eq”, followed by a number, like “eq1”, “eq2”, “eq78” etc. My scripts number each displayed equation (i.e. not the inline ones) consequtively through the whole document, automatically assigning an id and a title to them in the SGML code. These ids and titles are always of the form “eqxxx” where xxx is the number of the equation and refer to the whole equation, not some line of it. On the other hand, LyX knows only of equation labels assigned to some line of some equation. If you followed the previous rule and if you name the one and only label of your equation with the “eqxxx” label displayed in its title, then you can refer to it from LyX like any other cross-reference and everything will work perfectly!

  3. The best way to implement the previous rule is to just process your document once without any labels in equations. You will see that all versions will have concise and continuous numbering in the equation titles. You will see titles like “Equation 11-1. (eq2)”. The “11-1” comes from Jade and means “the first equation of chapter 11”. The “(eq2)” is the title, assigned automatically by my scripts. Now, if you want to label this equation in LyX, label only one line of it (first rule) and label it “eq2” (second rule[1]).

Notes

[1]

of course, you take away the quotes

Last updated Mon Sep 24 01:19:25 CEST 2007 Permalink: http://www.karakas-online.de/mySGML/lyx-writing-mathematics.html All contents © 2002-2007 Chris Karakas