# Suggestions for styling Julia/JuMP code in a Latex?

**URL:** https://discourse.julialang.org/t/suggestions-for-styling-julia-jump-code-in-a-latex/6269
**Category:** Optimization (Mathematical)
**Created:** [October 5, 2017, 7:23pm UTC](https://discourse.julialang.org/t/suggestions-for-styling-julia-jump-code-in-a-latex/6269 "2017-10-05T19:23:41Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![ccoffrin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ccoffrin/32/400_2.png) [@ccoffrin](https://discourse.julialang.org/u/ccoffrin)
#### Post date: [October 5, 2017, 7:23pm UTC](https://discourse.julialang.org/t/suggestions-for-styling-julia-jump-code-in-a-latex/6269/1 "2017-10-05T19:23:41Z")

</div>

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

---

<div class="post-metadata">

### Author: ![crbinz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/crbinz/32/1919_2.png) [@crbinz](https://discourse.julialang.org/u/crbinz)
#### Post date: [October 5, 2017, 7:36pm UTC](https://discourse.julialang.org/t/suggestions-for-styling-julia-jump-code-in-a-latex/6269/2 "2017-10-05T19:36:06Z")

</div>

I’ve had good success with [minted](https://github.com/gpoore/minted). It uses pygments, which [does support Julia code](http://pygments.org/docs/lexers/).

---

<div class="post-metadata">

### Author: ![joehuchette](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joehuchette/32/32_2.png) [@joehuchette](https://discourse.julialang.org/u/joehuchette)
#### Post date: [October 5, 2017, 8:11pm UTC](https://discourse.julialang.org/t/suggestions-for-styling-julia-jump-code-in-a-latex/6269/3 "2017-10-05T20:11:31Z")

</div>

Yeah, minted is pretty great.

---

<div class="post-metadata">

### Author: ![miles.lubin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miles.lubin/32/279_2.png) [@miles.lubin](https://discourse.julialang.org/u/miles.lubin)
#### Post date: [October 5, 2017, 11:46pm UTC](https://discourse.julialang.org/t/suggestions-for-styling-julia-jump-code-in-a-latex/6269/4 "2017-10-05T23:46:03Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ccoffrin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ccoffrin/32/400_2.png) [@ccoffrin](https://discourse.julialang.org/u/ccoffrin)
#### Post date: [October 8, 2017, 4:07pm UTC](https://discourse.julialang.org/t/suggestions-for-styling-julia-jump-code-in-a-latex/6269/5 "2017-10-08T16:07:09Z")

</div>

Minted worked out nicely. Thanks for the tip.

---

<div class="post-metadata">

### Author: ![tpoisot](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tpoisot/32/19812_2.png) [@tpoisot](https://discourse.julialang.org/u/tpoisot)
#### Post date: [October 8, 2017, 5:03pm UTC](https://discourse.julialang.org/t/suggestions-for-styling-julia-jump-code-in-a-latex/6269/6 "2017-10-08T17:03:15Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)
#### Post date: [September 13, 2018, 7:30pm UTC](https://discourse.julialang.org/t/suggestions-for-styling-julia-jump-code-in-a-latex/6269/7 "2018-09-13T19:30:42Z")

</div>

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’).
