Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Moelf authored Jun 24, 2024
2 parents ceb51c6 + 2fed095 commit e3e046c
Show file tree
Hide file tree
Showing 35 changed files with 2,503 additions and 2,106 deletions.
76 changes: 53 additions & 23 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

name: CI
on:
pull_request:
Expand All @@ -8,45 +7,76 @@ on:
branches:
- master
tags: '*'
# needed to allow julia-actions/cache to delete old caches that it has created
permissions:
actions: write
contents: read
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
name: Tests, Julia ${{ matrix.version }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1' # Leave this line unchanged. '1' will automatically expand to the latest stable 1.x release of Julia.
- 'nightly'
- '1'
os:
- ubuntu-latest
- windows
- macos
arch:
- x64
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
# Cancel ongoing CI test runs if pushing to branch again before the previous tests
# have finished
- name: Cancel ongoing test runs for previous commits
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

# Do tests
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- name: Install latex
run: sudo apt-get update && sudo apt-get install -y texlive-full texlive-luatex latexmk
- name: Install master branch of Makie et al
run: julia --project=@. -e 'using Pkg; pkg"add Makie CairoMakie MakieCore"'
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: actions/upload-artifact@v3
env:
DISPLAY: ':0'
with:
prefix: xvfb-run -s '-screen 0 1024x768x24'
- uses: actions/upload-artifact@v4
if: always()
with:
name: test_images
path: test/test_images/
path: test_images/
docs:
name: Build and deploy documentation
runs-on: ubuntu-latest
steps:
- name: Install binary dependencies
run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev
- uses: actions/checkout@v4
- name: Download all workflow run artifacts
uses: actions/download-artifact@v4
- uses: julia-actions/setup-julia@latest
with:
version: '1'
- uses: julia-actions/cache@v2
- name: Install documentation dependencies
run: |
xvfb-run -s '-screen 0 1024x768x24' julia --project=docs -e '
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
# Pkg.add([PackageSpec(name = "DocumenterVitepress", rev = "master"), PackageSpec(name = "Makie", rev = "master"), PackageSpec(name = "MakieCore", rev = "master"), PackageSpec(name = "CairoMakie", rev = "master")])
Pkg.instantiate()'
env:
DISPLAY: ':0'
- name: Build and deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If authenticating with GitHub Actions token
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # If authenticating with SSH deploy key
DISPLAY: ':0'
run: xvfb-run -s '-screen 0 1024x768x24' julia --project=docs/ docs/make.jl deploy
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
/dev/
/docs/build/
/docs/site/

/docs/Manifest.toml
test/test_images
33 changes: 24 additions & 9 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,34 +1,49 @@
name = "MakieTeX"
uuid = "6d554a22-29e7-47bd-aee5-0c5f06619414"
authors = ["Anshul Singhvi"]
version = "0.3"
authors = ["Anshul Singhvi <[email protected]>, and contributors"]
version = "0.4.1"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Cairo = "159f3aea-2a34-519c-b102-8c37f9878175"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
Ghostscript_jll = "61579ee1-b43e-5ca0-a5da-69d92c66a64b"
Glib_jll = "7746bdde-850d-59dc-9ae8-88ece973131d"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
Perl_jll = "83958c19-0796-5285-893e-a1267f8ec499"
Poppler_jll = "9c32591e-4766-534b-9725-b71a8799265b"
Rsvg = "c4c386cf-5103-5370-be45-f3a111cca3b8"
Typstry = "f0ed7684-a786-439e-b1e3-3b82803b501e"
tectonic_jll = "d7dd28d6-a5e6-559c-9131-7eb760cdacc5"

[weakdeps]
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"

[extensions]
MakieTeXCairoMakieExt = "CairoMakie"

[compat]
Cairo = "1.0.5"
CairoMakie = "0.10"
CairoMakie = "0.12.2"
Colors = "0.9, 0.10, 0.11, 0.12"
DocStringExtensions = "0.8, 0.9"
Ghostscript_jll = "9"
Glib_jll = "2"
LaTeXStrings = "1"
Makie = "0.18, 0.19"
Poppler_jll = "21.9"
julia = "1"
Makie = "0.21.2"
Poppler_jll = "21.9, 22, 23"
Rsvg = "1"
julia = "1.9"
Typstry = "0.2"
tectonic_jll = "0"

[extras]
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
WGLMakie = "276b4fcb-3e11-5398-bf8b-a0c2d153d008"

[targets]
test = ["Test", "Downloads"]
test = ["Test", "Downloads", "CairoMakie", "GLMakie", "WGLMakie"]
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
# <img src="https://user-images.githubusercontent.com/32143268/165514916-4337e55a-18ec-4831-ab0f-11ebcb679600.svg" alt="MakieTeX.jl" height="50" align = "top">

[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliaplots.github.io/MakieTeX.jl/stable/)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliaplots.github.io/MakieTeX.jl/dev/)
[![Build Status](https://github.com/JuliaPlots/MakieTeX.jl/actions/workflows/CI.yml/badge.svg?branch=master)](https://github.com/JuliaPlots/MakieTeX.jl/actions/workflows/CI.yml?query=branch%3Amaster)

## <a href = "https://www.latex-project.org/"><img src="https://upload.wikimedia.org/wikipedia/commons/9/92/LaTeX_logo.svg" alt="LaTeX" height="30" align = "top"></a> integration for <a href = "https://www.github.com/MakieOrg/Makie.jl"><img src="https://raw.githubusercontent.com/MakieOrg/Makie.jl/master/assets/logo.png" alt="Makie.jl" height="30" align = "top"></a>

<img src="https://user-images.githubusercontent.com/32143268/169671023-4d4c8cf7-eb3d-4ee1-8634-8b73fa38d31c.svg" height=400></img>


MakieTeX allows you to draw and visualize arbitrary TeX documents in Makie! You can insert anything from a single line of math to a large and complex TikZ diagram.
MakieTeX allows you to draw and visualize arbitrary vector documents (TEX, Typst, PDF, SVG) in Makie! You can insert anything from a single line of math to a large and complex TikZ diagram.

It works by compiling a stand-alone <img src="https://upload.wikimedia.org/wikipedia/commons/9/92/LaTeX_logo.svg" alt="LaTeX" height="20" align = "center"></a> document to PDF. For CairoMakie, the PDF is read and rendered directly, and a raster image is rendered in GLMakie.
It works by compiling a stand-alone $\LaTeX$ document to PDF. For CairoMakie, the PDF is read and rendered directly, and a raster image is rendered in GLMakie.

### Quick start
```julia
using Makie, MakieTeX
using CairoMakie # or whichever other backend
fig = Figure()
l1 = Label(
l1 = LTeX(
fig[1, 1], L"A \emph{convex} function $f \in C$ is \textcolor{blue}{denoted} as \tikz{\draw[line width=1pt, >->] (0, -2pt) arc (-180:0:8pt);}";
tellwidth = false, tellheight = true
)
Expand All @@ -25,6 +30,14 @@ fig
```
<img src="https://user-images.githubusercontent.com/32143268/170724177-d7cf9d16-8feb-4f6e-bb22-68fa8269066c.svg" height=300></img>

You can also plot SVGs and PDFs in a similar manner using the `SVGDocument` and `PDFDocument` types. The easiest way to construct these is to use constructors of the form:
```julia
SVGDocument(read("file.svg", String))
PDFDocument(read("file.pdf", String))
```
and you can pass them in the same places you would pass CachedTeX.

Some examples of using PDF and SVG are in the documentation linked at the top of the README, as well as in other packages like SwarmMakie.

You need not install anything for MakieTeX to work, since we ship a minimal TeX renderer called [`tectonic`](https://tectonic-typesetting.github.io/en-US/) (based on XeLaTeX). This will download any missing packages when it encounters them the first time. However, it will likely not know about any local packages or TEXMF paths, nor will it be able to render advanced features like TikZ graphs which require LuaTeX. The latexmk/lualatex combination will also likely be faster, and able to use advanced features like calling to other languages with `pythontex` (oh, the heresy!)

Expand All @@ -43,7 +56,7 @@ We provide a layoutable object, `LTeX`, which aims to solve this. `LTeX`s are f
An example follows:

```julia
fig = Figure(resolution = (400, 300));
fig = Figure(size = (400, 300));
tex1 = LTeX(fig[1, 1], L"\int \mathbf E \cdot d\mathbf a = \frac{Q_{encl}}{4\pi\epsilon_0}", scale=1);
tex2 = LTeX(fig[2, 1], L"\int \mathbf E \cdot d\mathbf a = \frac{Q_{encl}}{4\pi\epsilon_0}", scale=2);
fig
Expand Down Expand Up @@ -90,7 +103,7 @@ This example is from [Texample.net](https://texample.net/tikz/examples/title-gra
using MakieTeX, CairoMakie, Makie
td = TeXDocument(read(download("https://texample.net/media/tikz/examples/TEX/title-graphics.tex"), String))
fig = Figure()
lt = Label(fig[1, 1], td; tellheight=false)
lt = LTeX(fig[1, 1], td; tellheight=false)
ax = Axis(fig[1, 2])
lines!(ax, rand(10); color = 1:10)
fig
Expand Down
91 changes: 91 additions & 0 deletions docs/Data.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
data_config_version = 0
uuid = "c9f88755-cec1-4fc7-a16e-0de771f0bcda"
name = "microbench-graph"
plugins = ["store", "defaults", "memorise"]

[config.defaults.storage._]
checksum = "auto"

[[file-icons]]
uuid = "da0197d0-a0bd-4c7d-a3d6-54b8d28addfc"
description = "Source files for the custom icon-font used by the File-Icons package"

[[file-icons.storage]]
driver = "git"
checksum = "k12:93dff68faee99aed4240d426603a717c"
clone = true
path = "svg"
remote = "https://github.com/file-icons/icons.git"
revision = "e6e6e6ac8cb1d91867167c228c00a667f4d47101"

[[file-icons.loader]]
driver = "tar"

[[file-icons-devopicons]]
uuid = "20e42fdd-10db-44f8-8b18-205158e48afe"
description = "Heavily-optimised version of the Devicons icon-font"

[[file-icons-devopicons.storage]]
driver = "git"
checksum = "k12:96bb50765d4b99ec67e6c21ae6654f54"
clone = true
path = "svg"
remote = "https://github.com/file-icons/DevOpicons.git"
revision = "2c2bf2bdb6507b8e4bfe695c1d54d639fbfed479"

[[file-icons-devopicons.loader]]
driver = "tar"

[[file-icons-mfixx]]
uuid = "d4cd9be5-869c-4b63-a0ec-8fb172c192f2"
description = "Optimised version of the MFizz icon font"

[[file-icons-mfixx.storage]]
driver = "git"
checksum = "k12:a839aaf0f57a1a63d0ed2b5c13546850"
clone = true
path = "svg"
remote = "https://github.com/file-icons/MFixx.git"
revision = "9bc4e3734898a07d3ff1b452f90446368d6baf12"

[[file-icons-mfixx.loader]]
driver = "tar"

[[go-logo-solid]]
uuid = "09662418-cff6-4456-88ee-4a348b771eef"
description = "Solid go logo"

[[go-logo-solid.storage]]
driver = "web"
checksum = "k12:de75d60ae2c948cc904d129afb8efb37"
url = "https://raw.githubusercontent.com/file-icons/icons/master/svg/Go-Old.svg"

[[go-logo-solid.loader]]
driver = "passthrough"

[[linguist-langs]]
uuid = "6ef087f1-17ee-4d7e-93bb-8a3b49c0fc69"
description = "Linguist language data listing"

[[linguist-langs.storage]]
driver = "web"
checksum = "k12:aa2cd4d4a862c53b0fc0e53e381f798d"
url = "https://github.com/github-linguist/linguist/raw/4a807b475da9715fb20c5bbed34d0e2d97879e3a/lib/linguist/languages.yml"

[[linguist-langs.loader]]
driver = "yaml"

[[microbench]]
uuid = "acf3ac73-6fea-49c6-9612-cc056a2f49b2"
description = "Julia Microbenchmark data"

[[microbench.storage]]
driver = "web"
checksum = "k12:9d670b7cf573b71e7f9ef8773c3d278c"
url = "https://raw.githubusercontent.com/JuliaLang/Microbenchmarks/master/bin/benchmarks.csv"

[[microbench.loader]]
driver = "csv"

[microbench.loader.args]
header = ["language", "benchmark", "time"]
Loading

0 comments on commit e3e046c

Please sign in to comment.