# liblouis: English (Unified) math definitions
#
#  Copyright (C) 2016 American Printing House for the Blind, Inc. www.aph.org
#
#  This file is part of liblouis.
#
#  liblouis is free software: you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as
#  published by the Free Software Foundation, either version 2.1 of the
#  License, or (at your option) any later version.
#
#  liblouis is distributed in the hope that it will be useful, but
#  WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#  Lesser General Public License for more details.
#
#  You should have received a copy of the GNU Lesser General Public
#  License along with liblouis. If not, see
#  <http://www.gnu.org/licenses/>.

# Semantic character sequences
# Prefix characters, only definitions as they should always occur as pairs with other characters.

math \xf400 0
math \xf401 0
math \xf402 0
math \xf403 0
# Begin and end equations
replace \xf32e
replace \xf32f
# Subscript and superscript
math \xf320 26-126
replace \xf401\xf320
#always \xf402\xf320 345
math \xf321 35-126
replace \xf401\xf321
#always \xf402\xf321 345
# Underscript and overscript
math \xf322 46-26-126
replace \xf401\xf322
#always \xf402\xf322 345
math \xf323 46-35-126
replace \xf401\xf323
#always \xf402\xf323 345
# Roots
math \xf32a 146
math \xf32b 346
math \xf32c 146-35-126
#always \xf403\xf32a 345
# Fractions
math \xf500 12356
math \xf501 23456
math \xf503 46-34
# Grouping symbols
math \xf326 126
#math \xf327 345

# Protect against incorrect use of escapes or where escape not really needed
# eg. brackets from mfenced
replace \xf400
replace \xf401
replace \xf402
replace \xf403

# Corrections
# Remove grouping from around superscripts and subscripts
noback pass2 @35-126[$d1-5]@345 @35*
noback pass2 @26-126[$d1-5]@345 @26*
# Remove grouping from fractions
noback pass2 @12356-126[$d1-5]@345-46-34_2 @12356*
noback pass2 @46-34-126[$d1-5]@345-23456 @46-34*@23456
