Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mossr/julia-mono-listings
LaTeX listings style for Julia and Unicode support for the JuliaMono font
https://github.com/mossr/julia-mono-listings
Last synced: 27 days ago
JSON representation
LaTeX listings style for Julia and Unicode support for the JuliaMono font
- Host: GitHub
- URL: https://github.com/mossr/julia-mono-listings
- Owner: mossr
- License: other
- Created: 2020-10-11T10:25:20.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-08-28T03:13:15.000Z (2 months ago)
- Last Synced: 2024-08-28T04:28:07.735Z (2 months ago)
- Language: TeX
- Homepage:
- Size: 14.9 MB
- Stars: 52
- Watchers: 5
- Forks: 9
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-sciml - mossr/julia-mono-listings: LaTeX listings style for Julia and Unicode support for the JuliaMono font
README
# julia-mono-listings
A custom Julia language style for the LaTeX `listings` package, and Unicode support for the [JuliaMono](https://juliamono.netlify.app/) font in a `lstlisting` environment.
- JuliaMono: https://github.com/cormullion/juliamono
- Julia Unicode: https://docs.julialang.org/en/v1/manual/unicode-input
- Julia pygments: https://github.com/sisl/pygments-julia> Note, we use `lualatex` for compilation.
## Example
Typesetting the [*Thompson sampling algorithm*](https://github.com/mossr/BeautifulAlgorithms.jl/blob/master/src/thompson_sampling.jl) from [`BeautifulAlgorithms.jl`](https://github.com/mossr/BeautifulAlgorithms.jl).
- See template on [Overleaf](https://www.overleaf.com/read/qrpfvszrjjwf) (go to "Menu" ⟶ "Copy Project", must be logged in).
**The LaTeX document:**
```latex
\documentclass[11pt]{article}\usepackage{julia-mono-listings}
\lstdefinelanguage{JuliaLocal}{
language = Julia, % inherit Julia lang. to add keywords
morekeywords = [3]{thompson_sampling}, % define more functions
morekeywords = [2]{Beta, Distributions}, % define more types and modules
}\begin{document}
\begin{lstlisting}[language=JuliaLocal, style=julia]
using Distributionsfunction thompson_sampling(𝛂, 𝛃, apply; T=100)
for t in 1:T
𝛉 = rand.(Beta.(𝛂, 𝛃))
x = argmax(𝛉)
r = apply(x)
𝛂[x], 𝛃[x] = (𝛂[x] + r, 𝛃[x] + 1 - r)
end
return Beta.(𝛂, 𝛃)
end
\end{lstlisting}
\end{document}
```**Output PDF:**
# License
The font license is located [here](https://github.com/cormullion/juliamono/blob/master/LICENSE), and the license for this repo is located at [LICENSE.md](./LICENSE.md).