1utftex(1) General Commands Manual utftex(1)
2
3
4
6 utftex - An UTF-8 unicode equation renderer
7
9 utftex [options] [equation] ...
10
12 The aim of utftex is to use the possibilities unicode provides to dis‐
13 play math in simple UTF-8 encoded text. utftex renders mathematical
14 equations in mono-space unicode characters, i.e. unicode-art. It is in‐
15 tended to insert equations in source code, e-mails, and man-pages. It
16 generally works without introducing additional dependencies as most
17 text editors and e-mail programs already support UTF-8 encoding out of
18 the box.
19
20 Unicode provides many code-points which are intended for mathematical
21 expressions. It even supplies some characters which are intended to
22 "draw" math such as the top (⌠) and bottom (⌡) of an integral symbol.
23 This way you can draw an integral symbol such as this:
24 ⌠
25 ⎮
26 ⌡
27
28 utftex uses an (ASCII or UTF-8 encoded) input with a syntax similar to
29 LaTeX and outputs an UTF-8 encoded text.
30
31
33 All arguments are optional. If no arguments are passed utftex will
34 read one equation from stdin.
35
36 [equation]
37 Each [equation] argument is parsed as one latex equation (i.e. more
38 than one equation may be passed).
39
40 [--line-width -l]
41 Define the output line width. If it is 0 the line width is unlimited
42 (default). This causes utftex to insert line breaks at suitable places
43 to divide the expression over multiple lines. It is not guaranteed that
44 suitable locations are found to insert line breaks and thus the actual
45 line length may exceed the specified one.
46
47 [--symbol-list -s]
48 List all symbols supported by this version of utftex. Supported in this
49 case means that an input command exists to generate the symbol as out‐
50 put, e.g. \alpha as input generates α as output
51
52 [--test-texsymbols -T]
53 Same as above (list all symbols) in a more machine readable format.
54
55 [--version -v]
56 Print utftex and libtexprintf versions.
57
58 [--show-input -i]
59 Print input before the rendered results.
60
61 [--wchar-width -w]
62 Specify the size of wide characters. Valid sizes are 1 and 2. Default
63 is 2.
64
65 [--fchar-width -f]
66 Specify the size of full width characters. Valid sizes are 1 and 2. De‐
67 fault is 2.
68
69 [--default-font -F]
70 Specify the default font style to use. See the Fonts below. The font
71 names correspond to the font commands minus the slash and the argument.
72 e.g. one could pass "-F mathnormal". Without this option the default
73 font is set to "text" as not all fonts support the other font styles.
74
75 [--test-fonts -t]
76 Print table with chacters in various styles.
77
78 [--test-stexprintf -S]
79
80 [--box-tree -B]
81 Print box structure (for debugging purposes)
82
83 [--ascii -A]
84 Try to stick to ASCII characters. This affects all "drawing" characters
85 used for integral signs, brackets, fractions, and tables. It does not
86 affect symbols like lpha (The user can avoid those, and there is no
87 ASCII equivalent for lpha).
88
89 [--combine-errors -E]
90 Combines error messages in a semicolon delimited string.
91
92 [--mapsupersub -m]
93 Turns on or off sub/super script mapping (mapping of sub/super scripts
94 to corresponding unicode code points for sub/super script symbols).
95
96 [--avoidcombining -a]
97 Per default utftex tries to use combining diacritical marks for accents
98 whenever possible. This toggle swhich will change this in trying to
99 avoid combining characters unless no alternative is available.
100
101 [--end-options -e]
102 Ends the option parser (allows to pass equations starting with a mi‐
103 nus).
104
105
107 Fonts: Unicode defines various font styles which may be accessed with
108 utftex. For this the following commands are available
109 \mathsfbfit{...} Mathematical sans-serif bold italic fonts
110 \mathsfbf{...} Mathematical sans-serif bold fonts
111 \mathfrak{...} Fraktur caligraphic script
112 \mathbfit{...} Mathematical serif bold italic fonts
113 \mathsfit{...} Mathematical sans-serif italic fonts
114 \mathcal{...} Mathematical caligraphic fonts
115 \mathscr{...} Euler script fonts
116 \mathbf{...} Mathematical serif bold fonts
117 \mathbb{...} Mathematical black-board bold fonts
118 \mathsf{...} Mathematical sans-serif fonts
119 \mathtt{...} Mathematical typewriter fonts
120 \mathnormal{...} Normal Mathematical fonts
121 \text{...} Roman fonts (plain font style)
122 \it Switch current block to italic fonts
123 \bf Switch current block to bold fonts
124 \rm Switch current block to roman fonts
125
126 commands to insert symbols, special characters, and operators
127 There is a large set of symbols that may be inserted with the usual (or
128 sometimes less usual) LaTeX commands. You can list the available sym‐
129 bols and corresponding commands by running utftex with the --symbol-
130 list option
131
132 \frac{a}{b}, a\over b
133 A fraction of a and b.
134
135 a^{b}
136 super-script One can also omit the braces. In this case the first
137 character following ^ will be in super-scripted.
138
139 a_{b}
140 sub-script Works just like super-script only now it is a sub-script.
141
142 \sqrt[n]{a}
143 A n-th root of a, the argument [n] is optional. Without it it produces
144 the square root of a. Note that these commands draw a variable size
145 radix. The unicode radix signs (one character sized) are available as
146 \utfsqrt \utfsqrt[3] and \utfsqrt[4]
147
148 \sum
149 Expands to a large sigma symbol. The unicode sum symbol can be gener‐
150 ated using \utfsum.
151
152 \prod
153 Expands to the product symbol. The unicode product symbol can be gener‐
154 ated using \utfprod.
155
156
157 \int[S]
158 Expands to the integral symbol. The optional argument [S] makes the
159 symbol scale with the height of the integrand. The unicode integral
160 symbol can be generated using \utfint.
161
162
163 \iint[S]
164 Expands to a double integral symbol. The optional argument [S] makes
165 the symbol scale with the height of the integrand. The unicode double
166 integral symbol can be generated using \utfiint.
167
168 \iiint[S]
169 Expands to a triple integral symbol. The optional argument [S] makes
170 the symbol scale with the height of the integrand. The unicode triple
171 integral symbol can be generated using \utfiint.
172
173 \iiiint[S]
174 Expands to a quadruple integral symbol. The optional argument [S] makes
175 the symbol scale with the height of the integrand. The unicode quadru‐
176 ple integral symbol can be generated using \utfiint.
177
178 \idotsint[S]
179 Expands to two integral symbols with dots in between. The optional ar‐
180 gument [S] makes the symbol scale with the height of the integrand.
181
182 \oint[S]
183 A contour integral. The optional argument [S] makes the symbol scale
184 with the height of the integrand.
185
186 \oiint[S]
187 A double contour integral. The optional argument [S] makes the symbol
188 scale with the height of the integrand.
189
190 \oiiint[S]
191 A tripple contour integral. The optional argument [S] makes the symbol
192 scale with the height of the integrand.
193
194 \oiiiint[S]
195 A quadruple contour integral. The optional argument [S] makes the sym‐
196 bol scale with the height of the integrand.
197
198 \oidotsint[S]
199 Expands to two contour integral symbols with dots in between. The op‐
200 tional argument [S] makes the symbol scale with the height of the inte‐
201 grand.
202
203 \left<delimiter> , \middle<delimiter> , \right<delimiter>
204 Creates variable sized delimiters around and in between content.
205 Available variable size delimiters are:
206 ( ), [ ], { }, < >, |,
207 \uparrow, \Uparrow, \downarrow, \Downarrow, \updownarrow, \Updownarrow
208 ,
209 \lceil \rceil, \lfloor \rfloor,
210 The \middle command is optional and may be omitted. The special dot (.)
211 delimiter is a dummy delimiter that can be used to open or close a
212 \left ... \right construct without a delimiter being shown.
213
214 \lim
215 Expands to a limit, i.e. \lim_{x \to 0}.
216
217 \overline{X}, \bar{X}
218 Draws a line above expression X
219
220 \underline{X}
221 Draws a line under expression X
222
223 \\
224 Insert a line break.
225
226 \
227 Escapes the character.
228
229 \limits
230 Controls the placements of sub and superscripts. Normally the sub and
231 superscripts are places to the left of its arguments. Using limits you
232 can change this to centered below and above its argument, e.g.
233 \int\limits_a^b
234
235 \box{W}{H}
236 Makes an empty box which is W characters wide and H characters high.
237 This may be used to adjust spacing
238
239 \raisebox{off}{...}
240 Makes a box and raises its contents by off characters
241
242 \phantom{...}
243 Makes an empty box with the same width and height as its rendered argu‐
244 ment would have.
245
246 \vphantom{...}
247 Makes an empty box with 0 width and the same height as its rendered ar‐
248 gument would have.
249
250 \hphantom{...}
251 Makes an empty box with 0 height and the same width as its rendered ar‐
252 gument would have.
253
254 \over
255 Alternative way of making a fraction, e.g. "a \over b".
256
257 \choose
258 Alternative way of making a binominal, e.g. "n \choose k".
259
260
261 \exp, \ln, \log, \min, \max, \sin, \cos, \tan, \cot, \arcsin, \arccos,
262 \arctan, \arccot, \sinh, \cosh, \tanh, \coth, \sec, \csc
263 Functions (function names are formatted in normal text fonts)
264
265 Environments
266 Several array-like environments are available. The most general form is
267 the array environment
268 \begin{array}[pos]{column alignments}
269 a00 & a01 & ... a0n \\
270 a10 & a11 & ... a1n \\
271 ... & ... & ... ... \\
272 am0 & am1 & ... amn
273 \end{array}
274 Makes an array. The optional argument pos sets the alignment of the
275 array to t(op), b(ottom) or c(enter). The column alignments consist of
276 one character per column, l(eft), c(enter), or r(ight). Horizontal
277 lines may be inserted with a \hline command. Vertical lines may be in‐
278 serted by inserting |'s in the column alignment argument (as with La‐
279 TeX).
280 Several derived environments are provided.
281 \begin{aligned}
282 \end{aligned}
283 and
284 \begin{align}
285 \end{align}
286 to align equiations.
287
288 \begin{cases}
289 \end{cases}
290 Equivalent to \left{\begin{array}{c...c} ...\end{array}\right.
291
292 \begin{pmatrix}
293 \end{pmatrix}
294 Equivalent to \left(\begin{array}{c...c} ...\end{array}\right)
295
296 \begin{vmatrix}
297 \end{vmatrix}
298 Equivalent to \left|\begin{array}{c...c} ...\end{array}\right|
299
300 \begin{bmatrix}
301 \end{bmatrix}
302 Equivalent to \left[\begin{array}{c...c} ...\end{array}\right]
303
304 \begin{Bmatrix}
305 \end{Bmatrix}
306 Equivalent to \left{\begin{array}{c...c} ...\end{array}\right}
307
308 \begin{matrix}
309 \end{matrix}
310 Equivalent to \begin{array}{c...c} ...\end{array}
311
312
314 utftex depends on mono-space fonts. If your equations are all mis‐
315 aligned make sure you use a mono-space fonts. If you do specify a mono-
316 spaced font, be aware that most fonts do not support all defined uni‐
317 code code-points. When a font does not provide a requested unicode
318 code-point your program/system may use a fall-back font or simply not
319 display the character properly. This could also mean your math will
320 still get misaligned, despite using a monospace font, if the fall-back
321 font is not mono-spaced. In this case make sure the fall-back font is
322 mono-spaced and that the spacing matches that of your primary font. I
323 recommend "monospacifier" to generate an appropriate fall-back font for
324 your primary font. Get it at
325 https://github.com/cpitclaudel/monospacifier
326
327
329 utftex provides commands to insert combining diacritical marks, e.g.
330 \hat for the Combining Circumflex Accent. In principle this system is
331 great but due to limitations in layout engine and/or the used fonts
332 such combining characters do not always display properly and various
333 glitches in display may be the result.
334
335
337 If the following equations do not render properly make sure you read
338 and understood the section "A NOTE ON FONTS". A simple fraction:
339 utftex "\frac{1}{1+x}"
340 1
341 ───
342 1+x
343
344 An arbitrary equation with the mathnormal font as default:
345 utftex -F mathnormal '\lfloor x\rfloor = x - \frac{1}{2} + \sum_{k=1}^{\infty}
346 \frac{\sin(2 \pi k x)}{\pi k}'
347 ∞
348 1 ⎲ sin(2 π𝑘 𝑥)
349 ⌊𝑥⌋ = 𝑥 - ─ + ⎳ ───────────
350 2 𝑘=1 π𝑘
351
352 A small table of Laplace transforms:
353 utftex '\begin{array}{|l|l|}
354 \hline
355 f(t) & \mathscr{L}[f(t)]=F(s) \\\hline
356 1 & \frac{1}{s} \\\hline
357 e^{at}f(t) & F(s-a) \\\hline
358 \delta(t) & 1 \\\hline
359 \delta(t-t_0) & e^{-st_0} \\\hline
360 \int_0^t f(x)g(t-x)dx & F(s)G(s) \hline
361 \end{array}'
362 ┌────────────────┬──────────────┐
363 │f(t) │ 𝓛[f(t)]=F(s) │
364 ├────────────────┼──────────────┤
365 │ │ 1 │
366 │1 │ ─ │
367 │ │ s │
368 ├────────────────┼──────────────┤
369 │ at │ │
370 │e f(t) │ F(s-a) │
371 ├────────────────┼──────────────┤
372 │δ(t) │ 1 │
373 ├────────────────┼──────────────┤
374 │ │ -st │
375 │ │ 0 │
376 │δ(t-t ) │ e │
377 │ 0 │ │
378 ├────────────────┼──────────────┤
379 │ t │ │
380 │⌠ │ │
381 │⎮ f(x)g(t-x)dx │ F(s)G(s) │
382 │⌡ │ │
383 │ 0 │ │
384 └────────────────┴──────────────┘
385
387 Bart Pieters
388
390 GNU GENERAL PUBLIC LICENSE Version 3
391
393 1.0
394
396 05 Jul 2022 utftex(1)