From c80d3ac6795f9c0d6ae53d7277653c1afc8c7c14 Mon Sep 17 00:00:00 2001 From: mmatera Date: Wed, 29 Jan 2025 15:57:53 -0300 Subject: [PATCH 1/3] more about fixing the use of latex expressions in docstring documentation --- mathics/builtin/drawing/graphics3d.py | 10 +++++----- mathics/doc/doc_entries.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mathics/builtin/drawing/graphics3d.py b/mathics/builtin/drawing/graphics3d.py index 230b72535..dc7381778 100644 --- a/mathics/builtin/drawing/graphics3d.py +++ b/mathics/builtin/drawing/graphics3d.py @@ -247,16 +247,16 @@ class Cuboid(Builtin): Cuboid also known as interval, rectangle, square, cube, rectangular parallelepiped, tesseract, orthotope, and box.
-
'Cuboid[$p_min$]' +
'Cuboid'[$p_{min}$]
is a unit cube/square with its lower corner at point $p_min$. -
'Cuboid[$p_min$, $p_max$] +
'Cuboid'[$p_{min}$, $p_{max}$]
is a 2d square with with lower corner $p_min$ and upper corner $p_max$. -
'Cuboid[{$p_min$, $p_max$}]' -
is a cuboid with lower corner $p_min$ and upper corner $p_max$. +
'Cuboid'[{$p_{min}$, $p_{max}$}] +
is a cuboid with lower corner $p_{min}$ and upper corner $p_{max}$. -
'Cuboid[{$p1_min$, $p1_max$, ...}]' +
'Cuboid'[{$p1_{min}$, $p1_{max}$, ...}]
is a collection of cuboids.
'Cuboid[]' is equivalent to 'Cuboid[{0,0,0}]'. diff --git a/mathics/doc/doc_entries.py b/mathics/doc/doc_entries.py index 201d4ae19..958711104 100644 --- a/mathics/doc/doc_entries.py +++ b/mathics/doc/doc_entries.py @@ -66,7 +66,7 @@ r'' ) # Preserve space before and after in-line code variables. -LATEX_RE = re.compile(r"(\s?)\$(\w+?)\$(\s?)") +LATEX_RE = re.compile(r"(\s?)\$([A-Za-z]+?)\$(\s?)") LIST_ITEM_RE = re.compile(r"(?s)
  • (.*?)(?:
  • |(?=
  • )|$)") LIST_RE = re.compile(r"(?s)<(?Pul|ol)>(?P.*?)") From 3bce16f2d85831ca7d64527da98f6b9ae822fbbd Mon Sep 17 00:00:00 2001 From: mmatera Date: Wed, 29 Jan 2025 16:00:49 -0300 Subject: [PATCH 2/3] more about fixing the use of latex expressions in docstring documentation --- mathics/builtin/drawing/graphics3d.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mathics/builtin/drawing/graphics3d.py b/mathics/builtin/drawing/graphics3d.py index dc7381778..56580a072 100644 --- a/mathics/builtin/drawing/graphics3d.py +++ b/mathics/builtin/drawing/graphics3d.py @@ -248,10 +248,10 @@ class Cuboid(Builtin): Cuboid also known as interval, rectangle, square, cube, rectangular parallelepiped, tesseract, orthotope, and box.
    'Cuboid'[$p_{min}$] -
    is a unit cube/square with its lower corner at point $p_min$. +
    is a unit cube/square with its lower corner at point $p_{min}$.
    'Cuboid'[$p_{min}$, $p_{max}$] -
    is a 2d square with with lower corner $p_min$ and upper corner $p_max$. +
    is a 2d square with with lower corner $p_{min}$ and upper corner $p_{max}$.
    'Cuboid'[{$p_{min}$, $p_{max}$}]
    is a cuboid with lower corner $p_{min}$ and upper corner $p_{max}$. From b9b9d90059e45c0c748d2722396d3cccd4ee2e33 Mon Sep 17 00:00:00 2001 From: mmatera Date: Wed, 29 Jan 2025 16:22:20 -0300 Subject: [PATCH 3/3] restore the previous regular expression, needed for the LaTeX documentation. --- mathics/doc/doc_entries.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathics/doc/doc_entries.py b/mathics/doc/doc_entries.py index 958711104..201d4ae19 100644 --- a/mathics/doc/doc_entries.py +++ b/mathics/doc/doc_entries.py @@ -66,7 +66,7 @@ r'' ) # Preserve space before and after in-line code variables. -LATEX_RE = re.compile(r"(\s?)\$([A-Za-z]+?)\$(\s?)") +LATEX_RE = re.compile(r"(\s?)\$(\w+?)\$(\s?)") LIST_ITEM_RE = re.compile(r"(?s)
  • (.*?)(?:
  • |(?=
  • )|$)") LIST_RE = re.compile(r"(?s)<(?Pul|ol)>(?P.*?)")