Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
if: startsWith(matrix.os,'ubuntu')
run: |
sudo apt-get -y update
sudo apt-get -y install latexmk ghostscript texlive-{luatex,latex-extra}
sudo apt-get -y install latexmk texlive-{luatex,latex-extra}
sudo fc-cache -vr
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
Expand Down
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ version = "0.16.9"

[deps]
Format = "1fa38f19-a742-5d3f-a2b9-30dd87b9d5f8"
Ghostscript_jll = "61579ee1-b43e-5ca0-a5da-69d92c66a64b"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
Expand All @@ -28,6 +29,7 @@ TectonicExt = "tectonic_jll"
[compat]
DataFrames = "1"
Format = "1.3"
Ghostscript_jll = "9"
LaTeXStrings = "0.3, 1"
MacroTools = "0.4 - 0.5"
OrderedCollections = "1"
Expand Down
4 changes: 3 additions & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,9 @@ Alternatively, `render(str, mime)` can also be used to generate and display DVI,
latexify(:(x/y)) |> s -> render(s, MIME("image/png"))
```

PNG output relies on [ghostscript](https://www.ghostscript.com) or alternatively on [dvipng](http://www.nongnu.org/dvipng): if `render` is called with the keyword `convert = :gs`, ghostcript will be used to convert the `pdf` output to `png` format.
PNG output defaults to using [ghostscript](https://www.ghostscript.com), which is available by default thanks to `Ghostscript_jll`.

[dvipng](http://www.nongnu.org/dvipng) can also be used by passing the keyword `convert = :dvipng` to `render`. However, this requires a working installation of dvipng.

SVG output relies on [dvisvgm](https://dvisvgm.de) or alternatively on [pdf2svg](https://github.com/dawbarton/pdf2svg).

Expand Down
1 change: 1 addition & 0 deletions src/Latexify.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ using MacroTools: postwalk
import MacroTools
using Format
import Base.showerror
import Ghostscript_jll

export latexify, md, copy_to_clipboard, auto_display, set_default, get_default,
reset_default, @latexrecipe, render, @latexify, @latexrun, @latexdefine
Expand Down
2 changes: 1 addition & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function render(s::LaTeXString, mime::MIME"image/png";
# prefer tex -> pdf -> png instead
if convert === :gs
aux_mime = MIME("application/pdf")
ghostscript_command = get(ENV, "GHOSTSCRIPT", Sys.iswindows() ? "gswin64c" : "gs")
ghostscript_command = Ghostscript_jll.gs()
cmd = `$ghostscript_command $ghostscript_flags -o $name.$ext $aux_name.pdf`
elseif convert === :dvipng
aux_mime = MIME("application/x-dvi")
Expand Down
4 changes: 4 additions & 0 deletions test/utils_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,7 @@ using tectonic_jll
pdf_file = render(L"x^2"; open=false) # should now not throw
@test isfile(pdf_file)
@test_throws Latexify.LatexifyRenderError render(L"x^2^3"; open=false)

# Check that Ghostscript render works
png_file = render(L"x^2", MIME("image/png"); open=false)
@test isfile(png_file)
Loading