Skip to content

Commit

Permalink
Replace \mbox by \text in manifolds
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasdiez committed Mar 26, 2023
1 parent c00e6c2 commit aca70fc
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 35 deletions.
2 changes: 1 addition & 1 deletion src/sage/manifolds/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -2165,7 +2165,7 @@ def _display_coord_range(self, xx, rtxt, rlatex):
rlatex += r"\right]"
if bounds[1][1] == 'periodic':
rtxt += " (periodic)"
rlatex += r"\mbox{(periodic)}"
rlatex += r"\text{(periodic)}"
else:
rtxt += ")"
rlatex += r"\right)"
Expand Down
8 changes: 4 additions & 4 deletions src/sage/manifolds/continuous_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ def _latex_(self):
"""
if self._latex_name is None:
return r'\mbox{' + str(self) + r'}'
return r'\text{' + str(self) + r'}'
else:
return self._latex_name

Expand Down Expand Up @@ -1119,7 +1119,7 @@ def display(self, chart1=None, chart2=None):
sage: latex(Phi.display(c_xy, c_cart))
\begin{array}{llcl} \Phi:& S^2 & \longrightarrow & \RR^3
\\ \mbox{on}\ U : & \left(x, y\right) & \longmapsto
\\ \text{on}\ U : & \left(x, y\right) & \longmapsto
& \left(X, Y, Z\right) = \left(\frac{2 \, x}{x^{2} + y^{2} + 1},
\frac{2 \, y}{x^{2} + y^{2} + 1},
\frac{x^{2} + y^{2} - 1}{x^{2} + y^{2} + 1}\right)
Expand Down Expand Up @@ -1176,7 +1176,7 @@ def display(self, chart1=None, chart2=None):
2*y/(x**2 + y**2 + 1), (x**2 + y**2 - 1)/(x**2 + y**2 + 1))
sage: latex(Phi.display(c_xy, c_cart))
\begin{array}{llcl} \Phi:& S^2 & \longrightarrow & \RR^3
\\ \mbox{on}\ U : & \left(x, y\right) & \longmapsto
\\ \text{on}\ U : & \left(x, y\right) & \longmapsto
& \left(X, Y, Z\right) = \left(\frac{2 x}{x^{2} + y^{2} + 1},
\frac{2 y}{x^{2} + y^{2} + 1},
\frac{x^{2} + y^{2} - 1}{x^{2} + y^{2} + 1}\right)
Expand Down Expand Up @@ -1212,7 +1212,7 @@ def _display_expression(self, chart1, chart2, result):
result._latex += ' & '
else:
result._txt += 'on ' + chart1._domain._name + ': '
result._latex += r'\mbox{on}\ ' + latex(chart1._domain) + \
result._latex += r'\text{on}\ ' + latex(chart1._domain) + \
r': & '
result._txt += repr(coords1) + ' ' + unicode_mapsto + ' '
result._latex += latex(coords1) + r'& \longmapsto & '
Expand Down
2 changes: 1 addition & 1 deletion src/sage/manifolds/differentiable/curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class DifferentiableCurve(DiffMap):
sage: c = M.curve([sin(t), sin(2*t)/2], (t, 0, 2*pi))
sage: latex(c)
\mbox{Curve in the 2-dimensional differentiable manifold M}
\text{Curve in the 2-dimensional differentiable manifold M}
sage: c = M.curve([sin(t), sin(2*t)/2], (t, 0, 2*pi), name='c')
sage: latex(c)
c
Expand Down
2 changes: 1 addition & 1 deletion src/sage/manifolds/differentiable/diff_form_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ def _latex_(self):
"""
if self._latex_name is None:
return r'\mbox{' + str(self) + r'}'
return r'\text{' + str(self) + r'}'
else:
return self._latex_name

Expand Down
4 changes: 2 additions & 2 deletions src/sage/manifolds/differentiable/metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ def _new_instance(self):
"""
return type(self)(self._vmodule, 'unnamed metric',
signature=self._signature,
latex_name=r'\mbox{unnamed metric}')
latex_name=r'\text{unnamed metric}')

def _init_derived(self):
r"""
Expand Down Expand Up @@ -2706,7 +2706,7 @@ def _new_instance(self):
"""
return type(self)(self._vmodule, 'unnamed metric',
signature=self._signature,
latex_name=r'\mbox{unnamed metric}')
latex_name=r'\text{unnamed metric}')

def signature(self):
r"""
Expand Down
6 changes: 3 additions & 3 deletions src/sage/manifolds/differentiable/mixed_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def _latex_(self):
"""
if self._name is None:
return r'\mbox{' + repr(self) + r'}'
return r'\text{' + repr(self) + r'}'
else:
return self._latex_name

Expand Down Expand Up @@ -549,7 +549,7 @@ def display(self):
else:
resu_txt += self[0]._name
if self[0]._latex_name is None:
resu_latex += r"\mbox{(unnamed scalar field)}"
resu_latex += r"\text{(unnamed scalar field)}"
else:
resu_latex += latex(self[0])
# Differential forms:
Expand All @@ -559,7 +559,7 @@ def display(self):
else:
resu_txt += " + " + self[j]._name
if self[j]._latex_name is None:
resu_latex += r"+\mbox{(unnamed " + str(j) + r"-form)}"
resu_latex += r"+\text{(unnamed " + str(j) + r"-form)}"
else:
resu_latex += r"+" + latex(self[j])
return FormattedExpansion(resu_txt, resu_latex)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/manifolds/differentiable/multivector_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ def _latex_(self):
"""
if self._latex_name is None:
return r'\mbox{' + str(self) + r'}'
return r'\text{' + str(self) + r'}'
else:
return self._latex_name

Expand Down
2 changes: 1 addition & 1 deletion src/sage/manifolds/differentiable/symplectic_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def _new_instance(self):
return type(self)(
self._vmodule,
"unnamed symplectic form",
latex_name=r"\mbox{unnamed symplectic form}",
latex_name=r"\text{unnamed symplectic form}",
)

def _init_derived(self):
Expand Down
6 changes: 3 additions & 3 deletions src/sage/manifolds/differentiable/tensorfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ class TensorField(ModuleElementWithMutability):
.. MATH::
t(p):\ \underbrace{T_q^*M\times\cdots\times T_q^*M}_{k\ \; \mbox{times}}
\times \underbrace{T_q M\times\cdots\times T_q M}_{l\ \; \mbox{times}}
t(p):\ \underbrace{T_q^*M\times\cdots\times T_q^*M}_{k\ \; \text{times}}
\times \underbrace{T_q M\times\cdots\times T_q M}_{l\ \; \text{times}}
\longrightarrow K,
where `T_q^* M` is the dual vector space to `T_q M` and `K` is the
Expand Down Expand Up @@ -589,7 +589,7 @@ def _latex_(self):
"""
if self._latex_name is None:
return r'\mbox{' + str(self) + r'}'
return r'\text{' + str(self) + r'}'
else:
return self._latex_name

Expand Down
2 changes: 1 addition & 1 deletion src/sage/manifolds/differentiable/tensorfield_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ def _latex_(self):
"""
if self._latex_name is None:
return r'\mbox{' + str(self) + r'}'
return r'\text{' + str(self) + r'}'
else:
return self._latex_name

Expand Down
4 changes: 2 additions & 2 deletions src/sage/manifolds/differentiable/tensorfield_paral.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,8 @@ class TensorFieldParal(FreeModuleTensor, TensorField):
.. MATH::
t(p):\ \underbrace{T_q^*M\times\cdots\times T_q^*M}_{k\ \; \mbox{times}}
\times \underbrace{T_q M\times\cdots\times T_q M}_{l\ \; \mbox{times}}
t(p):\ \underbrace{T_q^*M\times\cdots\times T_q^*M}_{k\ \; \text{times}}
\times \underbrace{T_q M\times\cdots\times T_q M}_{l\ \; \text{times}}
\longrightarrow K,
where `T_q^* M` is the dual vector space to `T_q M` and `K` is the
Expand Down
10 changes: 5 additions & 5 deletions src/sage/manifolds/differentiable/vector_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ class TensorBundle(DifferentiableVectorBundle):
.. MATH::
t:\ \underbrace{T_q^*N\times\cdots\times T_q^*N}_{k\ \; \mbox{times}}
\times \underbrace{T_q N\times\cdots\times T_q N}_{l\ \; \mbox{times}}
t:\ \underbrace{T_q^*N\times\cdots\times T_q^*N}_{k\ \; \text{times}}
\times \underbrace{T_q N\times\cdots\times T_q N}_{l\ \; \text{times}}
\longrightarrow K
(`k` is called the *contravariant* and `l` the *covariant* rank of the
Expand Down Expand Up @@ -464,7 +464,7 @@ def __init__(self, base_space, k, l, dest_map=None):
else:
name = self._dest_map._name + "^*"
if self._dest_map._latex_name is None:
latex_name = r'\mbox{(unnamed map)}^* '
latex_name = r'\text{(unnamed map)}^* '
else:
latex_name = self._dest_map._latex_name + r'^* '
else:
Expand Down Expand Up @@ -1356,8 +1356,8 @@ def local_frame(self, *args, **kwargs):
.. MATH::
p \mapsto \Big(\underbrace{e^*(p), \dots, e^*(p)}_{k\ \; \mbox{times}},
\underbrace{e(p), \dots, e(p)}_{l\ \; \mbox{times}}\Big) \in
p \mapsto \Big(\underbrace{e^*(p), \dots, e^*(p)}_{k\ \; \text{times}},
\underbrace{e(p), \dots, e(p)}_{l\ \; \text{times}}\Big) \in
T^{(k,l)}_q N ,
with `q=\Phi(p)`, defines a basis at each point `p \in U` and
Expand Down
2 changes: 1 addition & 1 deletion src/sage/manifolds/manifold_homset.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def _latex_(self):
\mathrm{Hom}\left(M,N\right)
"""
if self._latex_name is None:
return r'\mbox{' + str(self) + r'}'
return r'\text{' + str(self) + r'}'
else:
return self._latex_name

Expand Down
4 changes: 2 additions & 2 deletions src/sage/manifolds/point.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def _latex_(self):
sage: X.<x,y> = M.chart()
sage: p = M((2,-3))
sage: p._latex_()
'\\mbox{Point on the 2-dimensional topological manifold M}'
'\\text{Point on the 2-dimensional topological manifold M}'
sage: p = M((2,-3), name='p')
sage: p._latex_()
'p'
Expand All @@ -262,7 +262,7 @@ def _latex_(self):
"""
if self._latex_name is None:
return r'\mbox{' + str(self) + r'}'
return r'\text{' + str(self) + r'}'
return self._latex_name

def coordinates(self, chart=None, old_chart=None):
Expand Down
17 changes: 11 additions & 6 deletions src/sage/manifolds/scalarfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,18 @@
# https://www.gnu.org/licenses/
# *****************************************************************************

from typing import Optional
from __future__ import annotations
from typing import Optional, TYPE_CHECKING
from sage.structure.element import (CommutativeAlgebraElement,
ModuleElementWithMutability)
from sage.symbolic.expression import Expression
from sage.manifolds.chart_func import ChartFunction
from sage.misc.cachefunc import cached_method

if TYPE_CHECKING:
from sage.tensor.modules.format_utilities import FormattedExpansion
from sage.manifolds.chart import Chart

class ScalarField(CommutativeAlgebraElement, ModuleElementWithMutability):
r"""
Scalar field on a topological manifold.
Expand Down Expand Up @@ -1499,7 +1504,7 @@ def _latex_(self):
sage: X.<x,y> = M.chart()
sage: f = M.scalar_field({X: x+y})
sage: f._latex_()
'\\mbox{Scalar field on the 2-dimensional topological manifold M}'
'\\text{Scalar field on the 2-dimensional topological manifold M}'
sage: f = M.scalar_field({X: x+y}, name='f')
sage: f._latex_()
'f'
Expand All @@ -1511,7 +1516,7 @@ def _latex_(self):
"""
if self._latex_name is None:
return r'\mbox{' + str(self) + r'}'
return r'\text{' + str(self) + r'}'
else:
return self._latex_name

Expand Down Expand Up @@ -2096,7 +2101,7 @@ def set_restriction(self, rst):
self._express[chart.restrict(intersection)] = expr
self._is_zero = False # a priori

def display(self, chart=None):
def display(self, chart: Optional[Chart]=None) -> FormattedExpansion:
r"""
Display the expression of the scalar field in a given chart.
Expand Down Expand Up @@ -2149,7 +2154,7 @@ def display(self, chart=None):
f: M → ℝ
on U: (x, y) ↦ y^2
sage: latex(f.display())
\begin{array}{llcl} f:& M & \longrightarrow & \mathbb{R} \\ \mbox{on}\ U : & \left(x, y\right) & \longmapsto & y^{2} \end{array}
\begin{array}{llcl} f:& M & \longrightarrow & \mathbb{R} \\ \text{on}\ U : & \left(x, y\right) & \longmapsto & y^{2} \end{array}
"""
from sage.misc.latex import latex
Expand All @@ -2176,7 +2181,7 @@ def _display_expression(self, chart, result):
result._latex += " & "
else:
result._txt += "on " + chart.domain()._name + ": "
result._latex += r"\mbox{on}\ " + latex(chart.domain()) \
result._latex += r"\text{on}\ " + latex(chart.domain()) \
+ r": & "
result._txt += repr(coords) + " " + unicode_mapsto + " " \
+ repr(expression) + "\n"
Expand Down
2 changes: 1 addition & 1 deletion src/sage/manifolds/section.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def _latex_(self):
"""
if self._latex_name is None:
return r'\mbox{' + str(self) + r'}'
return r'\text{' + str(self) + r'}'
else:
return self._latex_name

Expand Down

0 comments on commit aca70fc

Please sign in to comment.