### Install Latexify.jl Source: https://github.com/korsbo/latexify.jl/blob/master/README.md Use the Julia package manager to install the Latexify package. ```julia Pkg.add("Latexify") ``` -------------------------------- ### Overload latexraw for strings Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/inner_workings.md Example of extending latexraw to handle string inputs by parsing them first. ```julia latexraw(str::String) = latexraw(parse(str)) ``` -------------------------------- ### Configure DocTestSetup for latexalign Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/functions/latexalign.md Sets up the environment for doctests by importing Latexify and DifferentialEquations. ```julia DocTestSetup = quote using Latexify using DifferentialEquations end ``` -------------------------------- ### Initial recipe for operation Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/recipes.md A basic recipe for the custom operation type. ```julia @latexrecipe function f(m::MyDifference) return :($(m.y) - $(m.x)) end ``` -------------------------------- ### Render with custom packages and classes Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/index.md Supply document classes and packages as keyword arguments to the render function. ```julia L"\qty{1.25}{nm}" |> render(s, MIME("image/png"); documentclass="article", packages=("microtype", ("siunitx", exponent-product="\cdot"))) ``` -------------------------------- ### Format output with keyword arguments Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/index.md Apply environment settings or post-processing functions to the latexified output. ```julia julia> @latexdefine x env=:equation L"\begin{equation} x = 0.5 \end{equation} " ``` ```julia julia> @latexdefine x=π post=round L"$x = \pi = 3.0$" julia> @latexdefine x L"$x = \pi$" ``` -------------------------------- ### List Available Arrow Notation Options Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/Catalyst.md Generates a markdown table of available keyword arguments for the :arrow environment. ```julia Base.include(@__MODULE__, "src/table_generator.jl") args = [arg for arg in keyword_arguments if (:ReactionNetwork in arg.types || :Any in arg.types) && :arrow in arg.env] latexify(args, env=:mdtable, types=false) ``` -------------------------------- ### List Available Align Options Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/Catalyst.md Generates a markdown table of available keyword arguments for the :align environment. ```julia Base.include(@__MODULE__, "src/table_generator.jl") args = [arg for arg in keyword_arguments if (:ReactionNetwork in arg.types || :Any in arg.types) && :align in arg.env] latexify(args, env=:mdtable, types=false) ``` -------------------------------- ### Display and Print LaTeX output Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/index.md Demonstrates the difference between rendering a LaTeXString with display() and printing raw LaTeX-formatted text. ```julia latexify("x/y") |> display ``` ```julia latexify("x/y") |> print ``` -------------------------------- ### Latexify.latexoperation Documentation Reference Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/functions/latexoperation.md The standard documentation block for the latexoperation function. ```julia Latexify.latexoperation ``` -------------------------------- ### Implement a latex recipe Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/recipes.md Use the @latexrecipe macro to define how MyType is processed, including default keyword arguments and forced formatting. ```julia @latexrecipe function f(x::MyType; reverse=false) ## we can access the input object and perform operations like in a normal function. vec = x.vector if reverse vec = vec[end:-1:1] end ## we can define defult keyword arguments to be passed along to latexify ## using an arrow notation, --> env --> :array transpose --> true ## These can be overridden by the keyword arguments passed to the latexify function. ## If you use the := operator to specify a value it cannot be overridden. fmt := "%.2f" ## The return value should be something that latexify already knows how to work with. ## In this case, we have a simple vector which is fine! return vec end ``` -------------------------------- ### Print LaTeX strings Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/latexify.md Use println to output the raw LaTeX string for manual copy-pasting into documents. ```julia println(latexify(ex)) ## or the equivalent: latexify(ex) |> println ``` -------------------------------- ### Document latexalign Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/functions/latexalign.md Displays the documentation for the latexalign function. ```julia latexalign ``` -------------------------------- ### Execute and latexify expressions with macros Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/index.md Use @latexrun to execute and latexify, or @latexdefine to include the evaluated value in the output. ```julia julia> lstr = @latexrun f(x; y=2) = x/y L"$f\left( x; y = 2 \right) = \frac{x}{y}$" julia> f(1) 0.5 ``` ```julia julia> @latexdefine x = 1/2 L"$x = \frac{1}{2} = 0.5 julia> x 0.5 ``` -------------------------------- ### Render equations in terminal Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/index.md Use ImageInTerminal to render equations in sixel-compatible terminals. ```julia using ImageInTerminal, Latexify latexify(:(iħ * (∂Ψ(𝐫, t) / ∂t) = -ħ^2 / 2m * ΔΨ(𝐫, t) + V * Ψ(𝐫, t))) |> s -> render(s, dpi=200) ``` -------------------------------- ### Render ParameterizedFunctions as LaTeX Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/parameterizedfunctions.md Define a system using @ode_def and convert it to LaTeX alignment format. ```julia using Latexify using ParameterizedFunctions copy_to_clipboard(true) ode = @ode_def positiveFeedback begin dx = y*y*y/(k_y_x + y) - x - x dy = x^n_x/(k_x^n_x + x^n_x) - y end k_y k_x n_x latexify(ode) ``` -------------------------------- ### Convert Julia expression to LaTeX Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/latexinline.md Demonstrates the conversion of a Julia expression into a LaTeX string using latexinline. ```julia-repl julia> ex = :(x-y/z) julia> latexinline(ex) L"$x - \frac{y}{z}$" ``` -------------------------------- ### Reset DocTestSetup Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/functions/latexalign.md Clears the DocTestSetup configuration. ```julia DocTestSetup = nothing ``` -------------------------------- ### Customize tabular with adjustment and transpose Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/latextabular.md Demonstrates using keyword arguments to change column alignment and transpose the input array. ```julia latextabular(arr; adjustment=:l, transpose=true) |> println ``` -------------------------------- ### Manage global default settings Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/index.md Functions to set, view, and reset default keyword arguments for Latexify.jl functions within a session. ```julia set_default(fmt = "%.2f", convert_unicode = false) ``` ```julia set_default(mult_symbol = "") ``` ```julia get_default() ``` ```julia reset_default() ``` -------------------------------- ### Latexify a matrix of mixed types Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/index.md Demonstrates converting a matrix containing rationals, strings, complex numbers, and expressions into a LaTeX array. ```julia using Latexify copy_to_clipboard(false) # hide Latexify.set_default(; starred=true) m = [2//3 "e^(-c*t)" 1+3im; :(x/(x+k_1)) "gamma(n)" :(log10(x))] latexify(m) ``` -------------------------------- ### Define custom latex recipes Source: https://github.com/korsbo/latexify.jl/blob/master/README.md Extend Latexify support to custom types using the @latexrecipe macro. ```julia 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)))) ``` -------------------------------- ### Recipe with operation keyword Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/recipes.md Update the recipe to include the operation keyword, ensuring correct parenthesis handling. ```julia @latexrecipe function f(m::MyDifference) operation := :- return :($(m.y) - $(m.x)) end ``` -------------------------------- ### Render multiple systems side-by-side Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/parameterizedfunctions.md Pass a vector of ParameterizedFunctions to latexify to render them in a single alignment block. ```julia ode2 = @ode_def negativeFeedback begin dx = y/(k_y + y) - x dy = k_x^n_x/(k_x^n_x + x^n_x) - y end k_y k_x n_x latexify([ode, ode2]) ``` -------------------------------- ### Visualize model parameters Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/parameterizedfunctions.md Map parameter names to their values using either a list format or a transposed array environment. ```julia ## lets say that we have some parameters param = [3.4,5.2,1e-2] latexify(ode.params, param) ``` ```julia latexify([ode.params, param]; env=:array, transpose=true) ``` -------------------------------- ### get_default(; kwargs...) Source: https://github.com/korsbo/latexify.jl/blob/master/README.md Views the current global default keyword arguments. ```APIDOC ## get_default(; kwargs...) ### Description View the changes you have made to the default kwargs. ``` -------------------------------- ### Documenting latexraw Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/functions/latexraw.md Displays the documentation for the latexraw function. ```julia ```@docs latexraw ``` ``` -------------------------------- ### Render LaTeX in Notebooks Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/rendering_latex.md Use the display function with the text/latex MIME type to render LaTeX strings in compatible notebook environments. ```julia display("text/latex", x) ``` -------------------------------- ### Generate a basic LaTeX tabular Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/latextabular.md Converts a 2D array into a LaTeX tabular environment using default settings. ```julia using Latexify copy_to_clipboard(true) arr = ["x/y" :(y^n); 1.0 :(alpha(x))] latextabular(arr) |> println ``` -------------------------------- ### Simplify expressions with SymEngine Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/parameterizedfunctions.md Use the field=:symfuncs keyword argument to reduce symbolic expressions before rendering. ```julia latexify(ode, field=:symfuncs) ``` -------------------------------- ### Displaying LaTeX strings in notebook cells Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/notebooks.md Cells returning a LaTeXString or a string surrounded by $ are automatically rendered as math. ```julia latexify(35e-9; fmt=FancyNumberFormatter()) ``` ```julia @latexify (3x + 45)/2y ``` -------------------------------- ### Generate LaTeX from expressions Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/latexify.md Use latexify to convert Julia expressions to LaTeX. Enabling copy_to_clipboard allows for direct transfer to external editors. ```julia using Latexify copy_to_clipboard(true) ex = :(x/y) latexify(ex) ``` -------------------------------- ### copy_to_clipboard(::Bool) Source: https://github.com/korsbo/latexify.jl/blob/master/README.md Toggles whether the resulting LaTeX code is automatically copied to the system clipboard. ```APIDOC ## copy_to_clipboard(::Bool) ### Description Toggle automatic copying of the resulting LaTeX code to the clipboard. ### Parameters - **value** (Bool) - Required - Set to true to enable automatic copying, false to disable (default is false). ``` -------------------------------- ### Latexify Catalyst.jl reaction networks Source: https://github.com/korsbo/latexify.jl/blob/master/README.md Convert chemical reaction networks to LaTeX, including support for arrow notation. ```julia using Catalyst using Latexify rn = @reaction_network begin (r_bind, r_unbind), A + B ↔ C hill(C, v, k, n), 0 --> X d_x, X --> 0 end latexify(rn) ``` ```julia latexify(rn; env=:arrow) ``` -------------------------------- ### latexify(args...; kwargs...) Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/functions/latexify.md The latexify function converts various Julia objects into LaTeX code. It is the main entry point for the library. ```APIDOC ## latexify(args...; kwargs...) ### Description Converts the provided Julia objects into LaTeX formatted strings. This function serves as the primary interface for the Latexify.jl package. ### Parameters - **args** (Any) - The objects to be converted to LaTeX. - **kwargs** (Any) - Keyword arguments to customize the output formatting. ``` -------------------------------- ### @latexrun Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/index.md Executes and latexifies the given expression. ```APIDOC ## @latexrun(expr) ### Description Executes the given expression and then latexifies it. ``` -------------------------------- ### Filter and display inline and raw arguments Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/arguments.md Filters keyword arguments for raw or inline environments and renders them as a markdown table. ```julia Base.include(@__MODULE__, "src/table_generator.jl") args = [arg for arg in keyword_arguments if :raw in arg.env || :inline in arg.env] latexify(args, env=:mdtable) ``` -------------------------------- ### Create align environments from vectors Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/latexify.md Passing two vectors to latexify generates an align environment, mapping the first vector to the left-hand side and the second to the right-hand side. ```julia latexify(["x/y", :z], Any[2.3, 1//2]) ``` -------------------------------- ### Render Chemical Arrow Notation Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/Catalyst.md Displays reaction networks using chemical arrow notation with the :chemical environment. Includes MathJax mhchem support by default. ```julia latexify(rn; env=:chemical) ``` -------------------------------- ### Inspect expression arguments Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/inner_workings.md Examine the components of an expression object. ```julia-repl julia> ex.args 3-element Array{Any,1}: :+ :x :(y / z) ``` -------------------------------- ### Format numbers with printf-style strings Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/index.md Uses the fmt keyword with a printf-style format string to control numeric precision. ```julia latexify(12345.678; fmt="%.1e") ``` -------------------------------- ### render(str, mime) Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/index.md Generates and displays a rendered version of a LaTeXString. ```APIDOC ## render(str, [mime]) ### Description Generates a standalone file (PDF, DVI, PNG, or SVG) from a LaTeXString and displays it. ### Parameters - **str** (LaTeXString) - Required - The LaTeX string to render. - **mime** (MIME) - Optional - The output format (e.g., MIME("image/png")). ### Keyword Arguments - **convert** (Symbol) - Optional - Conversion tool (e.g., :dvipng). - **documentclass** (String) - Optional - LaTeX document class. - **packages** (Tuple) - Optional - Packages to include. - **dpi** (Int) - Optional - Resolution for image outputs. ``` -------------------------------- ### Generate a LaTeX array from a matrix Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/latexarray.md Creates a LaTeX array environment from a 3x3 identity matrix. ```julia-repl julia> arr = eye(Int,3) julia> print(latexarray(arr)) \begin{equation} \left[ \begin{array}{ccc} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1\\ \end{array} \right] \end{equation} ``` -------------------------------- ### Render ReactionNetwork as ODEs Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/Catalyst.md Converts a Catalyst reaction network into a system of ordinary differential equations using the :ode form. ```julia using Catalyst using Latexify copy_to_clipboard(true) hill2(x, v, k) = v*x^2/(k^2 + x^2) rn = @reaction_network begin hill2(y, v_x, k_x), 0 --> x p_y, 0 --> y (d_x, d_y), (x, y) --> 0 (r_b, r_u), x ↔ y end latexify(rn; form=:ode) ``` -------------------------------- ### Latexify strings and arrays Source: https://github.com/korsbo/latexify.jl/blob/master/README.md Convert strings and complex arrays into LaTeX format. ```julia using Latexify print(latexify("x+y/(b-2)^2")) ``` ```LaTeX $x + \frac{y}{\left( b - 2 \right)^{2}}$ ``` ```julia arr = ["x/y" 3//7 2+3im; 1 :P_x :(gamma(3))] latexify(arr) ``` -------------------------------- ### latexraw(args...; kwargs...) Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/functions/latexraw.md Formats the provided input for LaTeX output without surrounding it with an environment. ```APIDOC ## latexraw(args...; kwargs...) ### Description Formats the input for LaTeX without surrounding it with an environment. ### Signature `latexraw(args...; kwargs...)` ``` -------------------------------- ### Generate LaTeX align from ODE definitions Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/latexalign.md Convert ParameterizedFunction ODE definitions from DifferentialEquations.jl directly into LaTeX align format. ```julia using Latexify using DifferentialEquations ode = @ode_def positiveFeedback begin dx = y/(k_y + y) - x dy = x^n_x/(k_x^n_x + x^n_x) - y end k_y k_x n_x latexalign(ode) ``` -------------------------------- ### @latexdefine Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/index.md Executes the expression and latexifies it along with its value. ```APIDOC ## @latexdefine(expr) ### Description Executes the expression and latexifies the expression together with its value. ### Keyword Arguments - **env** (String) - Optional - LaTeX environment to wrap the output in. - **post** (Function) - Optional - A function to be called on the final right-hand side before latexification. ``` -------------------------------- ### View converted string result Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/inner_workings.md Observe the string representation after latexoperation processing. ```julia julia> newEx "\frac{y}{z}" ``` -------------------------------- ### Convert matrices to LaTeX arrays Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/latexify.md Matrices and vectors are automatically converted into LaTeX array environments. ```julia M = signif.(rand(3,4), 2) latexify(M) ``` -------------------------------- ### Render LaTeXStrings to external formats Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/index.md Use the render function to generate and display PDF, PNG, or SVG files from LaTeXStrings. ```julia latexify(:(x/y)) |> render ``` ```julia latexify(:(x/y)) |> s -> render(s, MIME("image/png")) ``` -------------------------------- ### Filter and display equation arguments Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/arguments.md Filters keyword arguments for the equation environment and renders them as a markdown table. ```julia Base.include(@__MODULE__, "src/table_generator.jl") args = [arg for arg in keyword_arguments if :equation in arg.env] latexify(args, env=:mdtable) ``` -------------------------------- ### Check expression argument types Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/inner_workings.md Verify the types of elements within an expression's argument list. ```julia-repl julia> typeof.(ex.args) 3-element Array{DataType,1}: Symbol Symbol Expr ``` -------------------------------- ### Toggle clipboard copying in Latexify.jl Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/index.md Enables or disables automatic copying of output strings to the system clipboard. ```julia copy_to_clipboard(true) ``` -------------------------------- ### Latexify DifferentialEquations.jl models Source: https://github.com/korsbo/latexify.jl/blob/master/README.md Convert ParameterizedFunctions ODE definitions to LaTeX. ```julia 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) ``` -------------------------------- ### set_default(; kwargs...) Source: https://github.com/korsbo/latexify.jl/blob/master/README.md Sets global default keyword arguments for the current Julia session. ```APIDOC ## set_default(; kwargs...) ### Description Set your own default kwargs for your Julia session. This is not to be used within a package since the effect is global. ### Parameters - **kwargs** (Keyword Arguments) - Optional - The default keyword arguments to apply globally. ``` -------------------------------- ### Render ReactionNetwork as SDEs Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/Catalyst.md Generates stochastic differential equations from a reaction network using the :sde form. Note that this functionality is currently reported as broken in the latest version. ```julia latexify(rn; form=:sde) ``` -------------------------------- ### Render symbolic matrices Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/parameterizedfunctions.md Convert symbolic arrays like the Jacobian, generated by ParameterizedFunctions, into LaTeX matrices. ```julia latexify(ode.symjac) ``` -------------------------------- ### Filter and display align arguments Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/arguments.md Filters keyword arguments for the align environment and renders them as a markdown table. ```julia Base.include(@__MODULE__, "src/table_generator.jl") args = [arg for arg in keyword_arguments if :align in arg.env] latexify(args, env=:mdtable) ``` -------------------------------- ### Filter and display array arguments Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/arguments.md Filters keyword arguments for the array environment and renders them as a markdown table. ```julia Base.include(@__MODULE__, "src/table_generator.jl") args = [arg for arg in keyword_arguments if :array in arg.env] latexify(args, env=:mdtable) ``` -------------------------------- ### Filter and display tabular arguments Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/arguments.md Filters keyword arguments for the tabular environment and renders them as a markdown table. ```julia Base.include(@__MODULE__, "src/table_generator.jl") args = [arg for arg in keyword_arguments if :tabular in arg.env] latexify(args, env=:mdtable) ``` -------------------------------- ### Define a custom type Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/recipes.md Define a struct to be used with a custom latexify recipe. ```julia using Latexify struct MyType vector::Vector end ``` -------------------------------- ### @latexify Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/index.md Latexifies the provided expression. ```APIDOC ## @latexify(expr) ### Description Latexifies the expression provided to it. ### Parameters - **expr** (Expression) - Required - The Julia expression to be converted to LaTeX. ``` -------------------------------- ### Generate a LaTeX array with mixed types Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/latexarray.md Demonstrates handling of arrays containing mixed types such as floats, complex numbers, rationals, expressions, and strings. ```julia arr = [1.0, 2-3im, 3//4, :(x/(k_1+x)), "e^(-k_b*t)"] latexarray(arr) ``` -------------------------------- ### Format numbers with custom functions Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/index.md Uses a custom function with the Format.jl package to format numbers with metric autoscaling. ```julia using Format latexify([12893.1 1.328e2]; fmt=x->format(round(x, sigdigits=2), autoscale=:metric)) ``` -------------------------------- ### Filter and display chemical arrow notation arguments Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/arguments.md Filters keyword arguments for the arrow environment, typically used with Catalyst, and renders them as a markdown table without types. ```julia Base.include(@__MODULE__, "src/table_generator.jl") args = [arg for arg in keyword_arguments if :arrow in arg.env] latexify(args, env=:mdtable, types=false) ``` -------------------------------- ### auto_display(::Bool) Source: https://github.com/korsbo/latexify.jl/blob/master/README.md Toggles automatic display of output in the Julia session. ```APIDOC ## auto_display(::Bool) ### Description Toggles automatic display of your output, even if it is not the last command to have run. ### Parameters - **value** (Bool) - Required - Set to true to enable automatic display. ``` -------------------------------- ### Filter and display markdown table arguments Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/arguments.md Filters keyword arguments for the mdtable environment and renders them as a markdown table. ```julia Base.include(@__MODULE__, "src/table_generator.jl") args = [arg for arg in keyword_arguments if :mdtable in arg.env] latexify(args, env=:mdtable) ``` -------------------------------- ### Generate LaTeX align from vectors Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/latexalign.md Pass two vectors representing the left-hand and right-hand sides of equations to generate an align environment. ```julia lhs = ["dx/dt", "dy/dt"] rhs = ["y^2 - x", "x/y - y"] print(latexalign(lhs, rhs)) ``` -------------------------------- ### Invoke latexify with custom type Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/recipes.md Call latexify on an instance of the custom type. ```julia mytype = MyType([1, 2, 3]) latexify(mytype; reverse=true) ``` -------------------------------- ### Inspect updated expression arguments Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/inner_workings.md View the expression arguments after the recursive step has replaced the nested expression with a string. ```julia-repl julia> ex.args 3-element Array{Any,1}: :+ :x :"\frac{y}{z}" ``` -------------------------------- ### Customize Chemical Arrow Output Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/Catalyst.md Configures chemical arrow rendering by disabling function expansion and using starred environments to suppress equation numbering. ```julia latexify(rn; env=:chemical, expand=false, starred=true) ``` -------------------------------- ### Final string output Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/inner_workings.md The resulting string after the final operation is applied. ```julia "x + \frac{y}{z}" ``` -------------------------------- ### Define a Julia expression Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/inner_workings.md Create an expression object to be processed by the latexification algorithm. ```julia-repl julia> ex = :(x + y/z) ``` -------------------------------- ### Toggle automatic display of results Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/index.md Configures whether the result of latexify calls is automatically displayed, which can be useful for interactive sessions but may cause excessive output in loops. ```julia latexify("x/y") |> display ## or display( latexify("x/y") ) ``` ```julia auto_display(true) ``` -------------------------------- ### Output of basic tabular generation Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/latextabular.md The resulting LaTeX code produced by the basic latextabular call. ```LaTeX \begin{tabular}{cc} $\frac{x}{y}$ & $y^{n}$\\ $1.0$ & $\alpha\left( x \right)$\\ \end{tabular} ``` -------------------------------- ### Print latexraw output Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/inner_workings.md Display the final LaTeX formatted string using the print function. ```julia-repl julia> print(latexraw(ex)) "x + \frac{y}{z}" ``` -------------------------------- ### Dive into nested expressions Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/inner_workings.md Access and inspect a nested expression within the argument list. ```julia-repl julia> newEX = ex.args[3] julia> newEx.args 3-element Array{Any,1}: :/ :y :z ``` -------------------------------- ### reset_default(; kwargs...) Source: https://github.com/korsbo/latexify.jl/blob/master/README.md Resets the global default keyword arguments. ```APIDOC ## reset_default(; kwargs...) ### Description Reset the changes you made with the set_default command. ``` -------------------------------- ### Latexify arrays Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/inner_workings.md Convert arrays of expressions or strings into LaTeX formatted strings. ```julia-repl julia> arr = [:(x-y/(k_10+z)), "x*y*z/3"] julia> latexraw(arr) 2-element Array{String,1}: "x - \frac{y}{k_{10} + z}" "\frac{x \cdot y \cdot z}{3}" julia> println.(latexraw(arr)) x - \frac{y}{k_{10} + z} \frac{x \cdot y \cdot z}{3} ``` -------------------------------- ### Format numbers with SiunitxNumberFormatter Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/index.md Uses the siunitx package for advanced number formatting via the LaTeX engine. ```julia str = latexify(12345.678; fmt=SiunitxNumberFormatter(format_options="round-mode=places,round-precision=1", version=3)) replace(string(str), "$"=>"`") # hide ``` -------------------------------- ### Display LaTeX align in Jupyter Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/latexalign.md Use the display function to render the LaTeX output directly within a Jupyter notebook environment. ```julia display( latexalign(lhs, rhs)) ``` -------------------------------- ### Latexify a string expression Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/index.md Converts a string representation of a mathematical expression into its LaTeX equivalent. ```julia str = "x/(2*k_1+x^2)" latexify(str) ``` -------------------------------- ### Output of customized tabular generation Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/latextabular.md The resulting LaTeX code produced by the customized latextabular call. ```LaTeX \begin{tabular}{ll} $\frac{x}{y}$ & $1.0$\\ $y^{n}$ & $\alpha\left( x \right)$\\ \end{tabular} ``` -------------------------------- ### Required macro signature Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/recipes.md The required structure for the @latexrecipe function definition. ```julia @latexrecipe function f(x::MyType, ...; ...) return something end ``` -------------------------------- ### Interpolate values in macros Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/index.md Use $ to interpolate actual values into the macro expression instead of the symbolic representation. ```julia julia> @latexify x = abs2(-3) L"$x = \left|-3\right|^{2}$" julia> @latexify x = $(abs2(-3)) L"$x = 9$" ``` -------------------------------- ### Preventing assignment display bugs Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/notebooks.md Encase assignment expressions in a begin/end block to avoid unnecessary output information in Pluto. ```julia begin @latexrun x = 125 end ``` ```julia begin @latexdefine y = x end ``` -------------------------------- ### latexarray(x; kwargs...) Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/functions/latexarray.md Converts an array or matrix into a LaTeX array environment. This function is intended for direct use by users to generate LaTeX code from Julia data structures. ```APIDOC ## latexarray(x; kwargs...) ### Description Converts an array or matrix into a LaTeX array environment. This function is part of the Latexify.jl package and is used to format data structures for LaTeX output. ### Parameters - **x** (AbstractArray) - Required - The array or matrix to be converted to LaTeX format. - **kwargs** (Keyword Arguments) - Optional - Additional configuration options supported by the Latexify.jl framework. ``` -------------------------------- ### Format numbers with FancyNumberFormatter Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/index.md Applies FancyNumberFormatter to an array to replace standard exponent notation with scientific notation. ```julia latexify([12893.1 1.328e2; "x/y" 7832//2378]; fmt=FancyNumberFormatter(3)) ``` -------------------------------- ### Define custom operation type Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/recipes.md Define a struct representing a mathematical operation. ```julia struct MyDifference x y end ``` -------------------------------- ### Embedding latexifications in Markdown Source: https://github.com/korsbo/latexify.jl/blob/master/docs/src/tutorials/notebooks.md Use Markdown.parse to embed latexified expressions into text, avoiding interpolation conflicts found with standard md strings. ```julia Markdown.parse(""" ## Results With the previously calculated $(@latexdefine x), we can use $(@latexify x = v*t) to calculate $(@latexrun v = x/10), giving a final velocity of $(latexify(v)). If we want more manual control, we can combine manual dollar signs with `env=:raw`: $ \hat{v} = $(latexify(v, env=:raw))\;\mathrm{m}/\mathrm{s} $ """) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.