Skip to content

Commit

Permalink
Minor fixes and new version
Browse files Browse the repository at this point in the history
  • Loading branch information
asinghvi17 committed Feb 22, 2023
1 parent 3403088 commit 8e97853
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MakieTeX"
uuid = "6d554a22-29e7-47bd-aee5-0c5f06619414"
authors = ["Anshul Singhvi"]
version = "0.3"
version = "0.3.1"

[deps]
Cairo = "159f3aea-2a34-519c-b102-8c37f9878175"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ It works by compiling a stand-alone <img src="https://upload.wikimedia.org/wikip
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 Down
5 changes: 4 additions & 1 deletion src/MakieTeX.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
module MakieTeX
using Makie, CairoMakie, Makie.MakieLayout
using Makie, CairoMakie
using Cairo
using Colors, LaTeXStrings

# patch for Makie.jl block macro error
using Makie: CURRENT_DEFAULT_THEME

using Makie.GeometryBasics: origin, widths
using Makie.Observables
using DocStringExtensions
Expand Down
8 changes: 6 additions & 2 deletions src/recipe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,18 @@ end

function Makie.boundingbox(x::T) where T <: TeXImg
Makie.boundingbox(
x[1][],
x[1][] isa CachedTeX ? [x[1][]] : x[1][],
to_ndim.(Point3f, x.position[], 0),
x.rotations[],
x.scale[],
x.align[]
)
end

function Makie.data_limits(x::T) where T <: TeXImg
Makie.boundingbox(x)
end

function offset_from_align(align::Tuple{Symbol, Symbol}, wh)::Vec2f

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

scatter_images = Observable(plottable_images[])
Expand Down

2 comments on commit 8e97853

@asinghvi17
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/78272

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.1 -m "<description of version>" 8e978536f40390a5fcc6538af075fdb419e50075
git push origin v0.3.1

Please sign in to comment.