1 // -*- C++ -*-
2 /**
3  * \file MathClass.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Jean-Marc Lasgouttes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11 
12 #ifndef MATH_CLASS_H
13 #define MATH_CLASS_H
14 
15 #include "support/strfwd.h"
16 
17 namespace lyx {
18 
19 class MetricsBase;
20 
21 /* The TeXbook, p. 158:
22  *
23  * There are thirteen kinds of atoms, each of which might act
24  * differently in a formula; for example, ‘(’ is an Open atom because
25  * it comes from an opening. Here is a complete list of the different
26  * kinds:
27 
28  * + Ord: an ordinary atom like ‘x’
29  * + Op: a large operator atom like ‘\sum’
30  * + Bin: a binary operation atom like ‘+’
31  * + Rel: a relation atom like ‘=’
32  * + Open: an opening atom like ‘(’
33  * + Close: a closing atom like ‘)’
34  * + Punct: a punctuation atom like ‘,’
35  * + Inner: an inner atom like ‘\frac{1}{2}’
36  * + Over: an overline atom like ‘\overline{x}’
37  * + Under: an underline atom like ‘\underline{x}’
38  * + Acc: an accented atom like ‘\hat{x}’
39  * + Rad: a radical atom like ‘\sqrt{2}’
40  * + Vcent: a vbox to be centered, produced by \vcenter.
41  *
42  * Over, Under, Acc, Rad and Vcent are not considered in the enum
43  * below. The relvant elements will be considered as Ord.
44  */
45 enum MathClass {
46 	MC_ORD,
47 	MC_OP,
48 	MC_BIN,
49 	MC_REL,
50 	MC_OPEN,
51 	MC_CLOSE,
52 	MC_PUNCT,
53 	MC_INNER,
54 	MC_UNKNOWN
55 };
56 
57 
58 MathClass string_to_class(docstring const &);
59 
60 docstring const class_to_string(MathClass);
61 
62 void update_class(MathClass & mc, MathClass const prev, MathClass const next);
63 
64 int class_spacing(MathClass const mc1, MathClass const mc2,
65                   MetricsBase const & mb);
66 
67 } // namespace lyx
68 
69 #endif
70