Some rules for typing mathematics

advertisement
The typesetting of mathematics for engineers
John Fenton
This is a document setting out my views on the good presentation of
technical documents with mathematics. It contains what I hope are useful
schemes for automatically generating and ordering equation numbers, so that
they, and cross-references to them are changed automatically when they are
moved. Also a Macro is included for easily inserting displayed equations
with automatic generation of equation numbers.
Contents
Some rules for typing mathematics ......................................................................................................... 1
Some tips on typing scientific documents in Word ................................................................................. 2
Entering equations and their numbers: ................................................................................................ 2
Captions to Figures and Tables ........................................................................................................... 3
Macros – and one for quickly entering a numbered equation ............................................................. 3
LaTeX...................................................................................................................................................... 4
Discussion by Tobias Bleninger .............................................................................................................. 5
Some rules for typing mathematics

Displayed equations are punctuated, just as if they are part of the text, usually with a comma
or a full stop. Thus for example, Einstein (1905) obtained
E  mc 2 ,
(1)
although Fenton (2002) claimed that this was an engineering approximation, and was actually
E  mc 2 / 3 .
(2)

In the text, I think it is better to refer to equations as "equation (23)" rather than just "(23)" or
"equation 23" or the ASCE's "Eqn. (23)". This avoids any confusion with references to figure
23, for example. The Australian Style Manual suggests the lower case "figure", "table", etc.
which seems to be a good idea and practice.

In mathematical expressions, italicise variable names – and the names only – written in Latin
script, such as a, f(x), Ak, A3: in those symbols, those italicised were a, f, x, A, k, and A
respectively. Not italicised were "(", ")", and "3". If the Equation Editor in MS Word is
configured correctly (see below) this is done automatically.
1

Never italicise Greek or other symbols or numbers. Compare the incorrectly italicised
 2 / x 2  a with the correct version:  2  / x 2  a . Microsoft Word uses a poor factory
default for the typeface of equations. To ensure the automatic correct version, in the Equation
Editor, go Style/Define, then Variable should be italicised, Matrix-vector should be bold, but
all others should be left unchecked.

In the text always use exactly the font you use in displayed equations – which is done best by
using the Equation Editor if you use MS Word. Hence, if you used E a,1 in a displayed
equation, refer to it in the text as E a,1 - and not Ea,1. Even italicising ordinary text is only OK
for a single Latin symbol and adornments – consider Ea,1, where neither the comma nor the
number should have been italicised. And never use symbols without using the equation editor.
Compare the version f(x)=√(x+3) with that of Equation Editor f ( x)  x  3 . Use the
equation editor if you have anything more complicated than a single Latin symbol in the text.
Inserting equations as symbols is hard work.
a
) – use a solidus instead (e.g. a / b ).
b

Never use fractions in in-line text (e.g.

And, never underline text to emphasise it – use italics or bold. Underlining is unknown in
typography. It was traditionally used with a typewriter or by hand for emphasis, and was the
convention to give instructions to a professional typesetter for the type to be set in italics.
Some tips on typing scientific documents in Word
Entering equations and their numbers:
1. It’s a good idea to use a separate Style “Equation”, say, which has more space before and after the
paragraph. I use three tabs in this style, one left tab indented a centimetre, in case you have a long
equation, and you start the equation there, one centre tab in the middle of the line and one right tab
on the right margin for equation numbers. I assign F6 to this style. Anybody reading this using
Word could copy any line below containing an equation, and you have the style – possibly then
copy it over to Normal.dot.
E  mc 2
(3)
2. Then, when you want to enter a displayed equation in the centre, go: New line, style to
“Equation”, tab tab, enter equation editor, type the equation, close, tab, insert “(“. Go
Insert/Field/”Seq Eq”/OK, type “)” – as all this is the same for all equations it could be copied and
pasted from a previous equation. I present a Macro for this at the end of this document that makes
this much easier.
3. Now, to make it a bookmark so that you can refer to that equation, select the equation number with
the brackets. Go Insert/Field/Bookmark/”e13”/OK, (for example). I have assigned
Go/Insert/Field/Bookmark for these operations to a button in the Toolbars – a key combination
would probably be easier. (Note that the label for equation (3) above is a bookmark - which is
clear if you have gone Tools/Options/View/Show/Bookmarks).
4. Thereafter, whenever you need to refer to it, go Insert/Crossreference/Bookmark/”e13” etc. I use
an assigned button for this too.
5. Size: In equation mode, go Size/Define – Full should be the same font size as the rest of the text.
2
6. Viewing on screen: I prefer to see which equation numbers have been automatically generated or
which are references to bookmarks (go Tools/Options/View/Show/Field shading – select Always)
and to see those which have been bookmarked: Tools/Options/View/Show - check Bookmarks).
An example follows. Note how equations are always punctuated, with a full stop or a comma as
appropriate. The equation should read as part of the text – although displayed. It would be very rare
for there to be any other form of punctuation. Here is an example of an equation that can be
punctuated with a full stop:
a b.
(4)
As an example of a reference to an equation, we use a reference to a bookmark to refer to equation (4),
which, as we included the brackets in the bookmark, comes up with brackets and all. Another equation
follows, which is punctuated with a comma:
N
J  r j ,
(5)
j 1
because there is text following it, just as if it were part of a sentence, which it is.
Now, we conclude with a reference in the reverse order to equations (5) and (4). I always honour the
equation number with the word “equation(s)” preceding it. It is a slightly leaden style, but it reads well
and avoids any possible ambiguity with figure and table numbers, which are never placed in brackets.
Captions to Figures and Tables
Automatic numbering of captions in Word works very well (Insert/Caption/Figure). Here is an
example:
Ordinarily this text would be a table or a figure. I always put them in a style
“Caption”, which this is, which is down a point in font size, has generous spacing
between paragraphs, is indented left and right and is centred. Then, with a new
paragraph for the actual caption, as follows, it looks quite well:
Figure 1: This is Caption style, the label inserted with Insert/Caption/Figure. A
colon or full stop is OK after the number.
However it might be nicer to use a block indented style:
Figure 2: This was done with Insert/Caption/Figure. A colon or full stop is OK after
the number. This is Caption style.
And now we refer to that figure/table by Insert/Cross-reference/Only label and number/Select your
number, to give Figure 1. Now, whenever you shift around or delete equations, tables or figures, the
numbering automatically changes.
Macros – and one for quickly entering a numbered equation
For typing equations it is quicker to use macros as much as possible, and then to have keystrokes or
buttons assigned (do this using Tools/Customize/Commands – and then possibly Keyboard). I always
bring up Equation Editor with Control-E, and simply use Escape to close.
Here is a macro which you might find useful – it puts in a new line in "Equation" style, puts in three
tabs to bring it to the end of the line, inserts an equation number, backtracks to the centre of the line
and opens the equation editor.
3
1. Go Format/Style/Press Organizer, select Equation, copy to the right >>, Close. You now have my
Equation style.
2. Select all the lines shown here in red:
Selection.TypeParagraph
Selection.Style = ActiveDocument.Styles("Equation")
Selection.TypeText Text:=vbTab & vbTab & vbTab & "("
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
"SEQ Eq", PreserveFormatting:=True
Selection.TypeText Text:=")"
Selection.HomeKey Unit:=wdLine
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.InlineShapes.AddOLEObject ClassType:="Equation.3", FileName:="", _
LinkToFile:=False, DisplayAsIcon:=False
3. Copy to the clipboard.
4. Go Tools/Macro/Macros, type in the Macro name of your choice (single word), press Create.
5. Paste contents of clipboard, Save the macro file (use the diskette icon), Go File/Close and return.
6. Go Tools/Customize/Keyboard (at the bottom), Categories – scroll down to Macros and select it,
Macros – scroll down and select the name of the one you have just created, Press new shortcut key
– "Control Q" maybe, Press Assign, Press Close.
7. Typing "Control Q" now gives you a line with equation number and opens the equation editor.
Note that the equation number doesn't increment until you go File/Print Preview.
Good luck!
LaTeX
For most of my documents, I use LaTeX instead, which is almost universally used by mathematicians,
physicists, electrical engineers, etc, and is more popular in Germany than elsewhere. It is shareware. It
is not so easy to use, and is not WYSIWYG – for example "$y=\beta \sqrt{x+3}$" gives you
y   x  3 after processing, but many people might find typing that easier than going in and out of a
special equation editor. Numbering of equations etc. occurs in the text, and is simple and effective
("\ref{eq12}"). I use a Windows front end version ("Scientific Word") which looks like Word, but
where the equation editor is part of the normal typing process, and is rather easier to use. The
Windows front end I have is expensive, however. In support, Trevor Waechter wrote to me after my
talk:
I think we can make a plug for LaTeX. The latest MiKTeX 2.1 installs quite brilliantly.
The editor WinEdt 5.3 is excellent with numerous new options. It is the only item that
4
costs -- the sum of $US30. The other items needed are GhostScript and Ghostview are
free as is MiKTeX. You may install the large version of MiKTeX, and use WinEdt as the
text editor and manager, and then create pdf and ps files to your heart's desire. The way
LaTeX handles footnotes, references, equation numbers is blindingly simple. You have
one click display of what you have been calling WYSIWYG.
Both WinEdt and MiKTeX are supported by email groups that are stocked in Yahoo
Groups, and what you get there is usually of daily interest.
I agree – WinEdt is a wonderful text editor, which I use all the time for all sorts of purposes. I accept
Trevor's comments about the other packages. Part of the philosophy of LaTeX is that it be shareware.
Discussion by Tobias Bleninger
I fully agree with all recommendations and statements from John and greatly appreciate his text. I just
wanted to give one additional comment related to equations in MS Word. John used mainly the
equation editor in word to type equations. This seems to be easy, but if one knows LaTeX it is really
neither elegant nor efficient enough. However, MS Word has a rather good field function system,
which can be used to write equations in a similar way as with LaTeX.
To include a new equation go to “Insert” then to “Field” or simply pressing CTRL+F9. This gives you
an empty field
Depending on your Word configuration, the field is gray shaded or not. There are numerous field
functions available (e.g. check under http://addbalance.com/usersguide/fields.htm). We are going to
use only the function EQ which stands for equation. The field function
Error!
has the operater \f for fraction followed by the parameters to be put. You can use symbols and
formatting as you are used to within the fields. Right click on the field, and choosing “field function
on/off” gives you the desired result:
Error!
The easiest is thus to copy an existing equation (together with the format and numeration, and just
modifying it accordingly). For example
Error!
(1)
with another field function for a sequence (starting at one).
Typical switches for this function are (taken from http://office.microsoft.com/en-au/word-help/fieldcodes-eq-equation-field-HP005186148.aspx):
Important: Some switches require a list of elements separated by commas or semicolons. Use commas
as the separators if the decimal symbol for your system is a period (specified as part of the regional
settings in Microsoft Windows Control Panel). If the decimal symbol for your system is a comma, use
semicolons.
Array switch: \a()
5
Arrays elements in multiple columns; elements appear in order by rows. The following
options modify the \a switch.
\al
Aligns left within columns.
\ac
Aligns center within columns.
\ar
Aligns right within columns.
\con
Arrays elements in n columns (the default is 1).
\vsn
Adds n points of vertical spacing between lines.
\hsn
Adds n points of horizontal spacing between columns.
Example{ EQ \a \al \co2 \vs3 \hs3(Axy;Bxy;A;B) } displays the following:
Bracket: \b()
Brackets a single element in a size appropriate to the element. The default brackets are
parentheses. The following options can modify the \b switch.
\lc\c
Draws the left bracket using the character c.
\rc\c Draws the right bracket using the character c.
\bc\c Draws both bracket characters using the character specified for c.
If the character you specify is {, [, (, or <, Word uses the corresponding closing character as
the right bracket. If you specify any other character, Word uses that character for both
brackets.
Example{ EQ \b \bc\{ (\r(3;x)) } displays .
{ 3;x}
Displace: \d()
Controls where the next character following the EQ field is drawn. The following options can
modify the \d switch. Note that empty parentheses follow only the last option in the
instructions.
\fon () Draws to the right n points.
\ban () Draws to the left n points.
\li ()
Underlines the space up to the next character.
Example{ EQ \d \fo10 \li() } displays the following:
(preceding text) (following text)
Fraction: \f(,)
Creates a fraction with the numerator and denominator centered above and below the division
line, respectively. If your system uses a comma as the decimal symbol, separate the two
elements with a semicolon (;).
Example{ EQ \f(2;RateChange) } displays .
Error!
Integral: \i(,,)
Creates an integral, using the specified symbol or default symbol and three elements. The first
element is the lower limit, the second is the upper limit, and the third is the integrand. You can
use the following options to modify the \i switch.
\su
Changes the symbol to a capital sigma and creates a summation.
\pr
Changes the symbol to a capital pi and creates a product.
\in
Creates the inline format with the limits displayed to the right of the symbol instead of
above and below it.
\fc\c Substitutes a fixed-height character specified by c for the symbol.
\vc\c Substitutes a variable-height character specified by c for the symbol. The symbol
matches the height of the third element.
Example{ EQ \i \su(1;5;3) } displays .
Error!
6
List: \l()
Uses any number of elements to create a list of values separated by commas or semicolons, so
that you can specify multiple elements as a single element.
Example{ EQ \l(A;B;C;D;E) } displays
A,B,C,D,E
Overstrike: \o()
Places each successive element on top of the previous one. Any number of elements is
permitted. Separate multiple elements with commas.
Each character is printed within an invisible character box. Options align the boxes on top of
one another. You can use the following options to modify the \o switch.
\al
At the left edge.
\ac
In the center (the default).
\ar
At the right edge.
Root: \r(,)
Draws a root using one or two elements.
Example{ EQ \r(3;x) } displays .
3;x
Superscript or Subscript: \s()
Places elements as superscript or subscript characters. Each \s code can have one or more
elements; separate the elements with commas. If more than one element is specified, the
elements are stacked and left-aligned. You can use the following options to place single
elements after the \s switch.
\ain () Adds space above a line in a paragraph by the number of points specified by n.
\upn () Moves a single element above the adjacent text by the number of points specified by
n. The default is 2 points.
\din () Adds space below a line in a paragraph by the number of points specified by n.
\don () Moves a single element below the adjacent text by the number of points specified by
n. The default is 2 points.
Example{ EQ \s\up8(UB)\s\do8(2) } displays:
UB
(regular text)
2
Box: \x()
Creates a border for an element. When used without options, this code draws a box around the
element. You can combine the following options to modify the \x switch.
\to
Draws a border above the element.
\bo
Draws a border below the element
\le
Draws a border to the left of the element.
\ri
Draws a border to the right of the element.
Example{ EQ \x \to \bo(5) } displays .
5
7
Download