# ufl.formatting package

## Submodules

## ufl.formatting.ufl2unicode module

UFL to unicode.

class ufl.formatting.ufl2unicode.Expression2UnicodeHandler(argument_names=None, coefficient_names=None, colorama_bold=False)

  Bases: `MultiFunction`

  Convert expressions to unicode.

  abs(o, a)

    Format an ans.

  action(o, a, b)

    Format an Action.

  and_condition(o, a, b)

    Format an and_condition.

  argument(o)

    Format an argument.

  atan2(o, f1, f2)

    Format a atan2.

  base_form_operator(o)

    Format a base_form_operator.

  bessel_K(o, nu, f)

    Format a bessel_K.

  bessel_i(o, nu, f)

    Format a bessel_i.

  bessel_j(o, nu, f)

    Format a bessel_j.

  bessel_y(o, nu, f)

    Format a bessel_y.

  cell_avg(o, f)

    Format a cell_avg.

  coefficient(o)

    Format a coefficient.

  coefficient_derivative(o, f, w, v, cd)

    Format a coefficient_derivative.

  cofactor(o, A)

    Format a cofactor.

  cofunction(o)

    Format a cofunction.

  component_tensor(o, A, ii)

    Format a component_tensor.

  conditional(o, c, t, f)

    Format a conditional.

  conj(o, a)

    Format a conj.

  constant(o)

    Format a constant.

  cross(o, a, b)

    Format a cross.

  curl(o, f)

    Format a curl.

  determinant(o, A)

    Format a determinant.

  deviatoric(o, A)

    Format a deviatoric.

  div(o, f)

    Format a div.

  division(o, a, b)

    Format a division.

  dot(o, a, b)

    Format a dot.

  eq(o, a, b)

    Format an eq.

  exp(o, f)

    Format a exp.

  expr(o)

    Format an expr.

  expr_list(o, *ops)

    Format an expr_list.

  expr_mapping(o, *ops)

    Format an expr_mapping.

  facet_avg(o, f)

    Format a facet_avg.

  facet_normal(o)

    Format a facet_normal.

  ge(o, a, b)

    Format a ge.

  grad(o, f)

    Format a grad.

  gt(o, a, b)

    Format a gt.

  identity(o)

    Format a identity.

  imag(o, a)

    Format a imag.

  index_sum(o, f, i)

    Format a index_sum.

  indexed(o, A, ii)

    Format an indexed.

  inner(o, a, b)

    Format an inner.

  inverse(o, A)

    Format an inverse.

  label(o)

    Format a label.

  le(o, a, b)

    Format a le.

  list_tensor(o, *ops)

    Format a list_tensor.

  lt(o, a, b)

    Format a lt.

  math_function(o, f)

    Format a math_function.

  max_value(o, a, b)

    Format an max_value.

  min_value(o, a, b)

    Format an min_value.

  multi_index(o)

    Format a multi_index.

  nabla_div(o, f)

    Format a nabla_div.

  nabla_grad(o, f)

    Format a nabla_grad.

  ne(o, a, b)

    Format a ne.

  negative_restricted(o, f)

    Format a negative_restriced.

  not_condition(o, a)

    Format a not_condition.

  or_condition(o, a, b)

    Format an or_condition.

  outer(o, a, b)

    Format an outer.

  permutation_symbol(o)

    Format a permutation_symbol.

  positive_restricted(o, f)

    Format a positive_restriced.

  power(o, a, b)

    Format a power.

  product(o, a, b)

    Format a product.

  real(o, a)

    Format a real.

  scalar_value(o)

    Format a scalar_value.

  skew(o, A)

    Format a skew.

  spatial_coordinate(o)

    Format a spatial_coordinate.

  sqrt(o, f)

    Format a sqrt.

  sum(o, a, b)

    Format a sum.

  sym(o, A)

    Format a sym.

  trace(o, A)

    Format a trace.

  transposed(o, a)

    Format a transposed.

  variable(o, f, a)

    Format a variable.

  variable_derivative(o, f, v)

    Format a variable_derivative.

  zero(o)

    Format a zero.

class ufl.formatting.ufl2unicode.PrecedenceRules

  Bases: `MultiFunction`

  An enum-like class for C operator precedence levels.

  add(o)

    Return precedence of an add.

  and_condition(o)

    Return precedence of an and_condition.

  bessel_function(o)

    Return precedence of a call.

  call(o)

    Return precedence of a call.

  cell_avg(o)

    Return precedence of a restriced.

  cofactor(o)

    Return precedence of a mathop.

  component_tensor(o)

    Return the highest precendence.

  conditional(o)

    Return precedence of a conditional.

  cross(o)

    Return precedence of a product.

  derivative(o)

    Return precedence of a mathop.

  deviatoric(o)

    Return precedence of a mathop.

  division(o)

    Return precedence of a product.

  dot(o)

    Return precedence of a product.

  eq(o)

    Return precedence of an eq.

  facet_avg(o)

    Return precedence of a restriced.

  ge(o)

    Return precedence of a lt.

  gt(o)

    Return precedence of a lt.

  highest(o)

    Return the highest precendence.

  index_sum(o)

    Return precedence of an add.

  indexed(o)

    Return precedence of a call.

  inner(o)

    Return precedence of a product.

  le(o)

    Return precedence of a lt.

  list_tensor(o)

    Return the highest precendence.

  lowest(o)

    Return precedence of a lowest.

  lt(o)

    Return precedence of a lt.

  math_function(o)

    Return precedence of a call.

  mathop(o)

    Return precedence of a mathop.

  max_value(o)

    Return precedence of a call.

  min_value(o)

    Return precedence of a call.

  ne(o)

    Return precedence of an eq.

  not_condition(o)

    Return precedence of a not_condition.

  operator(o)

    Return precedence of a lowest.

  or_condition(o)

    Return precedence of an or_condition.

  outer(o)

    Return precedence of a product.

  power(o)

    Return precedence of a power.

  product(o)

    Return precedence of a product.

  restricted(o)

    Return precedence of a restriced.

  skew(o)

    Return precedence of a mathop.

  sym(o)

    Return precedence of a mathop.

  terminal(o)

    Return the highest precendence.

  trace(o)

    Return precedence of a mathop.

class ufl.formatting.ufl2unicode.UC

  Bases: `object`

  An enum-like class for unicode characters.

  Gamma = 'Γ'
  Omega = 'Ω'
  bold_math_A = '𝐀'
  bold_math_a = '𝐚'
  circled_times = '⊗'
  combining_overline = '̅'
  combining_right_arrow_above = '⃗'
  cross_product = '⨯'
  division_slash = '∕'
  dot = '⋅'
  element_of = '∈'
  epsilon = 'ε'
  for_all = '∀'
  gamma = 'γ'
  ge = '≥'
  gt = '>'
  integral = '∫'
  integral_contour = '∮'
  integral_double = '∬'
  integral_surface = '∯'
  integral_triple = '∭'
  integral_volume = '∰'
  le = '≤'
  left_angled_bracket = '⟨'
  left_double_angled_bracket = '⟪'
  left_white_square_bracket = '⟦'
  logical_and = '∧'
  logical_not = '¬'
  logical_or = '∨'
  lt = '<'
  nabla = '∇'
  nary_product = '∏'
  ne = '≠'
  not_element_of = '∉'
  omega = 'ω'
  partial = '∂'
  right_angled_bracket = '⟩'
  right_double_angled_bracket = '⟫'
  right_white_squared_bracket = '⟧'
  sqrt = '√'
  subscript_digits = ['₀', '₁', '₂', '₃', '₄', '₅', '₆', '₇', '₈', '₉']
  subscript_equals = '₌'
  subscript_left_paren = '₍'
  subscript_minus = '₋'
  subscript_plus = '₊'
  subscript_right_paren = '₎'
  sum = '∑'
  superscript_digits = ['⁰', '¹', '²', '³', '⁴', '⁵', '⁶', '⁷', '⁸', '⁹']
  superscript_equals = '⁼'
  superscript_left_paren = '⁽'
  superscript_minus = '⁻'
  superscript_plus = '⁺'
  superscript_right_paren = '⁾'
  thin_space = '\u2009'
  transpose = 'ᵀ'

ufl.formatting.ufl2unicode.binop(expr, a, b, op, sep=' ')

  Format a binary operation.

ufl.formatting.ufl2unicode.bolden_letter(c)

  Bolden a letter.

ufl.formatting.ufl2unicode.bolden_string(s)

  Bolden a string.

ufl.formatting.ufl2unicode.expression2unicode(expression, argument_names=None, coefficient_names=None)

  Generate Unicode string for a UFL expression.

ufl.formatting.ufl2unicode.form2unicode(form, formdata)

  Generate Unicode string for a UFL form.

ufl.formatting.ufl2unicode.format_index(ii)

  Format an index.

ufl.formatting.ufl2unicode.get_integral_symbol(integral_type, domain, subdomain_id)

  Get the symbol for an integral.

ufl.formatting.ufl2unicode.is_int(s)

  Check if a value is an integer.

ufl.formatting.ufl2unicode.mathop(expr, arg, opname)

  Format a math operation.

ufl.formatting.ufl2unicode.measure_font(dx)

  Use the font for measures.

ufl.formatting.ufl2unicode.opfont(opname)

  Use the font for operators.

ufl.formatting.ufl2unicode.overline_string(f)

  Overline a string.

ufl.formatting.ufl2unicode.par(s)

  Wrap in parentheses.

ufl.formatting.ufl2unicode.precedence(expr)

  Get the precedence of an expr.

ufl.formatting.ufl2unicode.subscript_digit(digit)

  Make a digit subscript.

ufl.formatting.ufl2unicode.subscript_number(number)

  Make a number subscript.

ufl.formatting.ufl2unicode.superscript_digit(digit)

  Make a digit superscript.

ufl.formatting.ufl2unicode.superscript_number(number)

  Make a number superscript.

ufl.formatting.ufl2unicode.ufl2unicode(expression)

  Generate Unicode string for a UFL expression or form.

## Module contents

Formatting.