Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ gstest:


#: Create data that is used to in Django docs and to build TeX PDF
doc-data mathics/doc/tex/data: mathics/builtin/*.py mathics/doc/documentation/*.mdoc mathics/doc/documentation/images/*
doc-data mathics/doc/tex/doc_tex_data.pcl: mathics/builtin/*.py mathics/doc/documentation/*.mdoc mathics/doc/documentation/images/*
$(PYTHON) mathics/test.py -ot -k

#: Run tests that appear in docstring in the code.
doctest:
SANDBOX=$(SANDBOX) $(PYTHON) mathics/test.py $o

#: Make Mathics PDF manual
doc mathics.pdf: mathics/doc/tex/data
doc mathics.pdf: mathics/doc/tex/doc_tex_data.pcl
(cd mathics/doc/tex && $(MAKE) mathics.pdf)

#: Remove ChangeLog
Expand Down
20 changes: 12 additions & 8 deletions mathics/builtin/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,14 @@ class Nand(Builtin):
"""
<dl>
<dt>'Nand[$expr1$, $expr2$, ...]'
<dt>'$expr1$ \u22BC $expr2$ \u22BC ...'
<dt>'$expr1$' \u22BC $expr2$ \u22BC ...
<dd> Implements the logical NAND function. The same as 'Not[And['$expr1$, $expr2$, ...']]'
</dl>
>> Nand[True, False]
= True
"""

operator = "\u22BC"
rules = {
"Nand[expr___]": "Not[And[expr]]",
}
Expand All @@ -154,13 +155,14 @@ class Nor(Builtin):
"""
<dl>
<dt>'Nor[$expr1$, $expr2$, ...]'
<dt>'$expr1$ \u22BD $expr2$ \u22BD ...'
<dt>'$expr1$' \u22BD $expr2$ \u22BD ...
<dd>Implements the logical NOR function. The same as 'Not[Or['$expr1$, $expr2$, ...']]'
</dl>
>> Nor[True, False]
= False
"""

operator = "\u22BD"
rules = {
"Nor[expr___]": "Not[Or[expr]]",
}
Expand Down Expand Up @@ -207,9 +209,10 @@ def apply(self, x, y, evaluation):
class Equivalent(BinaryOperator):
"""
<dl>
<dt>'Equivalent[$expr1$, $expr2$, ...]'
<dt>'$expr1$ \u29E6 $expr2$ \u29E6 ...'
<dd>is equivalent to
<dt>'Equivalent[$expr1$, $expr2$, ...]'
<dt>$expr1$ \u29E6 $expr2$ \u29E6 ...

<dd>is equivalent to
($expr1$ && $expr2$ && ...) || (!$expr1$ && !$expr2$ && ...)
</dl>

Expand Down Expand Up @@ -259,9 +262,10 @@ def apply(self, args, evaluation):
class Xor(BinaryOperator):
"""
<dl>
<dt>'Xor[$expr1$, $expr2$, ...]'
<dt>'$expr1$ \u22BB $expr2$ \u22BB ...'
<dd>evaluates each expression in turn, returning 'True'
<dt>'Xor[$expr1$, $expr2$, ...]'
<dt>$expr1$ \u22BB $expr2$ \u22BB ...

<dd>evaluates each expression in turn, returning 'True'
as soon as not all expressions evaluate to the same value. If all
expressions evaluate to the same value, 'Xor' returns 'False'.
</dl>
Expand Down
2 changes: 1 addition & 1 deletion mathics/builtin/numbers/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ class E(_MPMathConstant, _NumpyConstant, _SympyConstant):
"""
<dl>
<dt>'E'</dt>
<dd>is the constant \u2147 with numerical value \u2243 2.71828.
<dd>is the constant \u2107 with numerical value \u2243 2.71828.
</dl>

>> N[E]
Expand Down
33 changes: 16 additions & 17 deletions mathics/doc/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,17 +256,21 @@ def repl_list(match):
text,
[
("$", r"\$"),
("\u22bc", "nand"), # \barwedge isn't working
("\u22bd", "nor"), # \vebarr isn't working
("\u03c0", r"$\pi$"),
("\u2265", r"$\ge$"),
("\u2264", r"$\le$"),
("\u2260", r"$\ne$"),
("\00f1", r"\~n"),
("\u00e7", r"\c{c}"),
("\u00e9", r"\'e"),
("\u00ea", r"\^e"),
("\00f1", r"\~n"),
("\u03b3", r"$\gamma$"),
("\u03c0", r"$\pi$"),
("\u2107", r"$\mathrm{e}$"),
("\u222b", r"\int"),
("\u2243", r"$\simeq$"),
("\u2260", r"$\ne$"),
("\u2264", r"$\le$"),
("\u2265", r"$\ge$"),
("\u22bb", r"$\oplus$"), # The WL veebar-looking symbol isn't in AMSLaTeX
("\u22bc", r"$\barwedge$"),
("\u22bd", r"$\veebar$"),
("\uf74c", r"d"),
],
)
Expand Down Expand Up @@ -651,16 +655,11 @@ def __init__(self):
title, text = get_module_doc(module)
chapter = DocChapter(builtin_part, title, Doc(text))
builtins = builtins_by_module[module.__name__]

if module.__file__.endswith("__init__.py"):
section_names = get_submodule_names(module)
else:
section_names = [
builtin
for builtin in builtins
if not builtin.__class__.__name__.endswith("Box")
]

section_names = [
builtin
for builtin in builtins
if not builtin.__class__.__name__.endswith("Box")
]
for instance in section_names:
installed = True
for package in getattr(instance, "requires", []):
Expand Down
2 changes: 1 addition & 1 deletion mathics/doc/tex/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ clean:
rm -f mathics.fdb_latexmk mathics.ilg mathics.ind mathics.maf mathics.pre
rm -f mathics_*.* || true
rm -f mathics-*.* documentation.tex || true
rm -f mathics.pdf mathics.dvi data || true
rm -f mathics.pdf mathics.dvi data_tex_data.pcl || true
2 changes: 1 addition & 1 deletion mathics/doc/tex/mathics.tex
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
{~}{{\textasciitilde}}1
{⧦}{{===}}1
{}{{=>}}1
{⊻}{{xor}}1
{⊻}{{$\oplus$}}1
{…}{{...}}1
{∫}{{S}}1
{}{{d}}1
Expand Down
7 changes: 3 additions & 4 deletions mathics/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@ def make_doc(quiet=False, reload=False):
print("Extracting doc %s" % version_string)

try:
output_xml = {}
output_tex = load_doc_data() if reload else {}
for tests in documentation.get_tests():
create_output(tests, output_tex)
Expand All @@ -340,11 +339,11 @@ def make_doc(quiet=False, reload=False):


def write_latex():
print("Load data")
print(f"Load data {settings.DOC_TEX_DATA_PATH}")
with open_ensure_dir(settings.DOC_TEX_DATA_PATH, "rb") as output_file:
output_tex = pickle.load(output_file)

print("Print documentation")
print(f"Write LaTeX {settings.DOC_LATEX_FILE}")
with open_ensure_dir(settings.DOC_LATEX_FILE, "wb") as doc:
content = documentation.latex(output_tex)
content = content.encode("utf-8")
Expand Down Expand Up @@ -409,7 +408,7 @@ def main():
"--doc-only",
dest="doc_only",
action="store_true",
help="generate TeX and XML output data without running tests",
help="generate TeX output data without running tests",
)
parser.add_argument(
"--reload",
Expand Down