# Changing font size when using julia-mono-listings

**URL:** https://discourse.julialang.org/t/changing-font-size-when-using-julia-mono-listings/119861
**Category:** General Usage
**Tags:** fonts
**Created:** [September 25, 2024, 12:39pm UTC](https://discourse.julialang.org/t/changing-font-size-when-using-julia-mono-listings/119861 "2024-09-25T12:39:41Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![pao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pao/32/34395_2.png) [@pao](https://discourse.julialang.org/u/pao)
#### Post date: [September 25, 2024, 12:39pm UTC](https://discourse.julialang.org/t/changing-font-size-when-using-julia-mono-listings/119861/1 "2024-09-25T12:39:41Z")

</div>

Hi, folks

anybody knows how to change the font size when using julia-mono-listings to write Julia codes in articles and books?

The default looks too big for two-columns typesetting. The standard LaTeX commands (\small, \scriptsize, etc.) do not work.  
If you have a working solution, please show here a small complete script.

Thanks!

---

<div class="post-metadata">

### Author: ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)
#### Post date: [September 26, 2024, 12:49pm UTC](https://discourse.julialang.org/t/changing-font-size-when-using-julia-mono-listings/119861/2 "2024-09-26T12:49:37Z")

</div>

I assume you’re talking about [GitHub - mossr/julia-mono-listings: LaTeX listings style for Julia and Unicode support for the JuliaMono font](https://github.com/mossr/julia-mono-listings) …

One way you can get smaller text is to use `tiny` rather than `small`. So you could edit the file `julia-mono-listings.sty` and copy the `\lstdefinestyle{julia} ... ` definition, then change the basic style to say `\tiny`:

```latex
\lstdefinestyle{juliatiny}{
    backgroundcolor = \color[HTML]{F2F2F2},
    basicstyle = \JuliaMonoRegular\tiny\color[HTML]{19177C},
   ...

```

Now you have a new style called `juliatiny`, which you can use alongside the existing `julia` style:

 ![Screenshot 2024-09-26 at 13.41.33](https://global.discourse-cdn.com/julialang/original/3X/5/a/5a2e0479a00a07f0de6cb03a90dc93faf91618d8.png)

\LaTeX source:

> ****
>
> ```latex
> \begin{document}
> 
> This is some code.
> 
> \begin{lstlisting}[language=JuliaLocal, style=julia]
> using Luxor
> @svg begin
> sethue("red")
> randpoint = Point(rand(-200:200), rand(-200:200))
> circle(randpoint, 2, :fill)
> sethue("black")
> foreach(f -> arrow(f, between(f, randpoint, .1), 
> arrowheadlength=6),
> first.(collect(Table(fill(20, 15), fill(20, 15)))))
> end
> \end{lstlisting}
> 
> That code was small.
> 
> \begin{lstlisting}[language=JuliaLocal, style=juliatiny]
> using Luxor
> @svg begin
> sethue("red")
> randpoint = Point(rand(-200:200), rand(-200:200))
> circle(randpoint, 2, :fill)
> sethue("black")
> foreach(f -> arrow(f, between(f, randpoint, .1), 
> arrowheadlength=6),
> first.(collect(Table(fill(20, 15), fill(20, 15)))))
> end
> \end{lstlisting}
> 
> That was tiny.
> 
> \end{document}
> 
> ```

I couldn’t find any sizes other than `small` and `tiny` anywhere - perhaps that’s all you’re allowed to do?

(Disclaimer - I know very little about \LaTeX, and don’t really like what little I know… 🙂 )

---

<div class="post-metadata">

### Author: ![Robert\_Moss](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/robert_moss/32/48004_2.png) [@Robert\_Moss](https://discourse.julialang.org/u/Robert_Moss)
#### Post date: [January 5, 2025, 9:08am UTC](https://discourse.julialang.org/t/changing-font-size-when-using-julia-mono-listings/119861/3 "2025-01-05T09:08:15Z")

</div>

To fix the white lines showing up with `\tiny`, you can add the following line to the `lstdefinestyle`:

```julia
\lstdefinestyle{julia}{
    % other settings
    lineskip=2pt
}

```
