# Emit LaTeX document from Julia

**URL:** <https://discourse.julialang.org/t/emit-latex-document-from-julia/136273>\
**Category:** General Usage\
**Tags:** question, latex\
**Created:** [March 19, 2026, 10:11am UTC](https://discourse.julialang.org/t/emit-latex-document-from-julia/136273 "2026-03-19T10:11:12Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 19, 2026, 10:11am UTC](https://discourse.julialang.org/t/emit-latex-document-from-julia/136273/1 "2026-03-19T10:11:12Z")

</div>

I am generating a lot of plots and tables (in Julia) for a research project, to be shared with coauthors. It used to be that I would dump the tables in a directory and tried to be good with file naming, but it got beyond manageable. The purpose is now to generate a single PDF file for discussion of results, and then select what goes into the paper.

Now, when I dump the plots and tables, I would prefer to simultaneously generate a LaTeX _document_, with section headings, table/figure captions, and inclusion of the relevant figure. Eg the API I would imagine is something like this:

```julia
ltx = start_LaTeX_document("some_path.tex"; packages = ["booktabs"])
    # ^ adds preamble, already includes graphicx
add_section(ltx, "Baseline plots")
add_figure(ltx, "What a nice figure", "some_figure_path.pdf")
add_subsection(ltx, "The robustness checks that will make the editor complain"
    * "that the paper is now too long even though he asked for them")
add_table(ltx, "Some table", "some_table_dump.tex")
end_LaTeX_document(ltx)

```

I can just mock this up quickly but wanted to ask if there is a package that does this already.

---

<div class="post-metadata">

**Author:** ![sablonl](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sablonl/32/217805_2.png) [@sablonl](https://discourse.julialang.org/u/sablonl)\
**Post date:** [March 19, 2026, 10:26am UTC](https://discourse.julialang.org/t/emit-latex-document-from-julia/136273/2 "2026-03-19T10:26:21Z")

</div>

Not sure if there is package for that but have you considered using Quarto (or perhaps even simpler jupyter notebooks)?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [March 19, 2026, 11:07am UTC](https://discourse.julialang.org/t/emit-latex-document-from-julia/136273/3 "2026-03-19T11:07:27Z")

</div>

If you only need very basic structure and formatting, it might be easier to generate a simpler format like Markdown, and then use Pandoc to convert it to LaTeX.

---

<div class="post-metadata">

**Author:** ![pkmishra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pkmishra/32/14238_2.png) [@pkmishra](https://discourse.julialang.org/u/pkmishra)\
**Post date:** [March 19, 2026, 11:10am UTC](https://discourse.julialang.org/t/emit-latex-document-from-julia/136273/4 "2026-03-19T11:10:56Z")

</div>

Quarto + Julia works great! Every time you change your Julia code in the project, it reruns it, updates the results and plots, generates LaTeX source, and compiles an updated PDF.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 19, 2026, 11:30am UTC](https://discourse.julialang.org/t/emit-latex-document-from-julia/136273/5 "2026-03-19T11:30:23Z")

</div>

Quarto looks interesting. How does it generate LaTeX source? I don’t see it in the [output formats](https://quarto.org/docs/output-formats/all-formats.html).

Also, can I pick filenames for the plots somehow? For inclusion into the paper later.

---

<div class="post-metadata">

**Author:** ![MDSW](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@MDSW](https://discourse.julialang.org/u/MDSW)\
**Post date:** [March 19, 2026, 12:18pm UTC](https://discourse.julialang.org/t/emit-latex-document-from-julia/136273/6 "2026-03-19T12:18:59Z")

</div>

I used Quarto for exactly this scenario. Generate all of your plots, then generate a quarto document that references them, along with whatever other text, tables, etc., that you need. Instead of going to latex, I used Quarto’s option (`embed_resources`) to generate a single, all-inclusive HTML file that users could then open and navigate in their browser.

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [March 19, 2026, 12:21pm UTC](https://discourse.julialang.org/t/emit-latex-document-from-julia/136273/7 "2026-03-19T12:21:43Z")

</div>

Last I looked into Quarto it outsourced those things to Pandoc, so if you want completeness you should probably look in their documentation. Or skip Quarto and directly use Pandoc.

---

<div class="post-metadata">

**Author:** ![ffevotte](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ffevotte/32/6587_2.png) [@ffevotte](https://discourse.julialang.org/u/ffevotte)\
**Post date:** [March 19, 2026, 12:44pm UTC](https://discourse.julialang.org/t/emit-latex-document-from-julia/136273/8 "2026-03-19T12:44:59Z")

</div>

In situations similar to yours (but not exactly the same, either), I’ve found Literate.jl (and its markdown output) + `pandoc` to be both useful and very easy to learn/use.

I like the “API-free” approach where you write Julia code and surround it with Markdown-formatted comments which will appear in the document. Which is not exactly what you had in mind, but might still fit your use case.

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [March 19, 2026, 1:15pm UTC](https://discourse.julialang.org/t/emit-latex-document-from-julia/136273/9 "2026-03-19T13:15:41Z")

</div>

I have done this in the past! My suggestion is to have a .tex template with a place holder like:

```julia-auto
<-- TABLE 1 -->

```

Then, you generate the table in Julia (you can use PrettyTables.jl for LaTeX) and put the result in a string. Afterward, you copy the template and replace the placeholders with the string. I have done this several times for reports of equipment tests, and it works pretty well.

EDIT: I mean, you can generate the table, the result, etc., and replace those placeholders.

---

<div class="post-metadata">

**Author:** ![J.B](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/j.b/32/219271_2.png) [@J.B](https://discourse.julialang.org/u/J.B)\
**Post date:** [March 19, 2026, 4:15pm UTC](https://discourse.julialang.org/t/emit-latex-document-from-julia/136273/10 "2026-03-19T16:15:08Z")

</div>

Since you are using Emacs, maybe org mode would be an option? If your workflow can be divided into some chunks that fit well into babel blocks, it might be worth a try.

 ![Screenshot 2026-03-19 at 17.02.24](https://global.discourse-cdn.com/julialang/original/3X/b/c/bc3f8de38a29ee45dc31ef6826eaacf8158449ec.jpeg)

---

<div class="post-metadata">

**Author:** ![technocrat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/technocrat/32/220947_2.png) [@technocrat](https://discourse.julialang.org/u/technocrat)\
**Post date:** [March 19, 2026, 5:38pm UTC](https://discourse.julialang.org/t/emit-latex-document-from-julia/136273/11 "2026-03-19T17:38:34Z")

</div>

If you are not too deeply wed to LaTeX, you should consider [the Typst app](https://typst.app/) and the related [Typstry.jl package.](https://discourse.julialang.org/t/typstry-jl-the-julia-to-typst-interface/114381). I recently did a 200-page book heavy in figures and found it worked well. The markup is Commonmark-like.

```julia-auto
= Chapter or section
== second level header
#note(side: "inner")[margin note.]
#wideblock(side: "inner", figure(image("figures/fig35.svg", width:120%), caption: [Plot with Optional Elements]))
The colors are set using a combination of techniques called a ternary operator and a comprehension. The way to read this line:#index[ternary operators]

```

---

<div class="post-metadata">

**Author:** ![Roger\_Powell](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roger_powell/32/21586_2.png) [@Roger\_Powell](https://discourse.julialang.org/u/Roger_Powell)\
**Post date:** [April 2, 2026, 10:24am UTC](https://discourse.julialang.org/t/emit-latex-document-from-julia/136273/12 "2026-04-02T10:24:19Z")

</div>

> [@Tamas\_Papp](#):
>
> ```julia-auto
> add_subsection(ltx, "The robustness checks that will make the editor complain"
> * "that the paper is now too long even though he asked for them")
> 
> ```

😂

---

<div class="post-metadata">

**Author:** ![Al3cLee](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/al3clee/32/218582_2.png) [@Al3cLee](https://discourse.julialang.org/u/Al3cLee)\
**Post date:** [April 4, 2026, 1:53pm UTC](https://discourse.julialang.org/t/emit-latex-document-from-julia/136273/13 "2026-04-04T13:53:31Z")

</div>

Second this! Typst also makes PDF compilation a lot faster 🙂
