This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-01-07
Channels
- # announcements (2)
- # beginners (30)
- # calva (7)
- # cherry (15)
- # clerk (21)
- # clojure (1)
- # clojure-losangeles (12)
- # clojure-norway (1)
- # clojure-spec (3)
- # clojurescript (31)
- # conjure (2)
- # cursive (44)
- # datomic (13)
- # emacs (13)
- # honeysql (15)
- # hyperfiddle (7)
- # malli (2)
- # off-topic (17)
- # overtone (6)
- # reitit (7)
- # ring (58)
- # shadow-cljs (12)
- # squint (14)
- # tools-deps (14)
- # web-security (1)
- # xtdb (29)
Good afternoon!
Is there a way to display TeX math with Clerk in the object browser, but not force newlines? When I’m using clerk/tex
for values in a map, I can’t get rid of the newlines. (Example image below, https://github.clerk.garden/teodorlu/lab/commit/5b54a0fa3e85c0ab71d2fa81d13c8acb1dad6946/src/repro/tex_newlines/).
It appears the markdown viewer (`nextjournal.clerk/md`) is able to display math inline (for example Assume $x = 3$, then …
. But I want the rest of the object browser too, not flat Markdown paragraphs!
oh sorry I confused that with your GitHub issue, pretty sure this is a problem on main as well, no need to try
Not in front of a computer right now, will check the Github issue tonight or tomorrow on latest main!
can you try latest main as well? Will fix it next week if it’s still a problem there.I’m seeing the same behavior on io.github.nextjournal/clerk {:git/sha "65988e062c8e9dc5e48111d05fec5350cf80e4c9"}
(latest as of today).
katex display mode can actually be controlled via render options like this:
(ns scratch.debug
(:require [nextjournal.clerk :as clerk]
[nextjournal.clerk.viewer :as viewer]))
^{::clerk/visibility {:result :hide}}
(clerk/add-viewers! [(update viewer/katex-viewer
:transform-fn comp (fn [wv] (-> wv (assoc-in [:nextjournal/render-opts :inline?] true))))])
{:a (clerk/tex "\\phi") :b (clerk/tex "\\psi")}
oooh, awesome. Looks like I just want to rewrite my viewer to use this directly.
In the example, I used clerk/tex
directly. In my non-simplified code, I have my own viewer:
(def with-unit-viewer
{:name `with-unit-viewer
:pred with-unit?
:transform-fn (clerk/update-val (fn [unit] (clerk/tex (with-unit->tex unit))))})
(clerk/add-viewers! [with-unit-viewer])
I think I can probably just configure my viewer correctly.
Thank you!Agreed that it would be nice to render maps with clerk/tex
values in them nicely by default.
we might find something, but I think the non-inline default is good for simple latex results
@U9EQP1K0X thanks again for the inline viewer example. My maps look way better now! Viewing doubles still has a way to go, but that’s entirely my fault for shoving a double .toString into LaTeX.
the thing with inline settings is that katex renders stuff differently when expressions are meant for https://katex.org/docs/options or not, this affects how sub/super scripts and symbols in general like \sum or \int are drawn, and not only alignment