Suggestions for styling Julia/JuMP code in a Latex?


#1

Are there any suggestions around how to best style Julia/JuMP code in Latex?


#2

I’ve had good success with minted. It uses pygments, which does support Julia code.


#3

Yeah, minted is pretty great.


#4

You might also look at using the @variables and @constraints macros to express a model very compactly, if appropriate.


#5

Minted worked out nicely. Thanks for the tip.


#6

I had some issues with unicode symbols, to the point where I usually change the code to not use them (when putting in documents/slides). Do you have tips / a solution for that?


#7

Note for those using LyX: in LyX 2.3 you can choose to use minted for listings by going to Document > Settings … > Listings and setting the ‘Syntax Highlighting Package’ to ‘Minted’. Now Insert > Program Listing will produce a minted environment. You can right click on it and choose ‘Settings…’, then go to the ‘Advanced’ tab and use ‘language=julia’ (Julia is not yet listed in the dropdown box under ‘Main Settings’).