diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index c53d9a31..8d44808d 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.11.2","generation_timestamp":"2024-12-20T13:13:01","documenter_version":"1.8.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.11.3","generation_timestamp":"2025-02-04T21:16:21","documenter_version":"1.8.0"}} \ No newline at end of file diff --git a/dev/arguments/index.html b/dev/arguments/index.html index 70515e82..a8c61473 100644 --- a/dev/arguments/index.html +++ b/dev/arguments/index.html @@ -1,2 +1,2 @@ -List of possible arguments · Latexify.jl

List of possible arguments

Align

KeywordValuesDefaultApplicable typesDescription
:bracketBoolfalseParameterizedFunction, ReactionNetworkSurround variables with square brackets.
:cleanBoolfalseReactionNetworkClean out 1* terms. Only useful for Catalyst (then named DiffEqBiological) versions 3.4 or below.
:convert_unicodeBooltrueAnyConvert unicode characters to latex commands, for example α to \alpha
:double_linebreakBoolfalseAnyAdd an extra \\ to the end of the line.
:expandBooltrueReactionNetworkExpand functions such as hill(x, v, k, n) to their mathematical expression.
:fmtformat string""AnyFormat number output in accordance with Printf. Example: "%.2e"
:imaginary_unitString"\\mathit{i}"AnyThe symbol to use to represent the imaginary unit
:indexSymb:bracketAnyRepresent index specification with :bracket (u[1]) or :subscript (u_1).
:mult_symbolString"\\cdot"AnySpecify the symbol to use for the multiplication operator ("" for juxtaposition).
:noiseBoolfalseReactionNetworkDisplay the noise function instead of the deterministic one.
:rowsIterable or symol:allAnyWhich rows to include in the output.
:safescriptsBoolfalseAnyPut scripts inside brackets (a{_b}), sometimes making them uglier, but making alternating scripts possible.
:separatorString" &= "AnySpecify how to separate the left hand side and the right.
:snakecaseBoolfalseAnyTreat underscores as literal underscores (if not, treat first underscore as subscript).
:starredBoolfalseAnyStar the environment to prevent equation numbering.
:symbolicBoolfalseReactionNetworkUse symbolic calculations to clean up the expression.

Equation

KeywordValuesDefaultDescription
:starredBoolfalseStar the environment to prevent equation numbering.

Array

KeywordValuesDefaultDescription
:adjustment:c for centered, :l for left, :r for right, or a vector with one such symbol per column.:cSet the adjustment of text within the table cells.
:arraystyleSymbol, String, NTuple{3, String}:squareHow to style (brackets around) arrays. Symbols correspond to predefined styles: :square, :round, :curly, :bmatrix, :pmatrix. A string will be used as an environment, with no further brackets (e.g. "vmatrix"). Tuples should be (<starting bracket>, <ending bracket>, <environment>), for instance :square corresponds to ("\n\\left[", "\\right]\n", "array").
:convert_unicodeBooltrueConvert unicode characters to latex commands, for example α to \alpha
:double_linebreakBoolfalseAdd an extra \\ to the end of the line.
:fmtformat string""Format number output in accordance with Printf. Example: "%.2e"
:imaginary_unitString"\\mathit{i}"The symbol to use to represent the imaginary unit
:indexSymb:bracketRepresent index specification with :bracket (u[1]) or :subscript (u_1).
:mult_symbolString"\\cdot"Specify the symbol to use for the multiplication operator ("" for juxtaposition).
:safescriptsBoolfalsePut scripts inside brackets (a{_b}), sometimes making them uglier, but making alternating scripts possible.
:snakecaseBoolfalseTreat underscores as literal underscores (if not, treat first underscore as subscript).
:starredBoolfalseStar the environment to prevent equation numbering.
:transposeBooltrueFlip rows for columns.

Tabular

KeywordValuesDefaultDescription
:adjustment:c for centered, :l for left, :r for right, or a vector with one such symbol per column.:cSet the adjustment of text within the table cells.
:booktabsBoolfalseAdd top, mid and bottom booktabs rule
:convert_unicodeBooltrueConvert unicode characters to latex commands, for example α to \alpha
:fmtformat string""Format number output in accordance with Printf. Example: "%.2e"
:headArray[]Add a header to the table. It will error if it is not of the right length (unless empty).
:imaginary_unitString"\\mathit{i}"The symbol to use to represent the imaginary unit
:indexSymb:bracketRepresent index specification with :bracket (u[1]) or :subscript (u_1).
:latexBooltrueToggle latexification of the table elements.
:mult_symbolString"\\cdot"Specify the symbol to use for the multiplication operator ("" for juxtaposition).
:safescriptsBoolfalsePut scripts inside brackets (a{_b}), sometimes making them uglier, but making alternating scripts possible.
:sideArray[]Add a leftmost column to the table. It will error if it is not of the right length (unless empty).
:snakecaseBoolfalseTreat underscores as literal underscores (if not, treat first underscore as subscript).
:transposeBooltrueFlip rows for columns.

Markdown Table

KeywordValuesDefaultDescription
:adjustment:c for centered, :l for left, :r for right, or a vector with one such symbol per column.:cSet the adjustment of text within the table cells.
:convert_unicodeBooltrueConvert unicode characters to latex commands, for example α to \alpha
:escape_underscoresBoolfalsePrevent underscores from being interpreted as formatting.
:fmtformat string""Format number output in accordance with Printf. Example: "%.2e"
:headArray[]Add a header to the table. It will error if it is not of the right length (unless empty).
:imaginary_unitString"\\mathit{i}"The symbol to use to represent the imaginary unit
:indexSymb:bracketRepresent index specification with :bracket (u[1]) or :subscript (u_1).
:latexBooltrueToggle latexification of the table elements.
:mult_symbolString"\\cdot"Specify the symbol to use for the multiplication operator ("" for juxtaposition).
:safescriptsBoolfalsePut scripts inside brackets (a{_b}), sometimes making them uglier, but making alternating scripts possible.
:sideArray[]Add a leftmost column to the table. It will error if it is not of the right length (unless empty).
:snakecaseBoolfalseTreat underscores as literal underscores (if not, treat first underscore as subscript).
:transposeBooltrueFlip rows for columns.

Inline and raw

KeywordValuesDefaultDescription
:convert_unicodeBooltrueConvert unicode characters to latex commands, for example α to \alpha
:fmtformat string""Format number output in accordance with Printf. Example: "%.2e"
:imaginary_unitString"\\mathit{i}"The symbol to use to represent the imaginary unit
:indexSymb:bracketRepresent index specification with :bracket (u[1]) or :subscript (u_1).
:mult_symbolString"\\cdot"Specify the symbol to use for the multiplication operator ("" for juxtaposition).
:safescriptsBoolfalsePut scripts inside brackets (a{_b}), sometimes making them uglier, but making alternating scripts possible.
:snakecaseBoolfalseTreat underscores as literal underscores (if not, treat first underscore as subscript).

Chemical arrow notation

Available with ReactionNetworks from Catalyst.

KeywordValuesDefaultDescription
:double_linebreakBoolfalseAdd an extra \\ to the end of the line.
:expandBooltrueExpand functions such as hill(x, v, k, n) to their mathematical expression.
:mathjaxBooltrueAdd \require{mhchem} to tell MathJax to load the required module.
:starredBoolfalseStar the environment to prevent equation numbering.
+List of possible arguments · Latexify.jl

List of possible arguments

Align

KeywordValuesDefaultApplicable typesDescription
:bracketBoolfalseParameterizedFunction, ReactionNetworkSurround variables with square brackets.
:cleanBoolfalseReactionNetworkClean out 1* terms. Only useful for Catalyst (then named DiffEqBiological) versions 3.4 or below.
:convert_unicodeBooltrueAnyConvert unicode characters to latex commands, for example α to \alpha
:double_linebreakBoolfalseAnyAdd an extra \\ to the end of the line.
:expandBooltrueReactionNetworkExpand functions such as hill(x, v, k, n) to their mathematical expression.
:fmtformat string""AnyFormat number output in accordance with Printf. Example: "%.2e"
:imaginary_unitString"\\mathit{i}"AnyThe symbol to use to represent the imaginary unit
:indexSymb:bracketAnyRepresent index specification with :bracket (u[1]) or :subscript (u_1).
:mult_symbolString"\\cdot"AnySpecify the symbol to use for the multiplication operator ("" for juxtaposition).
:noiseBoolfalseReactionNetworkDisplay the noise function instead of the deterministic one.
:rowsIterable or symol:allAnyWhich rows to include in the output.
:safescriptsBoolfalseAnyPut scripts inside brackets (a{_b}), sometimes making them uglier, but making alternating scripts possible.
:separatorString" &= "AnySpecify how to separate the left hand side and the right.
:snakecaseBoolfalseAnyTreat underscores as literal underscores (if not, treat first underscore as subscript).
:starredBoolfalseAnyStar the environment to prevent equation numbering.
:symbolicBoolfalseReactionNetworkUse symbolic calculations to clean up the expression.

Equation

KeywordValuesDefaultDescription
:starredBoolfalseStar the environment to prevent equation numbering.

Array

KeywordValuesDefaultDescription
:adjustment:c for centered, :l for left, :r for right, or a vector with one such symbol per column.:cSet the adjustment of text within the table cells.
:arraystyleSymbol, String, NTuple{3, String}:squareHow to style (brackets around) arrays. Symbols correspond to predefined styles: :square, :round, :curly, :bmatrix, :pmatrix. A string will be used as an environment, with no further brackets (e.g. "vmatrix"). Tuples should be (<starting bracket>, <ending bracket>, <environment>), for instance :square corresponds to ("\n\\left[", "\\right]\n", "array").
:convert_unicodeBooltrueConvert unicode characters to latex commands, for example α to \alpha
:double_linebreakBoolfalseAdd an extra \\ to the end of the line.
:fmtformat string""Format number output in accordance with Printf. Example: "%.2e"
:imaginary_unitString"\\mathit{i}"The symbol to use to represent the imaginary unit
:indexSymb:bracketRepresent index specification with :bracket (u[1]) or :subscript (u_1).
:mult_symbolString"\\cdot"Specify the symbol to use for the multiplication operator ("" for juxtaposition).
:safescriptsBoolfalsePut scripts inside brackets (a{_b}), sometimes making them uglier, but making alternating scripts possible.
:snakecaseBoolfalseTreat underscores as literal underscores (if not, treat first underscore as subscript).
:starredBoolfalseStar the environment to prevent equation numbering.
:transposeBooltrueFlip rows for columns.

Tabular

KeywordValuesDefaultDescription
:adjustment:c for centered, :l for left, :r for right, or a vector with one such symbol per column.:cSet the adjustment of text within the table cells.
:booktabsBoolfalseAdd top, mid and bottom booktabs rule
:convert_unicodeBooltrueConvert unicode characters to latex commands, for example α to \alpha
:fmtformat string""Format number output in accordance with Printf. Example: "%.2e"
:headArray[]Add a header to the table. It will error if it is not of the right length (unless empty).
:imaginary_unitString"\\mathit{i}"The symbol to use to represent the imaginary unit
:indexSymb:bracketRepresent index specification with :bracket (u[1]) or :subscript (u_1).
:latexBooltrueToggle latexification of the table elements.
:mult_symbolString"\\cdot"Specify the symbol to use for the multiplication operator ("" for juxtaposition).
:safescriptsBoolfalsePut scripts inside brackets (a{_b}), sometimes making them uglier, but making alternating scripts possible.
:sideArray[]Add a leftmost column to the table. It will error if it is not of the right length (unless empty).
:snakecaseBoolfalseTreat underscores as literal underscores (if not, treat first underscore as subscript).
:transposeBooltrueFlip rows for columns.

Markdown Table

KeywordValuesDefaultDescription
:adjustment:c for centered, :l for left, :r for right, or a vector with one such symbol per column.:cSet the adjustment of text within the table cells.
:convert_unicodeBooltrueConvert unicode characters to latex commands, for example α to \alpha
:escape_underscoresBoolfalsePrevent underscores from being interpreted as formatting.
:fmtformat string""Format number output in accordance with Printf. Example: "%.2e"
:headArray[]Add a header to the table. It will error if it is not of the right length (unless empty).
:imaginary_unitString"\\mathit{i}"The symbol to use to represent the imaginary unit
:indexSymb:bracketRepresent index specification with :bracket (u[1]) or :subscript (u_1).
:latexBooltrueToggle latexification of the table elements.
:mult_symbolString"\\cdot"Specify the symbol to use for the multiplication operator ("" for juxtaposition).
:safescriptsBoolfalsePut scripts inside brackets (a{_b}), sometimes making them uglier, but making alternating scripts possible.
:sideArray[]Add a leftmost column to the table. It will error if it is not of the right length (unless empty).
:snakecaseBoolfalseTreat underscores as literal underscores (if not, treat first underscore as subscript).
:transposeBooltrueFlip rows for columns.

Inline and raw

KeywordValuesDefaultDescription
:convert_unicodeBooltrueConvert unicode characters to latex commands, for example α to \alpha
:fmtformat string""Format number output in accordance with Printf. Example: "%.2e"
:imaginary_unitString"\\mathit{i}"The symbol to use to represent the imaginary unit
:indexSymb:bracketRepresent index specification with :bracket (u[1]) or :subscript (u_1).
:mult_symbolString"\\cdot"Specify the symbol to use for the multiplication operator ("" for juxtaposition).
:safescriptsBoolfalsePut scripts inside brackets (a{_b}), sometimes making them uglier, but making alternating scripts possible.
:snakecaseBoolfalseTreat underscores as literal underscores (if not, treat first underscore as subscript).

Chemical arrow notation

Available with ReactionNetworks from Catalyst.

KeywordValuesDefaultDescription
:double_linebreakBoolfalseAdd an extra \\ to the end of the line.
:expandBooltrueExpand functions such as hill(x, v, k, n) to their mathematical expression.
:mathjaxBooltrueAdd \require{mhchem} to tell MathJax to load the required module.
:starredBoolfalseStar the environment to prevent equation numbering.
diff --git a/dev/functions/latexalign/index.html b/dev/functions/latexalign/index.html index 3917aed6..91c24748 100644 --- a/dev/functions/latexalign/index.html +++ b/dev/functions/latexalign/index.html @@ -14,4 +14,4 @@ julia> latexalign(ode)
\begin{align}
 \frac{dm}{dt} &= r_{m} \cdot \left( i - m \right) \\\\
 \frac{dy}{dt} &= r_{y} \cdot \left( \frac{p_{y} \cdot i}{m} - y \right) \\\\
-\end{align}
source +\end{align}source diff --git a/dev/functions/latexarray/index.html b/dev/functions/latexarray/index.html index 430efa1a..5c4239d7 100644 --- a/dev/functions/latexarray/index.html +++ b/dev/functions/latexarray/index.html @@ -8,4 +8,4 @@ \end{array} \right] \end{equation} -"\]

source +"\]

source diff --git a/dev/functions/latexify/index.html b/dev/functions/latexify/index.html index 5b5a7086..5e4a9283 100644 --- a/dev/functions/latexify/index.html +++ b/dev/functions/latexify/index.html @@ -14,4 +14,4 @@ \end{array} \right] \end{equation} -"source +"source diff --git a/dev/functions/latexoperation/index.html b/dev/functions/latexoperation/index.html index 1b37accc..f7606cad 100644 --- a/dev/functions/latexoperation/index.html +++ b/dev/functions/latexoperation/index.html @@ -1,2 +1,2 @@ -latexoperation · Latexify.jl

latexoperation

This function is not exported.

Latexify.latexoperationFunction
latexoperation(ex::Expr, prevOp::AbstractArray)

Translate a simple operation given by ex to LaTeX maths syntax. This uses the information about the previous operations to decide if a parenthesis is needed.

source
+latexoperation · Latexify.jl

latexoperation

This function is not exported.

Latexify.latexoperationFunction
latexoperation(ex::Expr, prevOp::AbstractArray)

Translate a simple operation given by ex to LaTeX maths syntax. This uses the information about the previous operations to decide if a parenthesis is needed.

source
diff --git a/dev/functions/latexraw/index.html b/dev/functions/latexraw/index.html index 4f4ebf32..56ac2554 100644 --- a/dev/functions/latexraw/index.html +++ b/dev/functions/latexraw/index.html @@ -27,4 +27,4 @@ # output -"2 \\cdot x + x \\cdot y^{2}"source +"2 \\cdot x + x \\cdot y^{2}"source diff --git a/dev/index.html b/dev/index.html index 65e41ea7..f1230301 100644 --- a/dev/index.html +++ b/dev/index.html @@ -58,4 +58,4 @@

External rendering

While LaTeXStrings already render nicely in many IDEs or in Jupyter, they do not render in the REPL. Therefore, we provide a function render(str) which generates a standalone PDF using LuaLaTeX and opens that file in your default PDF viewer.

I have found the following syntax pretty useful:

latexify(:(x/y)) |> render

Alternatively, render(str, mime) can also be used to generate and display DVI, PNG and SVG files, which might be useful for other purposes:

latexify(:(x/y)) |> s -> render(s, MIME("image/png"))

PNG output relies on ghostscript or alternatively on dvipng: if render is called with the keyword convert = :gs, ghostcript will be used to convert the pdf output to png format.

SVG output relies on dvisvgm or alternatively on pdf2svg.

If your code requires specific packages or document classes to render correctly, you can supply those as keyword arguments:

L"\qty{1.25}{nm}" |> render(s, MIME("image/png"); documentclass="article", packages=("microtype", ("siunitx", exponent-product="\cdot")))

The arguments to these are either strings, or tuples of strings where the first one is the name of the package or class, and any further are optional arguments.

One can use Latexify together with ImageInTerminal to render equations in a sixel compatible terminal, where the size of the sixel encoded image can be controlled using dpi:

using ImageInTerminal, Latexify
 
-latexify(:(iħ * (∂Ψ(𝐫, t) / ∂t) = -ħ^2 / 2m * ΔΨ(𝐫, t) + V * Ψ(𝐫, t))) |> s -> render(s, dpi=200)

Legacy support

Latexify.jl has stopped supporting Julia versions older than 0.7. This does not mean that you cannot use Latexify with earlier versions, just that these will not get new features. Latexify.jl's release v0.4.1 was the last which supported Julia 0.6. Choose that release in the dropdown menu if you want to see that documentation.

+latexify(:(iħ * (∂Ψ(𝐫, t) / ∂t) = -ħ^2 / 2m * ΔΨ(𝐫, t) + V * Ψ(𝐫, t))) |> s -> render(s, dpi=200)

Legacy support

Latexify.jl has stopped supporting Julia versions older than 0.7. This does not mean that you cannot use Latexify with earlier versions, just that these will not get new features. Latexify.jl's release v0.4.1 was the last which supported Julia 0.6. Choose that release in the dropdown menu if you want to see that documentation.

diff --git a/dev/tutorials/Catalyst/index.html b/dev/tutorials/Catalyst/index.html index 760831cb..8d2b83d7 100644 --- a/dev/tutorials/Catalyst/index.html +++ b/dev/tutorials/Catalyst/index.html @@ -29,4 +29,4 @@ \ce{ x &->[d_{x}] \varnothing}\\ \ce{ y &->[d_{y}] \varnothing}\\ \ce{ x &<=>[{r_{b}}][{r_{u}}] y}\\ -\end{align*}\]

Available options

Align

KeywordValuesDefaultDescription
:bracketBoolfalseSurround variables with square brackets.
:cleanBoolfalseClean out 1* terms. Only useful for Catalyst (then named DiffEqBiological) versions 3.4 or below.
:convert_unicodeBooltrueConvert unicode characters to latex commands, for example α to \alpha
:double_linebreakBoolfalseAdd an extra \\ to the end of the line.
:expandBooltrueExpand functions such as hill(x, v, k, n) to their mathematical expression.
:fmtformat string""Format number output in accordance with Printf. Example: "%.2e"
:imaginary_unitString"\\mathit{i}"The symbol to use to represent the imaginary unit
:indexSymb:bracketRepresent index specification with :bracket (u[1]) or :subscript (u_1).
:mult_symbolString"\\cdot"Specify the symbol to use for the multiplication operator ("" for juxtaposition).
:noiseBoolfalseDisplay the noise function instead of the deterministic one.
:rowsIterable or symol:allWhich rows to include in the output.
:safescriptsBoolfalsePut scripts inside brackets (a{_b}), sometimes making them uglier, but making alternating scripts possible.
:separatorString" &= "Specify how to separate the left hand side and the right.
:snakecaseBoolfalseTreat underscores as literal underscores (if not, treat first underscore as subscript).
:starredBoolfalseStar the environment to prevent equation numbering.
:symbolicBoolfalseUse symbolic calculations to clean up the expression.

Arrow notation

KeywordValuesDefaultDescription
:double_linebreakBoolfalseAdd an extra \\ to the end of the line.
:expandBooltrueExpand functions such as hill(x, v, k, n) to their mathematical expression.
:mathjaxBooltrueAdd \require{mhchem} to tell MathJax to load the required module.
:starredBoolfalseStar the environment to prevent equation numbering.
+\end{align*}\]

Available options

Align

KeywordValuesDefaultDescription
:bracketBoolfalseSurround variables with square brackets.
:cleanBoolfalseClean out 1* terms. Only useful for Catalyst (then named DiffEqBiological) versions 3.4 or below.
:convert_unicodeBooltrueConvert unicode characters to latex commands, for example α to \alpha
:double_linebreakBoolfalseAdd an extra \\ to the end of the line.
:expandBooltrueExpand functions such as hill(x, v, k, n) to their mathematical expression.
:fmtformat string""Format number output in accordance with Printf. Example: "%.2e"
:imaginary_unitString"\\mathit{i}"The symbol to use to represent the imaginary unit
:indexSymb:bracketRepresent index specification with :bracket (u[1]) or :subscript (u_1).
:mult_symbolString"\\cdot"Specify the symbol to use for the multiplication operator ("" for juxtaposition).
:noiseBoolfalseDisplay the noise function instead of the deterministic one.
:rowsIterable or symol:allWhich rows to include in the output.
:safescriptsBoolfalsePut scripts inside brackets (a{_b}), sometimes making them uglier, but making alternating scripts possible.
:separatorString" &= "Specify how to separate the left hand side and the right.
:snakecaseBoolfalseTreat underscores as literal underscores (if not, treat first underscore as subscript).
:starredBoolfalseStar the environment to prevent equation numbering.
:symbolicBoolfalseUse symbolic calculations to clean up the expression.

Arrow notation

KeywordValuesDefaultDescription
:double_linebreakBoolfalseAdd an extra \\ to the end of the line.
:expandBooltrueExpand functions such as hill(x, v, k, n) to their mathematical expression.
:mathjaxBooltrueAdd \require{mhchem} to tell MathJax to load the required module.
:starredBoolfalseStar the environment to prevent equation numbering.
diff --git a/dev/tutorials/inner_workings/index.html b/dev/tutorials/inner_workings/index.html index e0ebeb6e..10016146 100644 --- a/dev/tutorials/inner_workings/index.html +++ b/dev/tutorials/inner_workings/index.html @@ -32,4 +32,4 @@ julia> println.(latexraw(arr)) x - \frac{y}{k_{10} + z} -\frac{x \cdot y \cdot z}{3} +\frac{x \cdot y \cdot z}{3} diff --git a/dev/tutorials/latexalign/index.html b/dev/tutorials/latexalign/index.html index 6bb7e869..7baf3fd2 100644 --- a/dev/tutorials/latexalign/index.html +++ b/dev/tutorials/latexalign/index.html @@ -15,4 +15,4 @@ latexalign(ode)

\begin{align} \frac{dx}{dt} &= \frac{y}{k{y} + y} - x \\ \frac{dy}{dt} &= \frac{x^{n{x}}}{k{x}^{n{x}} + x^{n_{x}}} - y \\ -\end{align}

+\end{align}

diff --git a/dev/tutorials/latexarray/index.html b/dev/tutorials/latexarray/index.html index 2f11be0d..07f4048e 100644 --- a/dev/tutorials/latexarray/index.html +++ b/dev/tutorials/latexarray/index.html @@ -19,4 +19,4 @@ \frac{3}{4}\\ \frac{x}{k{1} + x}\\ e^{- k{b} \cdot t}\\ -\end{array} \right] \end{equation}

+\end{array} \right] \end{equation}

diff --git a/dev/tutorials/latexify/index.html b/dev/tutorials/latexify/index.html index 9642d48b..e0044a07 100644 --- a/dev/tutorials/latexify/index.html +++ b/dev/tutorials/latexify/index.html @@ -14,4 +14,4 @@ 0.7 & 0.17 & 0.7 & 0.82\\ \end{array} \right] \end{equation}

You can transpose the output using the keyword argument transpose=true.

If you give two vectors as an argument, they will be displayed as the left-hand-side and right-hand-side of an align environment:

latexify(["x/y", :z], Any[2.3, 1//2])

\begin{align} \frac{x}{y} &= 2.3 \\ z &= \frac{1}{2} \\ -\end{align}

If you input a ParameterizedFunction or a ReactionNetwork from DifferentialEquations.jl you will also get an align environment. For more on this, have a look on their respective sections.

+\end{align}

If you input a ParameterizedFunction or a ReactionNetwork from DifferentialEquations.jl you will also get an align environment. For more on this, have a look on their respective sections.

diff --git a/dev/tutorials/latexinline/index.html b/dev/tutorials/latexinline/index.html index 09c369c6..26affca0 100644 --- a/dev/tutorials/latexinline/index.html +++ b/dev/tutorials/latexinline/index.html @@ -1,4 +1,4 @@ latexinline · Latexify.jl

latexinline

takes a Julia object x and returns a $\LaTeX$ formatted string. It also surrounds the output in a simple $$ environment. This works for x of many types, including expressions, which returns $\LaTeX$ code for an equation.

julia> ex = :(x-y/z)
 julia> latexinline(ex)
-L"$x - \frac{y}{z}$"

In Jupyter or Hydrogen this automatically renders as:

\[x - \frac{y}{z}\]

Among the supported types are:

  • Expressions,
  • Strings,
  • Numbers (including rational and complex),
  • Symbols,
  • Symbolic expressions from SymEngine.jl.
  • ParameterizedFunctions.

It can also take arrays, which it recurses and latexifies the elements, returning an array of latex strings.

+L"$x - \frac{y}{z}$"

In Jupyter or Hydrogen this automatically renders as:

\[x - \frac{y}{z}\]

Among the supported types are:

It can also take arrays, which it recurses and latexifies the elements, returning an array of latex strings.

diff --git a/dev/tutorials/latextabular/index.html b/dev/tutorials/latextabular/index.html index c1702064..068713cd 100644 --- a/dev/tutorials/latextabular/index.html +++ b/dev/tutorials/latextabular/index.html @@ -8,4 +8,4 @@ \end{tabular}

Unfortunately, this does not render nicely in Markdown. But you get the point.

latextabular takes two keywords, one for changing the adjustment of the columns (centered by default), and one for transposing the whole thing.

latextabular(arr; adjustment=:l, transpose=true) |> println
\begin{tabular}{ll}
 $\frac{x}{y}$ & $1.0$\\
 $y^{n}$ & $\alpha\left( x \right)$\\
-\end{tabular}
+\end{tabular} diff --git a/dev/tutorials/notebooks/index.html b/dev/tutorials/notebooks/index.html index 83958540..c4fdb397 100644 --- a/dev/tutorials/notebooks/index.html +++ b/dev/tutorials/notebooks/index.html @@ -16,4 +16,4 @@ combine manual dollar signs with `env=:raw`: \$ \hat{v} = $(latexify(v, env=:raw))\;\mathrm{m}/\mathrm{s} \$ -""")

Results

With the previously calculated $x = 125$, we can use $x = v \cdot t$ to calculate $v = \frac{x}{10}$, giving a final velocity of $12.5$.

If we want more manual control, we can combine manual dollar signs with env=:raw: $ \hat{v} = 12.5\;\mathrm{m}/\mathrm{s} $

+""")

Results

With the previously calculated $x = 125$, we can use $x = v \cdot t$ to calculate $v = \frac{x}{10}$, giving a final velocity of $12.5$.

If we want more manual control, we can combine manual dollar signs with env=:raw: $ \hat{v} = 12.5\;\mathrm{m}/\mathrm{s} $

diff --git a/dev/tutorials/parameterizedfunctions/index.html b/dev/tutorials/parameterizedfunctions/index.html index 7e92f53d..60c3eb7c 100644 --- a/dev/tutorials/parameterizedfunctions/index.html +++ b/dev/tutorials/parameterizedfunctions/index.html @@ -42,4 +42,4 @@ \frac{x^{-1 + n_{x}} \cdot n_{x}}{k_{x}^{n_{x}} + x^{n_{x}}} - \frac{x^{-1 + 2 \cdot n_{x}} \cdot n_{x}}{\left( k_{x}^{n_{x}} + x^{n_{x}} \right)^{2}} & -1 \\ \end{array} \right] -\end{equation}\]

Available options

KeywordValuesDefaultDescription
:adjustment:c for centered, :l for left, :r for right, or a vector with one such symbol per column.:cSet the adjustment of text within the table cells.
:arraystyleSymbol, String, NTuple{3, String}:squareHow to style (brackets around) arrays. Symbols correspond to predefined styles: :square, :round, :curly, :bmatrix, :pmatrix. A string will be used as an environment, with no further brackets (e.g. "vmatrix"). Tuples should be (<starting bracket>, <ending bracket>, <environment>), for instance :square corresponds to ("\n\\left[", "\\right]\n", "array").
:booktabsBoolfalseAdd top, mid and bottom booktabs rule
:bracketBoolfalseSurround variables with square brackets.
:convert_unicodeBooltrueConvert unicode characters to latex commands, for example α to \alpha
:double_linebreakBoolfalseAdd an extra \\ to the end of the line.
:escape_underscoresBoolfalsePrevent underscores from being interpreted as formatting.
:fmtformat string""Format number output in accordance with Printf. Example: "%.2e"
:headArray[]Add a header to the table. It will error if it is not of the right length (unless empty).
:imaginary_unitString"\\mathit{i}"The symbol to use to represent the imaginary unit
:indexSymb:bracketRepresent index specification with :bracket (u[1]) or :subscript (u_1).
:latexBooltrueToggle latexification of the table elements.
:mult_symbolString"\\cdot"Specify the symbol to use for the multiplication operator ("" for juxtaposition).
:rowsIterable or symol:allWhich rows to include in the output.
:safescriptsBoolfalsePut scripts inside brackets (a{_b}), sometimes making them uglier, but making alternating scripts possible.
:separatorString" &= "Specify how to separate the left hand side and the right.
:sideArray[]Add a leftmost column to the table. It will error if it is not of the right length (unless empty).
:snakecaseBoolfalseTreat underscores as literal underscores (if not, treat first underscore as subscript).
:starredBoolfalseStar the environment to prevent equation numbering.
:transposeBooltrueFlip rows for columns.
+\end{equation}\]

Available options

KeywordValuesDefaultDescription
:adjustment:c for centered, :l for left, :r for right, or a vector with one such symbol per column.:cSet the adjustment of text within the table cells.
:arraystyleSymbol, String, NTuple{3, String}:squareHow to style (brackets around) arrays. Symbols correspond to predefined styles: :square, :round, :curly, :bmatrix, :pmatrix. A string will be used as an environment, with no further brackets (e.g. "vmatrix"). Tuples should be (<starting bracket>, <ending bracket>, <environment>), for instance :square corresponds to ("\n\\left[", "\\right]\n", "array").
:booktabsBoolfalseAdd top, mid and bottom booktabs rule
:bracketBoolfalseSurround variables with square brackets.
:convert_unicodeBooltrueConvert unicode characters to latex commands, for example α to \alpha
:double_linebreakBoolfalseAdd an extra \\ to the end of the line.
:escape_underscoresBoolfalsePrevent underscores from being interpreted as formatting.
:fmtformat string""Format number output in accordance with Printf. Example: "%.2e"
:headArray[]Add a header to the table. It will error if it is not of the right length (unless empty).
:imaginary_unitString"\\mathit{i}"The symbol to use to represent the imaginary unit
:indexSymb:bracketRepresent index specification with :bracket (u[1]) or :subscript (u_1).
:latexBooltrueToggle latexification of the table elements.
:mult_symbolString"\\cdot"Specify the symbol to use for the multiplication operator ("" for juxtaposition).
:rowsIterable or symol:allWhich rows to include in the output.
:safescriptsBoolfalsePut scripts inside brackets (a{_b}), sometimes making them uglier, but making alternating scripts possible.
:separatorString" &= "Specify how to separate the left hand side and the right.
:sideArray[]Add a leftmost column to the table. It will error if it is not of the right length (unless empty).
:snakecaseBoolfalseTreat underscores as literal underscores (if not, treat first underscore as subscript).
:starredBoolfalseStar the environment to prevent equation numbering.
:transposeBooltrueFlip rows for columns.
diff --git a/dev/tutorials/recipes/index.html b/dev/tutorials/recipes/index.html index b6d2a23a..37c43100 100644 --- a/dev/tutorials/recipes/index.html +++ b/dev/tutorials/recipes/index.html @@ -42,4 +42,4 @@ end

so that the result of latexify(MyDifference(2,3)) is $3 - 2$. But right now, latexify does not know that this represents an operation, so for instance @latexify $(MyDifference(2,3))*4 gives $3 - 2 \cdot 4$, which is incorrect. The way around this is to edit the recipe:

@latexrecipe function f(m::MyDifference)
     operation := :-
     return :($(m.y) - $(m.x))
-end

Now latexify knows that MyDifference represents a subtraction, and parenthesis rules kick in: @latexify $(MyDifference(2,3))*4 gives $\left( 3 - 2 \right) \cdot 4$.

+end

Now latexify knows that MyDifference represents a subtraction, and parenthesis rules kick in: @latexify $(MyDifference(2,3))*4 gives $\left( 3 - 2 \right) \cdot 4$.

diff --git a/dev/tutorials/rendering_latex/index.html b/dev/tutorials/rendering_latex/index.html index a9e2ebd8..46838bce 100644 --- a/dev/tutorials/rendering_latex/index.html +++ b/dev/tutorials/rendering_latex/index.html @@ -1,2 +1,2 @@ -A note on rendering LaTeX · Latexify.jl

A note on rendering $\LaTeX$

Using the print function on a latexified object prints text which is suitable for copy-pasting into a $\LaTeX$ document.

However, it is often also useful to be able to render the equation inside the document that one is using to develop code. The Julia REPL does not support this, but IJulia does. So, inside a Jupyter or Pluto notebook (or if you are running Atom with Hydrogen), you can render $\LaTeX$ using

display("text/latex", x)

where x is a latex-formatted string.

This requires x to specify a $\LaTeX$ environment. latexalign and latexequation already does this, but if you want to render the result of latexify you must supply an environment (for example "\$ $x \$").

+A note on rendering LaTeX · Latexify.jl

A note on rendering $\LaTeX$

Using the print function on a latexified object prints text which is suitable for copy-pasting into a $\LaTeX$ document.

However, it is often also useful to be able to render the equation inside the document that one is using to develop code. The Julia REPL does not support this, but IJulia does. So, inside a Jupyter or Pluto notebook (or if you are running Atom with Hydrogen), you can render $\LaTeX$ using

display("text/latex", x)

where x is a latex-formatted string.

This requires x to specify a $\LaTeX$ environment. latexalign and latexequation already does this, but if you want to render the result of latexify you must supply an environment (for example "\$ $x \$").