mirror of https://github.com/mpastell/Weave.jl
Merge pull request #357 from baggepinnen/patch-2
[RFC] Do not define Markdown.latex using evalpull/393/head
commit
74768a7e0f
|
@ -5,23 +5,15 @@ using ..Weave: isnothing, take2string!
|
||||||
using Markdown
|
using Markdown
|
||||||
import Markdown: @trigger, @breaking, Code, MD, withstream, startswith, LaTeX
|
import Markdown: @trigger, @breaking, Code, MD, withstream, startswith, LaTeX
|
||||||
|
|
||||||
|
# Note that this definition causes a "Method overwritten" warning,
|
||||||
function __init__()
|
# but defining this function in __init__() is not legal in julia v1.5
|
||||||
# NOTE:
|
function Markdown.latex(io::IO, tex::Markdown.LaTeX)
|
||||||
# overwriting `Markdown.latex` function should be done here in order to allow
|
math_envs = ["align", "equation", "eqnarray"]
|
||||||
# incremental precompilations
|
use_dollars =
|
||||||
Markdown.eval(
|
!any([occursin("\\begin{$me", tex.formula) for me in math_envs])
|
||||||
quote
|
use_dollars && write(io, "\\[")
|
||||||
function latex(io::IO, tex::Markdown.LaTeX)
|
write(io, string("\n", tex.formula, "\n"))
|
||||||
math_envs = ["align", "equation", "eqnarray"]
|
use_dollars && write(io, "\\]\n")
|
||||||
use_dollars =
|
|
||||||
!any([occursin("\\begin{$me", tex.formula) for me in math_envs])
|
|
||||||
use_dollars && write(io, "\\[")
|
|
||||||
write(io, string("\n", tex.formula, "\n"))
|
|
||||||
use_dollars && write(io, "\\]\n")
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
mutable struct Comment
|
mutable struct Comment
|
||||||
|
|
Loading…
Reference in New Issue