Материал готовится,

пожалуйста, возвращайтесь позднее

пожалуйста, возвращайтесь позднее

Getting to Grips with LaTeX

Mathematics - Part 1

by Andrew Roberts

One of the greatest motivating forces for Donald Knuth when he began developing the original TeX system was to create something that allowed simple construction of mathematical formulae, whilst looking professional when printed. The fact that he succeeded was most probably why Tex (and later on, LaTeX) became so popular within the scientific community. Regardless of the history, typesetting mathematics is one of LaTeX's greatest strengths. However, it is also a large topic due to the existence of so much mathematical notation. So, this will be part one - getting to know the basics.

Maths environments

LaTeX needs to know beforehand that the subsequent text does in fact contain mathematical elements. This is because LaTeX typesets maths notation differently than normal text. Therefore, special environments have been declared for this purpose. They can be distinguished into two categories depending on how they are presented:

text - text formulae are displayed inline, that is, within the body of text were it is declared. e.g., I can say that a + a = 2a within this sentence.

displayed - displayed formulae are separate from the main text.

As maths require special environments, there are naturally the appropriate environment names you can use in the standard way. Unlike most other environments however, there are some handy shorthands to declaring your formulae. The following table summarises them:

Type Environment LaTeX shorthand Tex shorthand

Text \begin{math}...\end{math} \(...\) $...$

Displayed \begin{displaymath}...\end{displaymath} \[...\] $$...$$

Additionally, there is second possible environment for the displayed type of formulae: equation. The difference between this and displaymath is that equation also adds sequential equation numbers by the side. See mathenv.pdf for an illustration of how the various basic environments are used.

Symbols

Mathematics has lots and lots of symbols! If there is one aspect of maths that is difficult in LaTeX it is trying to remember how to produce them. There are of course a set of symbols that can be accessed directly from the keyboard:

+ - = ! / ( ) [ ] < > | ' :

Beyond those listed above, distinct commands must be issued in order to display the desired symbols. And there are a lot! Greek letters, set and relations symbols, arrows, binary operators, etc. Too many to remember, and in fact, they would overwhelm this tutorial if I tried to list them all. Therefore, for a complete reference document, try symbols.pdf. We will of course see some of these symbols used throughout the tutorial.

Fractions

To create a fraction, you must use the \frac{numerator}{denominator} command. (For those who need their memories refreshed, that's the top and bottom respectively!) You can also embed fractions within fractions, as shown in the examples below:

\frac{x+y}{y-z}

\frac{\frac{1}{x}+\frac{1}{y}}{y-z}

Powers and indices

Powers and indices are mathematically equivalent to superscripts and subscripts in normal text mode. The carat (^) character is used to raise something, and the underscore (_) is for lowering. How to use them is best shown by example:

Power x^n

x^{2n}

Index n_i

n_{ij}

Note: if more than one character is to be raised (or lowered) then you must group them using the curly braces ( { } ).

Mathematics - Part 1

by Andrew Roberts

One of the greatest motivating forces for Donald Knuth when he began developing the original TeX system was to create something that allowed simple construction of mathematical formulae, whilst looking professional when printed. The fact that he succeeded was most probably why Tex (and later on, LaTeX) became so popular within the scientific community. Regardless of the history, typesetting mathematics is one of LaTeX's greatest strengths. However, it is also a large topic due to the existence of so much mathematical notation. So, this will be part one - getting to know the basics.

Maths environments

LaTeX needs to know beforehand that the subsequent text does in fact contain mathematical elements. This is because LaTeX typesets maths notation differently than normal text. Therefore, special environments have been declared for this purpose. They can be distinguished into two categories depending on how they are presented:

text - text formulae are displayed inline, that is, within the body of text were it is declared. e.g., I can say that a + a = 2a within this sentence.

displayed - displayed formulae are separate from the main text.

As maths require special environments, there are naturally the appropriate environment names you can use in the standard way. Unlike most other environments however, there are some handy shorthands to declaring your formulae. The following table summarises them:

Type Environment LaTeX shorthand Tex shorthand

Text \begin{math}...\end{math} \(...\) $...$

Displayed \begin{displaymath}...\end{displaymath} \[...\] $$...$$

Additionally, there is second possible environment for the displayed type of formulae: equation. The difference between this and displaymath is that equation also adds sequential equation numbers by the side. See mathenv.pdf for an illustration of how the various basic environments are used.

Symbols

Mathematics has lots and lots of symbols! If there is one aspect of maths that is difficult in LaTeX it is trying to remember how to produce them. There are of course a set of symbols that can be accessed directly from the keyboard:

+ - = ! / ( ) [ ] < > | ' :

Beyond those listed above, distinct commands must be issued in order to display the desired symbols. And there are a lot! Greek letters, set and relations symbols, arrows, binary operators, etc. Too many to remember, and in fact, they would overwhelm this tutorial if I tried to list them all. Therefore, for a complete reference document, try symbols.pdf. We will of course see some of these symbols used throughout the tutorial.

Fractions

To create a fraction, you must use the \frac{numerator}{denominator} command. (For those who need their memories refreshed, that's the top and bottom respectively!) You can also embed fractions within fractions, as shown in the examples below:

\frac{x+y}{y-z}

\frac{\frac{1}{x}+\frac{1}{y}}{y-z}

Powers and indices

Powers and indices are mathematically equivalent to superscripts and subscripts in normal text mode. The carat (^) character is used to raise something, and the underscore (_) is for lowering. How to use them is best shown by example:

Power x^n

x^{2n}

Index n_i

n_{ij}

Note: if more than one character is to be raised (or lowered) then you must group them using the curly braces ( { } ).

Загрузка...

Выбрать следующее задание

Ты добавил

Выбрать следующее задание

Ты добавил