mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-17 02:05:48 +00:00
f6df4e7985
This implements the relevant math typography rules described in the Appendix G of the TeXbook. More precisely, for each atom + the class is computed by implementing rules 5 and 6 of Appendix G + the spacing is computed according to the table p. 170 This code is not used at this point.
70 lines
1.7 KiB
C++
70 lines
1.7 KiB
C++
// -*- C++ -*-
|
||
/**
|
||
* \file MathClass.h
|
||
* This file is part of LyX, the document processor.
|
||
* Licence details can be found in the file COPYING.
|
||
*
|
||
* \author Jean-Marc Lasgouttes
|
||
*
|
||
* Full author contact details are available in file CREDITS.
|
||
*/
|
||
|
||
#ifndef MATH_CLASS_H
|
||
#define MATH_CLASS_H
|
||
|
||
#include "support/strfwd.h"
|
||
|
||
namespace lyx {
|
||
|
||
class MetricsBase;
|
||
|
||
/* The TeXbook, p. 158:
|
||
*
|
||
* There are thirteen kinds of atoms, each of which might act
|
||
* differently in a formula; for example, ‘(’ is an Open atom because
|
||
* it comes from an opening. Here is a complete list of the different
|
||
* kinds:
|
||
|
||
* + Ord: an ordinary atom like ‘x’
|
||
* + Op: a large operator atom like ‘\sum’
|
||
* + Bin: a binary operation atom like ‘+’
|
||
* + Rel: a relation atom like ‘=’
|
||
* + Open: an opening atom like ‘(’
|
||
* + Close: a closing atom like ‘)’
|
||
* + Punct: a punctuation atom like ‘,’
|
||
* + Inner: an inner atom like ‘\frac{1}{2}’
|
||
* + Over: an overline atom like ‘\overline{x}’
|
||
* + Under: an underline atom like ‘\underline{x}’
|
||
* + Acc: an accented atom like ‘\hat{x}’
|
||
* + Rad: a radical atom like ‘\sqrt{2}’
|
||
* + Vcent: a vbox to be centered, produced by \vcenter.
|
||
*
|
||
* Over, Under, Acc, Rad and Vcent are not considered in the enum
|
||
* below. The relvant elements will be considered as Ord.
|
||
*/
|
||
enum MathClass {
|
||
MC_ORD,
|
||
MC_OP,
|
||
MC_BIN,
|
||
MC_REL,
|
||
MC_OPEN,
|
||
MC_CLOSE,
|
||
MC_PUNCT,
|
||
MC_INNER,
|
||
MC_UNKNOWN
|
||
};
|
||
|
||
|
||
MathClass string_to_class(docstring const &);
|
||
|
||
docstring const class_to_string(MathClass);
|
||
|
||
void update_class(MathClass & mc, MathClass const prev, MathClass const next);
|
||
|
||
int class_spacing(MathClass const mc1, MathClass const mc2,
|
||
MetricsBase const & mb);
|
||
|
||
} // namespace lyx
|
||
|
||
#endif
|