Skip to content

Commit

Permalink
MathBox server-side fragments, demo (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
sritchie authored Jun 9, 2023
1 parent e90bf21 commit b229fbd
Show file tree
Hide file tree
Showing 4 changed files with 1,368 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## [unreleased]

- #30:

- Adds `emmy.mathbox`, with functions for creating Reagent fragments that
configure the components from [MathBox.cljs](https://mathbox.mentat.org/)
for Clerk (no Portal yet!)

- `dev/emmy_viewers/mathbox.clj` shows off a basic demo

- #32:

- Adds `emmy.mathlive`, with functions for creating Reagent fragments that
Expand Down
31 changes: 31 additions & 0 deletions dev/emmy_viewers/mathbox.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
^{:nextjournal.clerk/visibility {:code :hide}}
(ns emmy-viewers.mathbox
#:nextjournal.clerk
{:toc true :no-cache true}
(:refer-clojure
:exclude [+ - * / zero? compare divide numerator denominator
infinite? abs ref partial =])
(:require [emmy.env :as e :refer :all]
[emmy.clerk :as ec]
[emmy.mathbox :as box]
[nextjournal.clerk :as clerk]))

;; ## Server-Side MathBox

(def ->tex (comp clerk/tex ->TeX simplify))

{::clerk/width :wide}

^{::clerk/visibility {:code :hide :result :hide}}
(ec/install!)

^{::clerk/width :wide}
(box/mathbox
{:container {:style {:height "400px" :width "100%"}}
:renderer {:background-color 0x000000}}
;; This makes us 2d.
(box/layer
(box/cartesian
{:range [[(- Math/PI) (- Math/PI 0.00001)] [-10 10]]
:scale [1 0.5]}
(box/grid {:width 2 :divideX 20 :divideY 10}))))
4 changes: 1 addition & 3 deletions dev/emmy_viewers/notebook.clj
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
^{:nextjournal.clerk/visibility {:code :hide}}
(ns emmy-viewers.notebook
#:nextjournal.clerk
{:toc true
:no-cache true}
#:nextjournal.clerk{:toc true :no-cache true}
(:refer-clojure
:exclude [+ - * / zero? compare divide numerator denominator
infinite? abs ref partial =])
Expand Down
Loading

0 comments on commit b229fbd

Please sign in to comment.