1 \startcomponent ma-cb-vi-math
4 \environment ma-cb-env-vi
6 %\chapter[formulas]{Typesetting math}
7 \chapter[formulas
]{Sắp chữ toán học
}
9 %\section{Introduction}
15 %\TEX\ is {\em the} typesetting program for math. However,
16 %this is not the extensive chapter on typesetting math you
17 %might expect. We advise you to do some further reading on
18 %typesetting formulae in \TEX. See for example: \footnote{In
19 %this introduction on typesetting math we relied on the
20 %booklet {\em \TEX niques} by Arthur Samuel.}
21 \TEX\ là chương trình sắp chữ
{\em dành
} cho toán. Tuy nhiên, đây không phải
22 chương mở rộng về cách sắp chữ toán học mà bạn có thể mong đợi. Chúng tôi đề
23 nghị bạn đọc xa hơn về cách sắp chữ các công thức bằng
\TEX. Ví dụ các sách:
24 \footnote{Trong phần giới thiệu về cách sắp chữ toón học này, chúng tôi dựa
25 vào cuốn
{\em \TEX niques
} của Arthur Samuel.
}
27 %\startitemize[packed]
28 %\item {\em The \TeX Book} by D.E. Knuth
29 %\item {\em The Beginners Book of \TeX} by S. Levy and R. Seroul
32 \item {\em The
\TeX Book
} by D.E. Knuth
33 \item {\em The Beginners Book of
\TeX} by S. Levy and R. Seroul
36 %Furthermore a \CONTEXT\ math module and its
37 %accompanying manual will be published in due time.
38 Một module toán của
\CONTEXT\ và sổ tay đi kèm của nó sẽ được xuất bản trong
41 %\section{Typesetting math}
42 \section{Sắp chữ toán học
}
48 %Normally different conventions are applied for typesetting
49 %normal text and math text. These conventions are \quote{known}
50 %by \TEX\ and applied accordingly when generating a document.
51 %We can rely on \TEX\ for delivering high quality math output.
52 Bình thường, các quy ước khác nhau được áp dụng cho sắp chữ văn bản bình
53 thường và văn bản toán. Các quy ước này được
\quote{biết
} đến bởi
\TEX\ và
54 được áp dụng phù hợp khi tạo ra tài liệu. Chúng ta có thể dựa vào
\TEX\ để
55 xuất ra biểu thức toán chất lượng cao.
57 %A number of conventions for math are:
58 Một số các quy ước cho toán là:
60 %\startitemize[n,packed]
62 %\item Characters are typeset in $math\ italic$ (don't confuse
63 % this with the normal {\it italic characters} in a font).
65 %\item Symbols like Greek characters ($\alpha$, $\chi$)
66 % and math symbols ($\leq$, $\geq$, $\in$) are used.
68 %\item Spacing will differ from normal spacing.
70 %\item Math expression have a different alignment than that of
73 %\item The sub and superscripts are downsized automatically,
74 % like in $a^{b}_{c}$.
76 %\item Certain symbols have different appearances in the
77 % inline and display mode.
80 \startitemize[n,packed
]
82 \item Các kí tự được sắp chữ bằng kí tự toán $nghiêng$ (đừng nhầm lẫn với kí
83 tự in nghiêng trong font chữ).
85 \item Các kí hiệu như là kí tự Hi Lạp ($
\alpha$, $
\chi$) và kí tự toán như
86 ($
\leq$, $
\geq$, $
\in$) được dùng.
88 \item Kí tự khoảng trắng không giống bình thường.
90 \item Diễn đạt toán có cách sắp hàng khác với văn bản thường.
92 \item Các kí tự cơ số và lũy thừa được thu nhỏ tự động như thế này $a^
{b
}_
{c
}$.
94 \item Vài kí tự có cách thể hiện khác nhau trong phương thức trực tiếp và cách
99 %When typesetting math you have to work in the so called math
100 %mode in which math expressions can be defined by means of
101 %plain \TEX||commands.
102 Khi bạn sắp chữ toán học, bạn phải làm việc bằng phương thức toán là phương
103 thức mà cách diễn đạt toán có thể được định nghĩa bằng các lệnh thuần
\TEX.
105 %Math mode has two alternatives: text mode and display mode.
106 %Math mode in text mode is activated by \type{$} and
107 %\type{$}, while display mode is activated by \type{$$} and
109 Phương thức toán có hai tùy chọn: kiểu văn bản và kiểu hiển thị. Kiểu văn bản
110 được kích hoạt bằng cặp kí tự
\type{$
} trong khi kiểu hiển thị được kích hoạt
111 bằng cặp kí tự
\type{$$
}.
114 The Hasselt community covers an area of
42,
05 \Square \Kilo \Meter.
115 Now if you consider a circular area of this size with the market
116 place of Hasselt as the center point $M$ you can calculate its
117 diameter with $
{{1}\over{4}} \pi r^
2$.
126 The many
\type{{}} (grouping) in $
{{1}\over{4}} \pi r^
2$ are
127 essential for separating operations in the expression. If
128 you omit the outer curly braces like this:
129 \type{$
{1}\over{4} \pi r^
2$
}, you would get a non desired
130 result: $
{1}\over{4} \pi r^
2$.
132 The letters and numbers are typeset in three different
133 sizes: text size $a+b$, script size $
\scriptstyle a+b$ and
134 scriptscript size $
\scriptscriptstyle a+b$. These can be
135 influenced by the commands
\type{\scriptstyle} and
136 \type{\scriptscriptstyle}.
138 Symbols like $
\int$ and $
\sum$ will have a different form in
139 text and display mode. If we type
\type {$
\sum_{n=
1}^
{m
}$
}
140 or
\type {$
\int_{-
\infty}^
{+
\infty}$
} we will get
141 {$
\sum_{n=
1}^
{m
}$
} and
{$
\int_{-
\infty}^
{+
\infty}$
}. But
142 when you type
\type {$$
\sum_{n=
1}^
{m
}$$
} \type
143 {$$
\int_{-
\infty}^
{+
\infty}$$
} to activate display mode you
147 \sum_{n=
1}^
{m
} \quad {\rm and
} \quad \int_{-
\infty}^
{+
\infty}
150 With the commands
\type {\nolimits} and
\type{\limits} you
151 can influence the appearances of
\type{\sum} and
\type{\int}:
154 \sum_{n=
1}^
{m
}\nolimits \quad {\rm and
} \quad \int_{-
\infty}^
{+
\infty}\limits
157 For typesetting fractions there is the command
\type
158 {\over}. In
\CONTEXT\ you can use the alternative
159 \type {\frac}. For $
{\frac{a
}{1+b
}}+c$ we type for instance
160 \type {$
{\frac{a
}{1+b
}}+c$
}.
162 Other commands to put one thing above the other, are:
177 \starttabulate[|l|l|l|l|
]
179 \NC \typebuffer[atop
]
180 \NC \mathstrut\getbuffer[atop
]
184 \NC \typebuffer[choose
]
186 \NC \mathstrut\getbuffer[choose
]
189 \NC \typebuffer[brack
]
190 \NC \mathstrut\getbuffer[brack
]
194 \NC \typebuffer[brace
]
196 \NC \mathstrut\getbuffer[brace
]
200 \TEX\ can enlarge delimiters like (~) and $\
{~\
}$
201 automatically if the left and right delimiter is preceeded
202 by the commands
\type {\left} and
\type {\right}
203 respectively. If we type
\type
204 {$$
1+
\left(
\frac{1}{1-x^
{x-
2}}\right)^
3$$
} we get:
207 1+
\left(
\frac{1}{1-x^
{x-
2}}\right)^
3
210 Sub and superscripts are invoked by
\quote {\type{_
}} and
211 \quote {\type{^
}}. They have effect on the next first
212 character so grouping with $\
{$~$\
}$ is necessary in case of
213 multi character sub and superscripts.
215 In certain situations the delimiters can be preceeded by
216 \type{\bigl},
\type{\Bigl},
\type{\biggl} and
\type{\Biggl}
217 and their right counterparts. Even bigger delimiters can be
218 produced by placing
\type{\left} and
\type{\right} in a
219 \type{\vbox} construction. When we type a senseless
220 expression like
\type{$$
\left(
\vbox to
221 16pt
{}x^
{2^
{2^
{2^
{2}}}}\right)$$
} we get:
224 \left(
\vbox to
16pt
{}x^
{2^
{2^
{2^
{2}}}}\right)
227 In display mode the following delimiters will work in the
228 automatic enlargement mechanism:
230 \starttabulate[|l|l|l|l|l|l|l|l|
]
231 \NC \type{\lfloor} \NC $
\lfloor$
232 \NC \type{\langle} \NC $
\langle$
233 \NC \type{\vert} \NC $
\vert$
234 \NC \type{\downarrow} \NC $
\downarrow$
236 \NC \type{\rfloor} \NC $
\rfloor$
237 \NC \type{\rangle} \NC $
\rangle$
238 \NC \type{\Vert} \NC $
\Vert$
239 \NC \type{\Downarrow} \NC $
\Downarrow$
241 \NC \type{\lceil} \NC $
\lceil$
243 \NC \type{\uparrow} \NC $
\uparrow$
244 \NC \type{\updownarrow} \NC $
\updownarrow$
246 \NC \type{\rceil} \NC $
\rceil$
247 \NC \type{\backslash} \NC $
\backslash$
248 \NC \type{\Uparrow} \NC $
\Uparrow$
249 \NC \type{\Updownarrow} \NC $
\Updownarrow$
253 In display mode we should typeset only one fraction and
254 otherwise switch to the
\type{a/b
} notation. To get:
257 a_0 +
{\frac{a
}{a_1 +
\frac{1}{a_2
}}}
261 \type{$$a_0+
{\frac{a
}{a_1+
\frac{1}{a_2
}}}$$
}
263 \type{$$a_0 +
{\frac{a
}{a_1 +
1/a_2
}}$$
},
267 a_0 +
{\frac{a
}{a_1 +
1/a_2
}}
270 In addition we could also use the command
271 \type{\displaystyle}. If we would type
\type {$$a_0 +
272 {\frac{a
}{a_1 +
\frac{1}{\strut \displaystyle a_2
}}}$$
} we
276 a_0 +
{\frac{a
}{a_1 +
\frac{1}{\displaystyle a_2
}}}
279 Below we demonstrate the commands
\type{\matrix},
280 \type{\pmatrix},
\type{\ldots},
\type{\cdots} and
281 \type{\cases} without any further explanation.
288 A=
\left(
\matrix{x-
\lambda &
1 &
0 \cr
289 0 & x-
\lambda &
1 \cr
290 0 &
0 & x-
\lambda \cr}\right)
293 \typebuffer[b,a,b
] \startformula\getbuffer[a
]\stopformula
296 A=
\left|
\matrix{x-
\mu&
1 &
0 \cr
298 0 &
0 & x-
\mu \cr}\right|
301 \typebuffer[b,a,b
] \startformula\getbuffer[a
]\stopformula
304 A=
\pmatrix{a_
{11} & a_
{12} &
\ldots & a_
{1n
} \cr
305 a_
{21} & a_
{22} &
\ldots & a_
{2n
} \cr
306 \vdots &
\vdots &
\ddots &
\vdots \cr
307 a_
{m1
} & a_
{m2
} &
\ldots & a_
{mn
} \cr}
310 \typebuffer[b,a,b
] \startformula\getbuffer[a
]\stopformula
313 A=
\pmatrix{a_
{11} & a_
{12} &
\ldots & a_
{1n
} \cr
314 a_
{21} & a_
{22} &
\ldots & a_
{2n
} \cr
315 \vdots &
\vdots &
\ddots &
\vdots \cr
316 a_
{m1
} & a_
{m2
} &
\ldots & a_
{mn
} \cr}
319 \typebuffer[b,a,b
] \startformula\getbuffer[a
]\stopformula
322 |x|=
\cases{ x, & als $x
\geq0$;
\cr
326 \typebuffer[b,a,b
] \startformula\getbuffer[a
]\stopformula
328 To typeset normal text in a math expression we have to
329 consider the following. First a space is not typeset in math
330 mode so we have to enforce one with
\type{ \
} (backslash).
331 Second we have to indicate a font switch, because the text
332 should not appear in $math\ italic$ but in the actual font.
333 So in
\CONTEXT\ we have to type
\type{$$x^
3+
{\tf lower\
334 order\ terms
}$$
} to get:
337 x^
3+
{\tf lower\ order\ terms
}
340 The math functions like $
\sin$ and $
\tan$ that have to be
341 typeset in the actual font are predefined functions in
344 \starttabulate[|l|l|l|l|l|l|l|l|
]
345 \NC \type{\arccos} \NC \type{\cos} \NC \type{\csc} \NC \type{\exp} \NC \type{\ker} \NC \type{\limsup} \NC \type{\min} \NC \type{\sinh} \NC\NR
346 \NC \type{\arcsin} \NC \type{\cosh} \NC \type{\deg} \NC \type{\gcd} \NC \type{\lg} \NC \type{\ln} \NC \type{\Pr} \NC \type{\sup} \NC\NR
347 \NC \type{\arctan} \NC \type{\cot} \NC \type{\det} \NC \type{\hom} \NC \type{\lim} \NC \type{\log} \NC \type{\sec} \NC \type{\tan} \NC\NR
348 \NC \type{\arg} \NC \type{\coth} \NC \type{\dim} \NC \type{\inf} \NC \type{\liminf} \NC \type{\max} \NC \type{\sin} \NC \type{\tanh} \NC\NR
351 If we type the sinus function
352 \type {$$
\sin 2\theta=
2\sin\theta\cos\theta$$
}
353 or type the limit function
354 \type {$$
\lim_{x
\to0}{\frac{\sin x
}{x
}}=
1$$
} we will
358 \sin 2\theta=
2\sin\theta\cos\theta
360 \lim_{x
\to0}{\frac{\sin x
}{x
}}=
1
363 Alignment in math expressions may need special attention. In
364 multi line expressions we sometimes need alignment at the
365 \quote {$=$
} sign. This is done by the command
366 \type{\eqalign}. If we type:
371 x &=
\frac{-b
\pm \sqrt{b^
2-
4ac
}}{2a
} \cr}$$
381 x &=
\frac{-b
\pm \sqrt{b^
2-
4ac
}}{2a
} \cr}
384 Sometimes alignment at more than one location is wanted.
385 Watch the second line in the next example and see how it is
390 ax+bx+
\cdots+yx+zx & = x(a +b+
\cdots \cr
391 &
\phantom{= x(a~
}+y+z)
\cr
401 ax+bx+
\cdots+yx+zx & = x(a +b+
\cdots \cr
402 &
\phantom{= x(a~
}+y+z)
\cr
406 Next to the command
\type{\phantom} there are
407 \type{\hphantom} without height and depth and
408 \type{\vphantom} without width.
410 You can rely on
\TEX\ for spacing within a math expression.
411 In some situations, however you may want to influence
412 spacing. This is done by:
414 \starttabulate[|l|r|
]
415 \NC \type{\!
} \NC $-
\frac{1}{6}$
\type{\quad} \NC\NR
416 \NC \type{\,
} \NC $
\frac{1}{6}$
\type{\quad} \NC\NR
417 \NC \type{\>
} \NC $
\frac{2}{9}$
\type{\quad} \NC\NR
418 \NC \type{\;
} \NC $
\frac{5}{18}$
\type{\quad} \NC\NR
421 These
\quote {spaces
} are related to
\type {\quad} that stands
422 for the width of the capital
\quote{M
}.
424 The use of the command
\type{\prime} speaks for itself. For
425 example if would want $y_1^
\prime+y_2^
{\prime\prime}$ you
426 should type
\type{$y_1^
\prime+y_2^
{\prime\prime}$
}.
428 An expression like $
\root 3 \of {x^
2+y^
2}$ is obtained by
429 \type{$
\root 3 \of {x^
2+y^
2}$
}.
431 At the end of this section we point to the command
432 \type{\mathstrut} which we can use to enforce
433 consistency, for example within the root symbol.
434 With
\type{$
\sqrt{\mathstrut a
}+
\sqrt{\mathstrut d
}+
\sqrt{\mathstrut y
}$
}
435 we will get $
\sqrt{\mathstrut a
}+
\sqrt{\mathstrut d
}+
\sqrt{\mathstrut y
}$
436 in stead of $
\sqrt{a
}+
\sqrt{d
}+
\sqrt{y
}$.
438 See
\in{appendix
}[overviews
] for a complete overview
441 \section{Placing formulaes
}
445 \Command{\tex{placeformula
}}
446 \Command{\tex{startformula
}}
447 \Command{\tex{setupformulae
}}
449 You can typeset numbered formulaes with:
451 \shortsetup{placeformula
}
452 \shortsetup{startformula
}
457 \placeformula[formula:aformula
]
472 The
\CONTEXT\ commands
\type {\startformula} $
\cdots$
473 \type{\stopformula} replace the begin and end
\type{$$
}. So
484 you will get an expression that is
{\em displayed
} in the
485 middle of a page, but that is not as well aligned as the
490 The command
\type{\placeformula} handles spacing around the
491 formulae and the numbering of the formula. The bracket pair
492 is optional and is used for cross-references and to switch
493 numbering on and off.
496 \placeformula[first one
]
501 \placeformula[middle one
]
506 \placeformula[last one
]
514 \in{Formula
}[middle one
] was typed like this:
517 \placeformula[middle one
]
525 The label
\type{[middle one
]} is used for refering to this
526 formula. Such a reference is made with
527 \type{\in{formula
}[middle one
]}.
529 If no numbering is required you type:
531 \type{\placeformula[-
]}
533 Numbering of formulae is set up with
\type{\setupnumbering}.
534 In this manual numbering is set up with
535 \type{\setupnumbering[way=bychapter
]}. This means that
536 the chapter number preceeds the formula number and numbering
537 is reset with each new chapter. For reasons of consistency
538 the tables, figures, intermezzi etc. are numbered in
539 the same way. Therefore you use
\type{\setupnumbering} in
540 the set up area of your input file.
542 Formulae can be set up with:
544 \shortsetup{setupformulae
}