Difference between revisions of "Writing Tex Notation"
(New page: ==Using TeX Notation with the UVLe Tex filter== Go to '''Course Administration > Filters''' and make sure that the Tex Notation is '''ON''' ==Language Conventions== To invoke the TeX f...) 

Line 17:  Line 17:  
==Available Characters==  ==Available Characters==  
−  There seems to be a number of differences between what characters are available in Tex Notation and what are not and what is described in Mimetex. There also seems to be great discrepancies between what the Tex and Latex manuals tell you is available and what is actually available. If you are using such manuals or web sites, they are likely to be more confusing than helpful. [  +  There seems to be a number of differences between what characters are available in Tex Notation and what are not and what is described in Mimetex. There also seems to be great discrepancies between what the Tex and Latex manuals tell you is available and what is actually available. If you are using such manuals or web sites, they are likely to be more confusing than helpful. [http://docs.moodle.org/20/en/Using_TeX_Notation_2 Using TeX Notation 2] shows a lot of what is available, but not all. 
Revision as of 01:26, 22 August 2011
Contents
Using TeX Notation with the UVLe Tex filter
Go to Course Administration > Filters and make sure that the Tex Notation is ON
Language Conventions
To invoke the TeX filter, use the $$ symbols to open and close statements. To invoke a particular command or control sequence, use the backslash, \. A typical control sequence looks like:
$$ x\ =\ \frac{\sqrt{144}}{2}\ \times\ (y\ +\ 12) $$
Fraction and square root. 
Available Characters
There seems to be a number of differences between what characters are available in Tex Notation and what are not and what is described in Mimetex. There also seems to be great discrepancies between what the Tex and Latex manuals tell you is available and what is actually available. If you are using such manuals or web sites, they are likely to be more confusing than helpful. Using TeX Notation 2 shows a lot of what is available, but not all.
Reserved Characters and Keywords
Most characters and numbers on the keyboard can be used at their default value. As with any computing language, though, there are a set of reserved characters and keywords that are used by the program for its own purposes. TeX Notation is no different, but it does have a very small set of Reserved Characters. This will not be a complete list of reserved characters, but some of these are:
@ # $ % ^ & * ( ) .
To use these characters in an equation just place the \ in front of them \$ or \%. If you want to use the backslash, just use \backslash. The only exception here seems to be the &, ampersand. See the characters listed in Using TeX Notation 2 for more details.
Maths Mode
A full TeX version has three modes, a "text mode", an "inline maths mode" and a "maths display mode" but UVLe seems to stay in "inline maths mode". Perhaps a better description of what happens is that UVLe allows a writer to enter "inline maths mode" when the $$ symbols are written and leave it when the $$ symbol appears a second time. UVLe does not appear to use the "maths display mode". The command sequences beginning with the $$ are not current practice in any major version of TeX, and why they are used and work in UVLe is not an issue for discussion here. Current common practice in most other flavours of TeX uses a different set of command initiation sequences.
Superscripts, Subscripts and Roots
Superscripts are recorded using the caret, ^, symbol. An example for a Maths class might be:
$$ 4^2 \ \times \ 4^3 \ = 4^5 $$ This is a shorthand way of saying: (4 x 4) x (4 x 4 x 4) = (4 x 4 x 4 x 4 x 4) or 16 x 64 = 1024. <math>4^2 \ \times \ 4^3 \ = 4^5</math>
Subscripts are similar, but use the underscore character.
$$ 3x_2 \ \times \ 2x_3 $$ <math>3x_2 \ \times \ 2x_3</math>
This is OK if you want superscripts or subscripts, but square roots are a little different. This uses a control sequence.
$$ \sqrt{64} \ = \ 8 $$ <math>\sqrt{64} \ = \ 8</math>
You can also take this a little further, but adding in a control character. You may ask a question like:
$$ If \ \sqrt[n]{1024} \ = \ 4, \ what \ is \ the \ value \ of \ n? $$ <math>If \ \sqrt[n]{1024} \ = \ 4, \ what \ is \ the \ value \ of \ n?</math>
Using these different commands allows you to develop equations like:
$$ The \sqrt{64} \ \times \ 2 \ \times \ 4^3 \ = \ 1024 $$ <math>The \sqrt{64} \ \times \ 2 \ \times \ 4^3 \ = \ 1024</math>
Superscripts, Subscripts and roots can also be noted in Matrices.
Fractions
Fractions in TeX are actually simple, as long as you remember the rules.
$$ \frac{numerator}{denominator} $$ which produces <math>\frac{numerator}{denominator}</math> .
This can be given as:
<math>\frac{5}{10} \ is \ equal \ to \ \frac{1}{2}</math>.
This is entered as:
$$ \frac{5}{10} \ is \ equal \ to \ \frac{1}{2}.$$
With fractions (as with other commands) the curly brackets can be nested so that for example you can implement negative exponents in fractions. As you can see,
$$\frac {5^{2}}{3}$$ will produce <math>\frac {5^{2}}{3}</math>
$$\left(\frac{3}{4}\right)^{3}$$ will produce <math>\left(\frac{3}{4}\right)^{3}</math> and
$$\frac{3}{4^{3}}$$ will produce <math> \frac{3}{4^{3}} </math>
You likely do not want to use $$\frac{3}{4}^{3}$$ as it produces <math>\frac{3}{4}^{3}</math>
You can also use fractions and negative exponents in Matrices.
Brackets
As students advance through Maths, they come into contact with brackets. Algebraic notation depends heavily on brackets. The usual keyboard values of ( and ) are useful, for example:
<math>d = 2 \ \times \ (4 \  \ j)</math>
This is written as:
$$ d = 2 \ \times \ (4 \  \ j) $$
Usually, these brackets are enough for most formulae but they will not be in some circumstances. Consider this:
<math>4x^3 \ + \ (x \ + \ \frac{42}{1 + x^4})</math>
Is OK, but try it this way:
<math>4x^3 \ + \ \left(x \ + \ \frac{42}{1 + x^4}\right)</math>
This can be achieved by:
$$ 4x^3 \ + \ \left(x \ + \ \frac{42}{1 + x^4}\right) $$
A simple change using the \left( and \right) symbols instead. Note the actual bracket is both named and presented. Brackets are almost essential in Matrices.
Ellipsis
The Ellipsis is a simple code:
<math>x_1, \ x_2, \ \ldots, \ x_n</math>
Written like:
$$ x_1, \ x_2, \ \ldots, \ x_n $$
A more practical application could be:
Question:
"Add together all the numbers from 1 <math>\ldots</math> 38. What is an elegant and simple solution to this problem? Can you create an algebraic function to explain this solution? Will your solution work for all numbers?"
Answer: The question uses an even number to demonstrate a mathematical process and generate an algebraic formula.
Part 1:  Part 2.  Part 3. 
<math>1. \ 1 \ + \ 38 \ = \ 39</math> <math>2. \ 2 \ + \ 37 \ = \ 39</math> <math>3. \ 3 \ + \ 36 \ = \ 39</math> <math>\ldots</math> <math>19. 19 \ + \ 20 \ = \ 39 </math> <math>\therefore x \ = \ 39 \ \times \ 19 </math> <math>\therefore x \ = \ 741 </math>

An algebraic function might read something like:
<math>t = (1 + n) \times n/2 </math> Where t = total and n = the last number. 
The solution is that, using the largest and the smallest numbers, the numbers are added and then multiplied by the number of different combinations to produce the same result adding the first and last numbers.
The answer must depend on the number, <math>\frac{n}{2}</math> being a whole number. Therefore, the solution will not work for an odd range of numbers, only an even range. 
Source: Tex Tutorial