Note: You are currently viewing documentation for Moodle 2.0. Up-to-date documentation for the latest stable version is available here: Using MimeTeX.

Using MimeTeX: Difference between revisions

From MoodleDocs
m (redirect)
 
(29 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{stub}}
#redirect [[Using TeX Notation]]
 
MimeTeX is used as a default Tex Notation system in Moodle 1.9.x and now in Moodle 2.0. Using it is not simple, but this is not an issue for Moodle, but rather in the manner in which TeX notation has developed. The various brands of TeX and other math markup languages that have developed has become something of a nightmare to try and track consistently. Most use sub-sets and variations of TeX rules and fonts and symbols that seem to be developed on the whim of the developer rather than any consistent mathematical strategy. Also the lack of user friendly documentation has not helped, but what is worse, and this is the problem for the Moodle Community, the lack of directly related documentation in using MimeTeX in Moodle has not been useful.
 
Please help by adding your own examples and rules to these pages. If you notice an error, please change it, if you see something missing, please add it.
 
==Language Conventions==
 
To invoke the MimeTeX filter is to 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}} $$
 
  [[Image:cfmimetex01.gif|frame|center|150px|Fraction and square root.]]
 
Additional spaces are placed into the equation by using the \ without a leading or trailing character.
 
==Reserved Characters and Keywords==
 
As with any computing language there are a set of reserved characters and keywords that are used by the program for its own purposes. MimeTeX is no different, but it does have a very small set of Reserved Characters. Most characters and number on the keyboard can be used at their default value. This will not be a complete list, but some of these are:
 
  @ # $ % ^ & * ( ) .
 
The Keywords, they are different. There is only one that is of concern here and that it the word "line". If the \line control sequence is not properly implemented, then the consequences can be indeterminate. Controlling lines is an adventure of its own, so getting it right when written is important, you can always reposition the line, but you might get it really wrong if you do not use it with some caution. To use the \line control sequence, go to your text editor, open the filter\lib.php file, and at about line 48, you will see the word "\line". Delete it from the list. If you do not have direct access to the server, then the whole thing becomes problematic. You may want to download and install your own Moodle and develop things there rather than on your production site. You can write things out in your own Moodle, render the statement, save the image and then upload it to your production site. If something goes seriously wrong, it is easier to restart your own Moodle than it is your production site.
 
==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>

Latest revision as of 16:30, 13 July 2010

Redirect to: