在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):korsbo/Latexify.jl开源软件地址(OpenSource Url):https://github.com/korsbo/Latexify.jl开源编程语言(OpenSource Language):Julia 99.4%开源软件介绍(OpenSource Introduction):Latexify.jlThis is a package for generating LaTeX maths from julia objects. This package utilises Julias homoiconicity to convert expressions to LaTeX-formatted strings. Latexify.jl supplies functionalities for converting a range of different Julia objects, including:
as well as arrays or dicts of supported types. RecipesTo extend Latexify to work with your own type, you define a recipe using the
Exampleslatexifying expressionsusing Latexify
ex = :(x/(y+x)^2)
latexify(ex) This generates a LaTeXString (from LaTeXStrings.jl) which, when printed looks like: $\frac{x}{\left( y + x \right)^{2}}$ And when this LaTeXString is displayed in an environment which supports the tex/latex MIME type (Jupyter notebooks, Jupyterlab and Hydrogen for Atom) it will automatically render as: latexifying other thingsLatexify.jl is equipped to convert a whole range of types to latex formatted
maths. This includes primitive types such as using Latexify
print(latexify("x+y/(b-2)^2")) outputs: $x + \frac{y}{\left( b - 2 \right)^{2}}$ arr = ["x/y" 3//7 2+3im; 1 :P_x :(gamma(3))]
latexify(arr) The GitHub website does not really support rendering of equations in the README file, so I therefore refer you to the documentation for more info/examples. latexifying custom typesYou can add support for a type via using Latexify
struct Ket{T}
x::T
end
@latexrecipe function f(x::Ket)
return Expr(:latexifymerge, "\\left|", x.x, "\\right>")
end
latexify(:($(Ket(:a)) + $(Ket(:b)))) Use with DifferentialEquations.jlThe DifferentialEquations.jl suite has some nifty tools for generating differential equations. One of them is ParameterizedFunctions which allows you to type in an ODE in something which looks very much like just plain mathematics. The ability to latexify such ODEs is pretty much what lured me to create this package. using ParameterizedFunctions
using Latexify
f = @ode_def positiveFeedback begin
dx = v*y^n/(k^n+y^n) - x
dy = x/(k_2+x) - y
end v n k k_2
latexify(f) outputs: DiffEqBiological.jl provides another cool domain-specific language which allows you to generate equations using a chemical arrow notation. using DiffEqBiological
using Latexify
rn = @reaction_network demoNetwork begin
(r_bind, r_unbind), A + B ↔ C
Hill(C, v, k, n), 0 --> X
d_x, X --> 0
end r_bind r_unbind v k n d_x
latexify(rn) Or you can output the arrow notation directly to latex: latexify(rn; env=:arrow) There are more stuff that you can do, but for that I will refer you to the docs. Convenience functions
InstallationThis package is registered in the Julia registry, so to install it you can just run Pkg.add("Latexify") Further informationFor further information see the docs. ContributingI would be happy to receive feedback, suggestions, and help with improving this package. Please feel free to open an issue or a PR. If you want to add support for types defined in another package, primarily create a PR in that package with a recipe. Latexify.jl is not intended to be a collection of recipes for different types. The exceptions are the few types which were included before the recipe system was finished. If the other package is hesitant to pull in Latexify as a dependency, you can either use Requires.jl, or create a separate glue package. If you do add support for another package, please help update the list below: Supported types and packages
And more ... |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论