% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/05_content.R
\name{as_equation}
\alias{as_equation}
\title{Equation chunk}
\usage{
as_equation(x, width = 1, height = 0.2, unit = "in", props = NULL)
}
\arguments{
\item{x}{values containing the 'MathJax' equations}

\item{width, height}{size of the resulting equation}

\item{unit}{unit for width and height, one of "in", "cm", "mm".}

\item{props}{an \code{\link[=fp_text_default]{fp_text_default()}} or \code{\link[officer:fp_text]{officer::fp_text()}} object to be used to format the text.
If not specified, it will be the default value corresponding to the cell.}
}
\description{
This function is used to insert equations into
flextable.

It is used to add it to the content of a cell of the
flextable with the functions \code{\link[=compose]{compose()}}, \code{\link[=append_chunks]{append_chunks()}}
or \code{\link[=prepend_chunks]{prepend_chunks()}}.

To use this function, package 'equatags' is required;
also \code{equatags::mathjax_install()} must be executed only once
to install necessary dependencies.
}
\examples{
library(flextable)
if (require("equatags")) {
  eqs <- c(
    "(ax^2 + bx + c = 0)",
    "a \\\\ne 0",
    "x = {-b \\\\pm \\\\sqrt{b^2-4ac} \\\\over 2a}"
  )
  df <- data.frame(formula = eqs)
  df


  ft <- flextable(df)
  ft <- compose(
    x = ft, j = "formula",
    value = as_paragraph(as_equation(formula, width = 2, height = .5))
  )
  ft <- align(ft, align = "center", part = "all")
  ft <- width(ft, width = 2)
  ft
}
}
\seealso{
Other chunk elements for paragraph:
\code{\link[=as_b]{as_b()}},
\code{\link[=as_bracket]{as_bracket()}},
\code{\link[=as_chunk]{as_chunk()}},
\code{\link[=as_highlight]{as_highlight()}},
\code{\link[=as_i]{as_i()}},
\code{\link[=as_image]{as_image()}},
\code{\link[=as_qmd]{as_qmd()}},
\code{\link[=as_strike]{as_strike()}},
\code{\link[=as_sub]{as_sub()}},
\code{\link[=as_sup]{as_sup()}},
\code{\link[=as_word_field]{as_word_field()}},
\code{\link[=colorize]{colorize()}},
\code{\link[=gg_chunk]{gg_chunk()}},
\code{\link[=grid_chunk]{grid_chunk()}},
\code{\link[=hyperlink_text]{hyperlink_text()}},
\code{\link[=linerange]{linerange()}},
\code{\link[=minibar]{minibar()}},
\code{\link[=plot_chunk]{plot_chunk()}}
}
\concept{chunk elements for paragraph}
