Skip to content

Commit

Permalink
Complete the refactor from TeX to TEX
Browse files Browse the repository at this point in the history
  • Loading branch information
asinghvi17 committed Jun 5, 2024
1 parent ecc0105 commit 9a7bfb2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/layoutable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ end

LTeX(x, tex; kwargs...) = LTeX(x; tex = tex, kwargs...)

_to_cachedtex(x) = CachedTeX(x)
_to_cachedtex(x) = CachedTEX(x)
_to_cachedtex(x::AbstractDocument) = Cached(x)

function Makie.initialize_block!(l::LTeX)
Expand Down
2 changes: 1 addition & 1 deletion src/recipe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function Makie.plot!(plot::TeXImg)
# changing dpi should rerender
plottable_images = lift(plot[1], plot.render_density, plot.scale) do cachedtex, render_density, scale
if cachedtex isa AbstractString || cachedtex isa AbstractArray{<: AbstractString}
to_array(_bc_if_array(CachedTeX, cachedtex))
to_array(_bc_if_array(CachedTEX, cachedtex))
else
to_array(_bc_if_array(Cached, cachedtex))
end
Expand Down
4 changes: 2 additions & 2 deletions src/rendering/tex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# TeX rendering
=#

function rasterize(ct::CachedTeX, scale::Int64 = 1)
function rasterize(ct::CachedTEX, scale::Int64 = 1)
return page2img(ct, ct.doc.page; scale)
end

Expand Down Expand Up @@ -105,6 +105,6 @@ function compile_latex(
end


compile_latex(document::TeXDocument; kwargs...) = compile_latex(doc.doc; kwargs...)
compile_latex(document::TEXDocument; kwargs...) = compile_latex(String(doc.doc); kwargs...)

latex2pdf(args...; kwargs...) = compile_latex(args...; kwargs...)
8 changes: 4 additions & 4 deletions src/text_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function to_texdoc(lstr, font, textsize, lineheight, color)
\\color{maincolor}
""" * String(lstr)

return TeXDocument(
return TEXDocument(
string, true;
requires = requires,
preamble = preamble,
Expand All @@ -58,7 +58,7 @@ function to_texdoc(lstr, font, textsize, lineheight, color)
end

function to_plottable_cachedtex(lstr, font, textsize, lineheight, color)
return CachedTeX(to_texdoc(lstr, font, textsize, lineheight, color))
return CachedTEX(to_texdoc(lstr, font, textsize, lineheight, color))
end

function _plottable_cachedtex_from_array(lstrs::AbstractVector{<: AbstractString}, fonts, textsizes, lineheights, colors)
Expand Down Expand Up @@ -113,7 +113,7 @@ function _plottable_cachedtex_from_array(lstrs::AbstractVector{<: AbstractString
i += 1
end

doc = TeXDocument(
doc = TEXDocument(
contents, true;
requires = requires,
preamble = preamble,
Expand All @@ -129,7 +129,7 @@ function _plottable_cachedtex_from_array(lstrs::AbstractVector{<: AbstractString

pdfs = split_pdf(full_pdf)

return CachedTeX.(pdfs)
return CachedTEX.(pdfs)
end


Expand Down

0 comments on commit 9a7bfb2

Please sign in to comment.