especially now that github markdown supports latex. If you do ?ModuleName and there are no docstrings, you get the readme. If the repl .md could render latex that would be cool
GitHub markdown supports what now? Thatβs very exciting.
Iβm not sure what it would mean for the repl to render LaTeX, itβs not something that I would expect to be possible in most terminal emulators. Maybe a layer that translates \mu
into ΞΌ
, (i.e. a tex2utf8 engine) but that seems like youβd be crossing the river for water.
Or simplify it
using Latexify
render(latexify("4+5/(3-sqrt(36))"), MIME("juliavscode/html"))
ERROR: MethodError: no method matching display(::MIME{Symbol("juliavscode/html")}, ::String)
OS is Windows and MathJax is installed ?
Test MathJax:
Point with mouse at the output and click right mouse-button, then the MathJax contextmenu should
be displayed.
That is not the repl. It appears to be some IDE.
I made something that does this for LaTeX bits of docstrings.
julia> using Markdown
julia> using MarkdownLaTeXRender
julia> md"Hey ``\sum \mathbb{x}^2-\frac{1}{2}\sigma``"
Hey β π©Β² β ΒΉ/βΟ
Looks like VS code
Thatβs also an (the same?) IDE. Still not the repl.
FWIW, one tool I know that does have the ability to show mathematical formulas in the terminal is maxima:
(%i1) integrate(f(x) / x, x, -1, 1);
1
/
[ f(x)
(%o1) I ---- dx
] x
/
- 1
I have absolutely no idea how they do this, and whether it would be doable to get inspiration from the maxima code to have something similar in Julia.
A nice solution to the original question is LibTeXPrintf.jl
by @suavesito:
julia> texprintln("a = \\sum_i \\frac{1}{i}")
β² 1
a = β³ β
β± i
It also accepts LaTeXString
s.
Cool. This works pretty well with Handcalcs.jl. I want to integrate a terminal mode with this.
julia> b = 5
5
julia> h = 15
15
julia> texprintln(
@handcalcs begin
Ix = b * (h)^3/12
Iy = h * (b)^3/12
end
)
b β
hΒ³ 5 β
15Β³
Ix = βββββ = ββββββ = 1406.25
12 12
$ h β
bΒ³ 15 β
5Β³ $
[10pt]Iy = βββββ = ββββββ = 156.25
12 12
Maybe there is a way to parse out the $
and the [10pt]
. That would be nice.