Skip to content

Commit 8e97853

Browse files
committed
Minor fixes and new version
1 parent 3403088 commit 8e97853

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "MakieTeX"
22
uuid = "6d554a22-29e7-47bd-aee5-0c5f06619414"
33
authors = ["Anshul Singhvi"]
4-
version = "0.3"
4+
version = "0.3.1"
55

66
[deps]
77
Cairo = "159f3aea-2a34-519c-b102-8c37f9878175"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ It works by compiling a stand-alone <img src="https://upload.wikimedia.org/wikip
1313
using Makie, MakieTeX
1414
using CairoMakie # or whichever other backend
1515
fig = Figure()
16-
l1 = Label(
16+
l1 = LTeX(
1717
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);}";
1818
tellwidth = false, tellheight = true
1919
)

src/MakieTeX.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
module MakieTeX
2-
using Makie, CairoMakie, Makie.MakieLayout
2+
using Makie, CairoMakie
33
using Cairo
44
using Colors, LaTeXStrings
55

6+
# patch for Makie.jl block macro error
7+
using Makie: CURRENT_DEFAULT_THEME
8+
69
using Makie.GeometryBasics: origin, widths
710
using Makie.Observables
811
using DocStringExtensions

src/recipe.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,18 @@ end
1919

2020
function Makie.boundingbox(x::T) where T <: TeXImg
2121
Makie.boundingbox(
22-
x[1][],
22+
x[1][] isa CachedTeX ? [x[1][]] : x[1][],
2323
to_ndim.(Point3f, x.position[], 0),
2424
x.rotations[],
2525
x.scale[],
2626
x.align[]
2727
)
2828
end
2929

30+
function Makie.data_limits(x::T) where T <: TeXImg
31+
Makie.boundingbox(x)
32+
end
33+
3034
function offset_from_align(align::Tuple{Symbol, Symbol}, wh)::Vec2f
3135

3236
(halign::Symbol, valign::Symbol) = align
@@ -59,7 +63,7 @@ function Makie.plot!(plot::T) where T <: TeXImg
5963
# We always want to draw this at a 1:1 ratio, so increasing scale or
6064
# changing dpi should rerender
6165
plottable_images = lift(plot[1], plot.render_density, plot.scale) do cachedtex, render_density, scale
62-
to_array(firstpage2img.(cachedtex; render_density = render_density * scale))
66+
to_array(firstpage2img((cachedtex); render_density = render_density * scale))
6367
end
6468

6569
scatter_images = Observable(plottable_images[])

0 commit comments

Comments
 (0)