Mathematical symbols in Julia

I’m not sure if this is the right place for this, so I apologize if it’s misplaced.
I was wondering if there was something in Julia equivalent to LaTeX. I study mathematics and so could use something like LaTeX, but if there was a Julia equivalent I’d just as soon use that. Thank you.

What do you mean by equivalent?

If it’s just for printing/formatting, then I’m pretty sure there are multiple ways to do that. Of course there’s little point for a complete latex replacement (i.e. to generate .pdf from .tex) so the use is mostly about embedding latex expressions in other places. I believe it’s supported in the doc, markdown, pyplot (and probably other plotting packages), ijulia (through jupyter) and probably more.

Now if you are talking about writing code then no. I don’t think so. Not in any way that can replace writing normal code. Math notation is way too ambiguious and overloaded / context dependent to be useful for programing. They aren’t even consistent among themselves sometimes… I won’t be surprised if there’s some domain specific packages that allow you to write a limited subset of latex but don’t expect to use latex to write all your code.

3 Likes

You can use unicode symbols though, which might be a good in-between option. I use Unicode (probably far more than I should) in the code I write for physics-based applications.

Oh, yeah, if you just want to use the symbol, latex and tab should generally work already…

I meant for printing/formatting, for completing homework, producing papers, etc. Not for writing applications. Sorry I didn’t include that clarification from the start.
How would I go about this? I am quite new to all of this.
Thanks.

Well, what do you actually want to do?

For example, if you want to write .tex and generate .pdf, then, as I said, julia isn’t the right tool for it. (That’s equivalent to reimplementing latex in julia and I’m not aware of anyone doing it and I don’t see it as intrinsically better if backward compatibility is to be maintained…)
If you want to use julia to do something else and want to embed latex generated equation in it, it’s probably doable but you need to specify that “something else”.
If you want to use juliia to generate latex that’s just normal string processing and if you need help on that you should specify what you are generating.

Or maybe it’s something else?


In another word, you only said you want to use julia and latex, that’s the method but not really the goal… What problem are you trying to solve.

1 Like

There have been a number of LaTeX rewrites (LuaTeX, XeTeX), but there’s no obvious advantage to be gained by reproducing that sort of typesetting system in Julia, and much to be lost (package compatibility, conformity to academic journals’ submission standards, time sunk reimplementing stable functionality). The closest alternatives are Markdown and MS Word, but if you’re writing lots of equations, LaTeX still can’t be beat

Markdown with embedded LaTeX equations is a pretty good option for this.
You can try it out e.g. in the Jupyter notebook or by installing the markdown-preview-plus package in the Atom editor.

1 Like

I think I don’t know enough to know what I need to ask. Thank you for your answers. I’m just trying to write up mathematical papers and homework in a nice presentable format. It sounds like LaTeX is the best bet for this. I’m not trying to do some tricky reimplementation or wheel reinvention. I guess I’ll just learn to use LaTeX. As this ended up not so Julia related I do apologize. Thanks again.

1 Like

If you use Julia and want to include code in your Latex papers, one excellent way to do so is with the minted package. It supports Julia out of the box and produces beautifully typeset code listings.

This is what I did in college, I have terrible handwriting and typesetting all my homework with LaTeX was a definite improvement for me and the graders. I still use it every now and then, but if your writing is mostly text with a few equations sprinkled around, most Markdown parsers support a subset of LaTeX these days. It is not as flexible a system, but for notes and documentation you get a lot of functionality for not much work.

gitlab markdown

Pandoc is a terrific tool, it can convert between many document formats, including from Markdown with equations in $ $ to pdf or HTML.

1 Like

You might be interested in Weave.jl and Literate Programming in general.

3 Likes

It seems that the OP thinks Julia can be used as a typesetting tool like Word or Latex. For someone at this novice skill level, suggestions of using Jupyter notebooks, Weave.jl, or markdown are not really helpful.

Julia is a general purpose/scientific programming language. It’s not really for typesetting documents from start to finish. I’d suggest using Latex, markdown, or Word for that. You can use Julia to run some code to produce plots and run analysis.

3 Likes