sashaafm
Hi guys! Has anyone found (or has a way) to insert good Elixir code listing and snippets in LaTeX? Something with automatic color highlights. I’m using the listings package and while it’s got support for a ton of languages (including Erlang) it does not have for Elixir ![]()
I guess I could always insert them as images although I don’t find that to be very correct for a formal document.
Trending in Questions
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
Anyone here using Honeybadger?
My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of
Bandit.HTTPError...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #elixirconf-us
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
Qqwy
I do not believe there exists a library for LaTeX that does Elixir-highlighting right now. However, as Elixir’s syntax is actually quite regular (i.e. there are not a lot of edge-cases), creating such a library should not be extremely difficult (but, you know, still difficult). There do exist syntax highlighting packages for Sublime, Atom, Emacs and the likes, so maybe some of their logic could be ported to a LaTeX library.
sashaafm
Yeah I guessed there wouldn’t be a package for it. Although I’ve been experimenting and I think the Ruby highlight should be okayish!
NobbZ
If you do not fear
\write18and have a recent version ofpygmentsinstalled, you can usemintedpackage.vidalraphael
I’m actually writing a paper on concurrency and I’m using tons of Elixir code.
I’m using the
listingspackage and created a definition for the Elixir lang.Some things like atoms and module attributes don’t work quite like I would prefer, but it is better than creating images and pasting then all the time
Here’s the definition:
And here’s the rendered result:
m1dnight
I made some minor changes to this, and ended up with highlighted keywords. The only downside is that a keyword needs to be followed by a space to make the parser happy.
I have put an entire minimal example online here: Elixir Listings Latex · GitHub
The rendered output looks as follows:
OvermindDL1
You could always write a latex macro to call out to @tmbb’s syntax highlighter or so too, I think you could plug in a new backend to generate latex out pretty easily?
tmbb
Sure, and that would allow you to be much more precise in complex bits of syntax, such as sigils and string interpolation. It woukd require packaging Makeup’s highlighter into an escript that highlights the input given by stdin. That’s a little beyond my elixir skills right now (I don’t use Elixir for scripting), but it can be done.
Sure. For someone who knows tex and latex well it can be done in an afternoon. The token format returned by the makeup lexers is stable (although not documented outside the source code, because I can’t think of a way to document them better) and is considered part of the public API, so writing a LaTeX formatter would be easy (again, assuming you’re a TeX pro, which i am not).
Your best bet, if you can read and write Python, is to translate the formatter from Pygments xD (most of Makeup is a blatant rippoff of Pygments anyway)
m1dnight
If you really want proper highlighting, there is always the minted[1] package, which works great. However, I had a hard constraint on lstlistings, so I could not use it.
I think that if we were to improve the highlighting, we should improve no pygments, the backend that is used by minted in latex.
[1] Code Highlighting with minted - Overleaf, Online LaTeX Editor
tmbb
Indeed, but Makeup is a much better highlighter for elixir. You can replicate Makeup’s pexer in Pygments, but it’s hard because of Pygment’s “weird” architecture.
s417-lama
There is another option to do it: a vim plugin to generate listings with colorscheme of vim. It does not depend on syntax highlighting of listings and we can utilize syntax highlighting in vim for LaTeX:) The output looks quite beautiful.
https://github.com/s417-lama/carbonpaper.vim