ISO 31 conforming typesetting in LaTeX

28
ISO 31 conforming typesetting in L A T E X Moritz Nadler December 16th, 2009 recompiled August 30, 2012 with TeX Live 2012 Moritz Nadler ISO 31 conforming typesetting in L A T E X December 16th, 2009 1 / 17

Transcript of ISO 31 conforming typesetting in LaTeX

Page 1: ISO 31 conforming typesetting in LaTeX

ISO 31 conforming typesetting in LATEX

Moritz Nadler

December 16th, 2009

recompiled August 30, 2012 with TeX Live 2012

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 1 / 17

Page 2: ISO 31 conforming typesetting in LaTeX

Outline

1 Introduction

2 The rules applied in LATEX

3 Some LATEX details and summary

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 2 / 17

Page 3: ISO 31 conforming typesetting in LaTeX

Introduction

Outline

1 Introduction

2 The rules applied in LATEX

3 Some LATEX details and summary

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 3 / 17

Page 4: ISO 31 conforming typesetting in LaTeX

Introduction

Why having rules and where do they come from

Like spelling rules they

increase readability

ease recognition

often lead to better looking formulae

If breaking the rules increases readability you can do it, but first knowthem!Different traditions different rules (Anglo-American, French, German,Russian...)Today also an international standard: ISO-31 XI and rules for units fromSIMy sources:

Bureau international des poids et mesures (BIPM) “SI brochure”

International Union of Pure and Applied Chemistry “Quantities,Units and Symbols in Physical Chemistry’

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 4 / 17

Page 5: ISO 31 conforming typesetting in LaTeX

Introduction

Why having rules and where do they come from

Like spelling rules they

increase readability

ease recognition

often lead to better looking formulae

If breaking the rules increases readability you can do it, but first knowthem!Different traditions different rules (Anglo-American, French, German,Russian...)Today also an international standard: ISO-31 XI and rules for units fromSIMy sources:

Bureau international des poids et mesures (BIPM) “SI brochure”

International Union of Pure and Applied Chemistry “Quantities,Units and Symbols in Physical Chemistry’

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 4 / 17

Page 6: ISO 31 conforming typesetting in LaTeX

Introduction

Why having rules and where do they come from

Like spelling rules they

increase readability

ease recognition

often lead to better looking formulae

If breaking the rules increases readability you can do it, but first knowthem!Different traditions different rules (Anglo-American, French, German,Russian...)Today also an international standard: ISO-31 XI and rules for units fromSIMy sources:

Bureau international des poids et mesures (BIPM) “SI brochure”

International Union of Pure and Applied Chemistry “Quantities,Units and Symbols in Physical Chemistry’

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 4 / 17

Page 7: ISO 31 conforming typesetting in LaTeX

The rules applied in LATEX

Outline

1 Introduction

2 The rules applied in LATEX

3 Some LATEX details and summary

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 5 / 17

Page 8: ISO 31 conforming typesetting in LaTeX

The rules applied in LATEX

Variables, parameters, functions

Variables, parameters and functions are to be set italic – easy: this ismath mode’s default. Examples:

x1,2 =−b ±

√b2 − 4ac

2aand f (x) = x2

Tip for symbols consisting of several letters like Reynolds number Re orMach number Ma: use \mathit or even \mathit plus \!

Ma = F

Ma = 100 \mathit{M\!a}

Ma = 100 \mathit{Ma}

This rule also applies to capital Greek letters! E.g use \varPsi insteadof \Psi a.s.o. (amsmath). Example:

right: Ψ(x, t) = ψ(x)φ(t) wrong: Ψ(x, t) = ψ(x)φ(t)

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 6 / 17

Page 9: ISO 31 conforming typesetting in LaTeX

The rules applied in LATEX

Variables, parameters, functions

Variables, parameters and functions are to be set italic – easy: this ismath mode’s default. Examples:

x1,2 =−b ±

√b2 − 4ac

2aand f (x) = x2

Tip for symbols consisting of several letters like Reynolds number Re orMach number Ma: use \mathit or even \mathit plus \!

Ma = F

Ma = 100 \mathit{M\!a}

Ma = 100 \mathit{Ma}

This rule also applies to capital Greek letters! E.g use \varPsi insteadof \Psi a.s.o. (amsmath). Example:

right: Ψ(x, t) = ψ(x)φ(t) wrong: Ψ(x, t) = ψ(x)φ(t)

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 6 / 17

Page 10: ISO 31 conforming typesetting in LaTeX

The rules applied in LATEX

Variables, parameters, functions

Variables, parameters and functions are to be set italic – easy: this ismath mode’s default. Examples:

x1,2 =−b ±

√b2 − 4ac

2aand f (x) = x2

Tip for symbols consisting of several letters like Reynolds number Re orMach number Ma: use \mathit or even \mathit plus \!

Ma = F

Ma = 100 \mathit{M\!a}

Ma = 100 \mathit{Ma}

This rule also applies to capital Greek letters! E.g use \varPsi insteadof \Psi a.s.o. (amsmath). Example:

right: Ψ(x, t) = ψ(x)φ(t) wrong: Ψ(x, t) = ψ(x)φ(t)

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 6 / 17

Page 11: ISO 31 conforming typesetting in LaTeX

The rules applied in LATEX

Functions with fixed names

Mathematical functions with fixed names are to be set upright. Just usename of function \exp (x), \cos (x), \sin (x) etc.

exp(x), sin(x), cos(x)

This also applies to Functions with fixed one letter names: Γ(x)

If LATEX doesn’t know the function use e.g. \operatorname{sgn} for

sgn(x) =

1 if x > 0

−1 if x < 0

0 if x = 0

If you often need sgn use \DeclareMathOperator{\sgn}{sgn}(amsmath). Now \sgn works like a “build in” function.

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 7 / 17

Page 12: ISO 31 conforming typesetting in LaTeX

The rules applied in LATEX

Functions with fixed names

Mathematical functions with fixed names are to be set upright. Just usename of function \exp (x), \cos (x), \sin (x) etc.

exp(x), sin(x), cos(x)

This also applies to Functions with fixed one letter names: Γ(x)

If LATEX doesn’t know the function use e.g. \operatorname{sgn} for

sgn(x) =

1 if x > 0

−1 if x < 0

0 if x = 0

If you often need sgn use \DeclareMathOperator{\sgn}{sgn}(amsmath). Now \sgn works like a “build in” function.

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 7 / 17

Page 13: ISO 31 conforming typesetting in LaTeX

The rules applied in LATEX

Functions with fixed names

Mathematical functions with fixed names are to be set upright. Just usename of function \exp (x), \cos (x), \sin (x) etc.

exp(x), sin(x), cos(x)

This also applies to Functions with fixed one letter names: Γ(x)

If LATEX doesn’t know the function use e.g. \operatorname{sgn} for

sgn(x) =

1 if x > 0

−1 if x < 0

0 if x = 0

If you often need sgn use \DeclareMathOperator{\sgn}{sgn}(amsmath). Now \sgn works like a “build in” function.

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 7 / 17

Page 14: ISO 31 conforming typesetting in LaTeX

The rules applied in LATEX

Functions with fixed names

Mathematical functions with fixed names are to be set upright. Just usename of function \exp (x), \cos (x), \sin (x) etc.

exp(x), sin(x), cos(x)

This also applies to Functions with fixed one letter names: Γ(x)

If LATEX doesn’t know the function use e.g. \operatorname{sgn} for

sgn(x) =

1 if x > 0

−1 if x < 0

0 if x = 0

If you often need sgn use \DeclareMathOperator{\sgn}{sgn}(amsmath). Now \sgn works like a “build in” function.

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 7 / 17

Page 15: ISO 31 conforming typesetting in LaTeX

The rules applied in LATEX

Units

Units are to be set upright. Always! In all traditions! No excuses! Thisincludes the SI-prefix for 10−6 µ (textcomp)

right: r = 3 µm wrong: r = 3µm

Code of this example:

\text{right:} \quad r = 3 \, \text\textmu\mathrm{m}\quad \text{wrong:} \quad r = 3\mu m

To save time just use sistyle or siunitx: r = \SI{30000}{\micro m}becomes r = 30 000 µm

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 8 / 17

Page 16: ISO 31 conforming typesetting in LaTeX

The rules applied in LATEX

Units

Units are to be set upright. Always! In all traditions! No excuses! Thisincludes the SI-prefix for 10−6 µ (textcomp)

right: r = 3 µm wrong: r = 3µm

Code of this example:

\text{right:} \quad r = 3 \, \text\textmu\mathrm{m}\quad \text{wrong:} \quad r = 3\mu m

To save time just use sistyle or siunitx: r = \SI{30000}{\micro m}becomes r = 30 000 µm

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 8 / 17

Page 17: ISO 31 conforming typesetting in LaTeX

The rules applied in LATEX

Units

Units are to be set upright. Always! In all traditions! No excuses! Thisincludes the SI-prefix for 10−6 µ (textcomp)

right: r = 3 µm wrong: r = 3µm

Code of this example:

\text{right:} \quad r = 3 \, \text\textmu\mathrm{m}\quad \text{wrong:} \quad r = 3\mu m

To save time just use sistyle or siunitx: r = \SI{30000}{\micro m}becomes r = 30 000 µm

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 8 / 17

Page 18: ISO 31 conforming typesetting in LaTeX

The rules applied in LATEX

Constants

Mathematical constants are to be set upright, physical or technicalconstants italic. Use \mathrm. Examples:

right: eiπ = −1 wrong: e iπ = −1.

Nothing special for physical constants needed. Examples:

ε0 =1

µ0c20

≈ 8.85× 10−12 As

Vm

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 9 / 17

Page 19: ISO 31 conforming typesetting in LaTeX

The rules applied in LATEX

Indices

Indices being variables are to be set italic, indices being text orabbreviation are to be set upright. Use \mathrm. Examples:

µr, µB =e~

2me, Thot > Tcold, xmax = 7, Veff

an =1

n2,

∞∑i ,j

mi ,j , cP > cV

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 10 / 17

Page 20: ISO 31 conforming typesetting in LaTeX

The rules applied in LATEX

Matrices and vectors

No special rules for vectors. Just don’t break the existing ones. → Don’tuse \mathbf, keep vectors italic. Examples:

Avn = λnvn with A ∈ CN×N , v ∈ CN , λ ∈ C

or Avn = λnvn or ~a · ~b = |~a||~b| cosα but not a · b = |a||b| cosα

Create bolt italic letters in math mode with \bm (bm)

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 11 / 17

Page 21: ISO 31 conforming typesetting in LaTeX

The rules applied in LATEX

Mathematical operators

Mathematical operators (like functions with fixed names) are to be setupright. Normally LATEX knows them, like + \lim, \nabla, \det etc.:

a + b, limx→∞

f (x) = 0, F = −∇Epot, detA = 4

If LATEX doesn’t know use \operatorname or \DeclareMathOperatorfor multi-letter operators and \mathrm for single-letter operators:

\DeclareMathOperator{\grad}{grad}\bm F = - \grad E_\mathrm{pot}

F = − gradEpot, z = x + iy ⇐⇒ Re z = x ∧ Im z = y ,

B = AT,

∫x2 dx =

1

3x3,

dn

dxnf (x)

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 12 / 17

Page 22: ISO 31 conforming typesetting in LaTeX

The rules applied in LATEX

Mathematical operators

Mathematical operators (like functions with fixed names) are to be setupright. Normally LATEX knows them, like + \lim, \nabla, \det etc.:

a + b, limx→∞

f (x) = 0, F = −∇Epot, detA = 4

If LATEX doesn’t know use \operatorname or \DeclareMathOperatorfor multi-letter operators and \mathrm for single-letter operators:

\DeclareMathOperator{\grad}{grad}\bm F = - \grad E_\mathrm{pot}

F = − gradEpot, z = x + iy ⇐⇒ Re z = x ∧ Im z = y ,

B = AT,

∫x2 dx =

1

3x3,

dn

dxnf (x)

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 12 / 17

Page 23: ISO 31 conforming typesetting in LaTeX

The rules applied in LATEX

Elements and particles

Elements and particles are to be set upright. Examples:

2 H2 + O2 −−→ 2 H2O µ− −−→ e− + ν̄e + νµ

This can be done with \mathrm:

2\mathrm H_2 + \mathrm O_2 \longrightarrow 2\mathrm{H_2 O}

but is much easier with \ce from mhchem:

\ce{2 H2 + O2 -> 2 H2O}

Especially if it gets more complicated:

\ce{ ^{238}U -> ^{234}Th + ^4He^{2+} + 2 e-}

238U −−→ 234Th + 4He2+ + 2 e–

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 13 / 17

Page 24: ISO 31 conforming typesetting in LaTeX

The rules applied in LATEX

Elements and particles

Elements and particles are to be set upright. Examples:

2 H2 + O2 −−→ 2 H2O µ− −−→ e− + ν̄e + νµ

This can be done with \mathrm:

2\mathrm H_2 + \mathrm O_2 \longrightarrow 2\mathrm{H_2 O}

but is much easier with \ce from mhchem:

\ce{2 H2 + O2 -> 2 H2O}

Especially if it gets more complicated:

\ce{ ^{238}U -> ^{234}Th + ^4He^{2+} + 2 e-}

238U −−→ 234Th + 4He2+ + 2 e–

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 13 / 17

Page 25: ISO 31 conforming typesetting in LaTeX

Some LATEX details and summary

Outline

1 Introduction

2 The rules applied in LATEX

3 Some LATEX details and summary

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 14 / 17

Page 26: ISO 31 conforming typesetting in LaTeX

Some LATEX details and summary

Problems of LATEX

1 uses Anglo-American tradition: “wrong” treatment of Greek letters.2 Computer Modern and nearly all other free fonts don’t have upright

lower-case Greek letters (besides µ)3 font selection and shape selection is a mess e.g.: \mathrm might not

do what you want depending on document class and font (e.g.:beamer)

4 LATEX is very old, development very slow: one only gets lots ofimportant features with extra packages

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 15 / 17

Page 27: ISO 31 conforming typesetting in LaTeX

Some LATEX details and summary

Solutions to these Problems (sort of)

1 force “correct” format: e.g.: \varGamma Γ instead of \Gamma Γ (notfor Γ(x))

2 no good solution exists. You canignore it: eiπ = −1 µ− −−→ e− + ν̄e + νµuse upgreek: eiπ = −1 µ− −−→ e− + ν̄e + νµ

use MinionPro

3 don’t use \mathrm directly use \newcommand{\mathup}{\mathrm}.Replace \mathrm with \textup or \mathsf if necessary.

4 know and use the additional packages but beware of incompatibilities

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 16 / 17

Page 28: ISO 31 conforming typesetting in LaTeX

Some LATEX details and summary

Summary

In formulas italic are:

variables and parameters e. g.: x or Re

functions, e. g.: f (x) or Ψ(x)

physical constants, e. g.: c0

indices that are variables or physical quantities, e. g.: ai ,j or cVand upright are:

functions with fixed names, e. g.: sin(x) or Γ(x)

mathematical constants, e. g.: π, i or e

units and SI-prefixes, e. g.: λ = 0.56 µm

indices, that are names or abbreviations, e. g.: xmax or µB

chemical elements and particles, e. g.: H2O or e–

mathematical operators, e. g.: AT = B

The content of this talk as an article: moritz-nadler.de/formelsatz.pdf

Moritz Nadler ISO 31 conforming typesetting in LATEX December 16th, 2009 17 / 17