Skip to content

Workflows #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Feb 9, 2025
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Mathics3-user-guide

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt update -qq && sudo apt install asymptote texlive-xetex texlive-latex-extra
python -m pip install --upgrade pip
- name: Install the documentation and dependencies
run: |
make setup
- name: Generate documentation
run: |
mkdir /home/runner/.local
mkdir /home/runner/.local/var
mkdir /home/runner/.local/var/Mathics3
make doctest-data
make rst-documentation
cd docs
make html
make latex
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ build rebuild:
#: Wipe derivable files
clean:
$(MAKE) -C docs $<
rm -f -R docs/manual
rm -f -R docs/reference-of-builtin-symbols

6 changes: 5 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ["sphinx.ext.autosectionlabel"]
extensions = ["sphinx.ext.autosectionlabel", "sphinx.ext.mathjax"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
Expand All @@ -57,3 +57,7 @@

latex_engine = 'xelatex'


mathjax2_config={
"preamble":r"\usepackage{multirow}",
}
2 changes: 1 addition & 1 deletion docs/manual/further-tutorial-examples/curve-sketching.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Finally, let's plot :code:`f` :
>>> Plot[f[x], {x, -8, 6}]

=
.. image:: tmp1h__d952.png
.. image:: asy_Manual_Further_Tutorial_Examples_Curve_Sketching_3clg1xkv.png
:align: center


Expand Down
10 changes: 5 additions & 5 deletions docs/manual/further-tutorial-examples/dice.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ A dice object shall be displayed as a rectangle with the given number of points
>>> Dice[1]

=
.. image:: tmpp81ukcll.png
.. image:: asy_Manual_Further_Tutorial_Examples_Dice_falirv9n.png
:align: center


Expand All @@ -57,7 +57,7 @@ The empty series of dice shall be displayed as an empty dice:
>>> Dice[]

=
.. image:: tmpabn7beds.png
.. image:: asy_Manual_Further_Tutorial_Examples_Dice_aeohbq0n.png
:align: center


Expand All @@ -71,7 +71,7 @@ Any non-empty series of dice shall be displayed as a row of individual dice:
>>> Dice[1, 6, 4, 4]

=
.. image:: tmp32or4y29.png
.. image:: eq_Manual_Further_Tutorial_Examples_Dice_g2c_gxxt.png
:align: center


Expand Down Expand Up @@ -111,7 +111,7 @@ We can now combine dice:
>>> Dice[1, 5] + Dice[3, 2] + Dice[4]

=
.. image:: tmp0nqno03o.png
.. image:: eq_Manual_Further_Tutorial_Examples_Dice_xbql_vb5.png
:align: center


Expand All @@ -137,7 +137,7 @@ And now let's put some dice into a table:
>>> Table[{Dice[Sequence @@ d], DiceSum @ Dice[Sequence @@ d]}, {d, {{1, 2}, {2, 2}, {2, 6}}}] // TableForm

=
.. image:: tmpyxbsv76w.png
.. image:: eq_Manual_Further_Tutorial_Examples_Dice_f0ph1t0b.png
:align: center


Expand Down
4 changes: 2 additions & 2 deletions docs/manual/language-tutorial/3d-graphics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Three-dimensional graphics are created using the function :code:`Graphics3D` an
>>> Graphics3D[Polygon[{{0,0,0}, {0,1,1}, {1,0,0}}]]

=
.. image:: tmpouet69sx.png
.. image:: asy_Manual_Language_Tutorial_3D_Graphics_3gk0_tfk.png
:align: center


Expand All @@ -30,7 +30,7 @@ Colors can also be added to three-dimensional primitives.
>>> Graphics3D[{Orange, Polygon[{{0,0,0}, {1,1,1}, {1,0,0}}]}, Axes->True]

=
.. image:: tmppebt78xy.png
.. image:: asy_Manual_Language_Tutorial_3D_Graphics_n28iucq9.png
:align: center


Expand Down
10 changes: 5 additions & 5 deletions docs/manual/language-tutorial/graphics-introduction-examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ Two-dimensional graphics can be created using the function :code:`Graphics` and
>>> Graphics[{Circle[{0, 0}, 1]}]

=
.. image:: tmpax7zqh1e.png
.. image:: asy_Manual_Language_Tutorial_Graphics_Introduction_Examples_c4njl6yo.png
:align: center



>>> Graphics[{Line[{{0, 0}, {0, 1}, {1, 1}, {1, -1}}], Rectangle[{0, 0}, {-1, -1}]}]

=
.. image:: tmpqhakjtgl.png
.. image:: asy_Manual_Language_Tutorial_Graphics_Introduction_Examples_473uoeas.png
:align: center


Expand Down Expand Up @@ -65,7 +65,7 @@ All components range from 0 to 1. Each color function can be supplied with an ad
>>> Graphics[{Red, Disk[]}]

=
.. image:: tmpe8e4aqhv.png
.. image:: asy_Manual_Language_Tutorial_Graphics_Introduction_Examples_gdx6tf5c.png
:align: center


Expand All @@ -76,7 +76,7 @@ Table of hues:
>>> Graphics[Table[{Hue[h, s], Disk[{12h, 8s}]}, {h, 0, 1, 1/6}, {s, 0, 1, 1/4}]]

=
.. image:: tmpb5aws5pr.png
.. image:: asy_Manual_Language_Tutorial_Graphics_Introduction_Examples_rut4ke_s.png
:align: center


Expand All @@ -100,7 +100,7 @@ Colors can be mixed and altered using the following functions:
>>> Graphics[{Lighter[Red], Disk[]}]

=
.. image:: tmph8geaq1t.png
.. image:: asy_Manual_Language_Tutorial_Graphics_Introduction_Examples_ieet9zfc.png
:align: center


Expand Down
10 changes: 5 additions & 5 deletions docs/manual/language-tutorial/plotting-introduction-examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Plotting Introduction Examples
>>> Plot[Sin[x], {x, 0, 2 Pi}]

=
.. image:: tmp2kcscn62.png
.. image:: asy_Manual_Language_Tutorial_Plotting_Introduction_Examples_a3b7of6v.png
:align: center


Expand All @@ -17,7 +17,7 @@ You can also plot multiple functions at once:
>>> Plot[{Sin[x], Cos[x], x ^ 2}, {x, -1, 1}]

=
.. image:: tmp058vzyuu.png
.. image:: asy_Manual_Language_Tutorial_Plotting_Introduction_Examples_hh0ab9z2.png
:align: center


Expand All @@ -28,7 +28,7 @@ Two-dimensional functions can be plotted using :code:`DensityPlot` :
>>> DensityPlot[x ^ 2 + 1 / y, {x, -1, 1}, {y, 1, 4}]

=
.. image:: tmpvsl1hxll.png
.. image:: asy_Manual_Language_Tutorial_Plotting_Introduction_Examples_wk7lhasu.png
:align: center


Expand All @@ -39,7 +39,7 @@ You can use a custom coloring function:
>>> DensityPlot[x ^ 2 + 1 / y, {x, -1, 1}, {y, 1, 4}, ColorFunction -> (Blend[{Red, Green, Blue}, #]&)]

=
.. image:: tmpc8e2fuq6.png
.. image:: asy_Manual_Language_Tutorial_Plotting_Introduction_Examples_wb_49pu0.png
:align: center


Expand All @@ -52,7 +52,7 @@ Three-dimensional plots are supported as well:
>>> Plot3D[Exp[x] Cos[y], {x, -2, 1}, {y, -Pi, 2 Pi}]

=
.. image:: tmpxz6cv45t.png
.. image:: asy_Manual_Language_Tutorial_Plotting_Introduction_Examples_ywn64sh3.png
:align: center


Expand Down
8 changes: 8 additions & 0 deletions docs/mathics3-modules.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Mathics3 Modules
================



.. toctree::
:maxdepth: 2

mathics3-modules/graphs-vertices-and-edges.rst
mathics3-modules/natural-language-processing.rst

Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ The sum of 2 red circles and 3 red circles is...
>>> 2 Graphics[{Red,Disk[]}] + 3 Graphics[{Red,Disk[]}]

=
.. image:: tmp_d48_ncg.png
.. image:: eq_Reference_of_Built-in_Symbols_Arithmetic_Functions_Plus_z5tg1zs8.png
:align: center


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Power
>>> Plot[Evaluate[Table[x^y, {y, 1, 5}]], {x, -1.5, 1.5}, AspectRatio -> 1]

=
.. image:: tmp38z1kx_8.png
.. image:: asy_Reference_of_Built-in_Symbols_Arithmetic_Functions_Power_nihx1s1c.png
:align: center


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Complex numbers:
>>> Plot[Sqrt[a^2], {a, -2, 2}]

=
.. image:: tmpclcln5e9.png
.. image:: asy_Reference_of_Built-in_Symbols_Arithmetic_Functions_Sqrt__1ntrv9g.png
:align: center


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ The number of built-in symbols:
>>> Length[Names["System`*"]]

=
:math:`1507`
:math:`1497`


Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ BinaryRead
>>> strm = OpenWrite[BinaryFormat -> True]

=
:math:`\text{OutputStream}\left[\text{/tmp/tmpr\_gu7\_2h},3\right]`
:math:`\text{OutputStream}\left[\text{/tmp/tmpc82totep},3\right]`


>>> BinaryWrite[strm, {97, 98, 99}]

=
:math:`\text{OutputStream}\left[\text{/tmp/tmpr\_gu7\_2h},3\right]`
:math:`\text{OutputStream}\left[\text{/tmp/tmpc82totep},3\right]`


>>> Close[strm];
Expand All @@ -35,7 +35,7 @@ BinaryRead
>>> strm = OpenRead[%, BinaryFormat -> True]

=
:math:`\text{InputStream}\left[\text{/tmp/tmpr\_gu7\_2h},3\right]`
:math:`\text{InputStream}\left[\text{/tmp/tmpc82totep},3\right]`


>>> BinaryRead[strm, {"Character8", "Character8", "Character8"}]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ BinaryWrite
>>> strm = OpenWrite[BinaryFormat -> True]

=
:math:`\text{OutputStream}\left[\text{/tmp/tmpjt6628bg},3\right]`
:math:`\text{OutputStream}\left[\text{/tmp/tmpn52ow6sk},3\right]`


>>> BinaryWrite[strm, {39, 4, 122}]

=
:math:`\text{OutputStream}\left[\text{/tmp/tmpjt6628bg},3\right]`
:math:`\text{OutputStream}\left[\text{/tmp/tmpn52ow6sk},3\right]`


>>> Close[strm];
Expand All @@ -44,7 +44,7 @@ BinaryWrite
>>> strm = OpenRead[%, BinaryFormat -> True]

=
:math:`\text{InputStream}\left[\text{/tmp/tmpjt6628bg},3\right]`
:math:`\text{InputStream}\left[\text{/tmp/tmpn52ow6sk},3\right]`


>>> BinaryRead[strm]
Expand Down Expand Up @@ -74,19 +74,19 @@ Write a String
>>> strm = OpenWrite[BinaryFormat -> True]

=
:math:`\text{OutputStream}\left[\text{/tmp/tmpssqmr49c},3\right]`
:math:`\text{OutputStream}\left[\text{/tmp/tmp943kudqi},3\right]`


>>> BinaryWrite[strm, "abc123"]

=
:math:`\text{OutputStream}\left[\text{/tmp/tmpssqmr49c},3\right]`
:math:`\text{OutputStream}\left[\text{/tmp/tmp943kudqi},3\right]`


>>> pathname = Close[%]

=
:math:`\text{/tmp/tmpssqmr49c}`
:math:`\text{/tmp/tmp943kudqi}`



Expand All @@ -95,7 +95,7 @@ Read as Bytes
>>> strm = OpenRead[%, BinaryFormat -> True]

=
:math:`\text{InputStream}\left[\text{/tmp/tmpssqmr49c},3\right]`
:math:`\text{InputStream}\left[\text{/tmp/tmp943kudqi},3\right]`


>>> BinaryRead[strm, {"Character8", "Character8", "Character8", "Character8", "Character8", "Character8", "Character8"}]
Expand All @@ -107,7 +107,7 @@ Read as Bytes
>>> pathname = Close[strm]

=
:math:`\text{/tmp/tmpssqmr49c}`
:math:`\text{/tmp/tmp943kudqi}`



Expand All @@ -116,7 +116,7 @@ Read as Characters
>>> strm = OpenRead[%, BinaryFormat -> True]

=
:math:`\text{InputStream}\left[\text{/tmp/tmpssqmr49c},3\right]`
:math:`\text{InputStream}\left[\text{/tmp/tmp943kudqi},3\right]`


>>> BinaryRead[strm, {"Byte", "Byte", "Byte", "Byte", "Byte", "Byte", "Byte"}]
Expand All @@ -134,19 +134,19 @@ Write Type
>>> strm = OpenWrite[BinaryFormat -> True]

=
:math:`\text{OutputStream}\left[\text{/tmp/tmpxiuzr0jm},3\right]`
:math:`\text{OutputStream}\left[\text{/tmp/tmp29bgwyg3},3\right]`


>>> BinaryWrite[strm, 97, "Byte"]

=
:math:`\text{OutputStream}\left[\text{/tmp/tmpxiuzr0jm},3\right]`
:math:`\text{OutputStream}\left[\text{/tmp/tmp29bgwyg3},3\right]`


>>> BinaryWrite[strm, {97, 98, 99}, {"Byte", "Byte", "Byte"}]

=
:math:`\text{OutputStream}\left[\text{/tmp/tmpxiuzr0jm},3\right]`
:math:`\text{OutputStream}\left[\text{/tmp/tmp29bgwyg3},3\right]`


>>> DeleteFile[Close[%]];
Expand Down
Loading