Title: | Support for the 'Mathpix' API (Image to 'LaTeX') |
---|---|
Description: | Given an image of a formula (typeset or handwritten) this package provides calls to the 'Mathpix' service to produce the 'LaTeX' code which should generate that image, and pastes it into a (e.g. an 'rmarkdown') document. See <https://docs.mathpix.com/> for full details. 'Mathpix' is an external service and use of the API is subject to their terms and conditions. |
Authors: | Jonathan Carroll [aut, cre] |
Maintainer: | Jonathan Carroll <[email protected]> |
License: | GPL (>=3) |
Version: | 0.6.0 |
Built: | 2024-10-26 03:55:36 UTC |
Source: | https://github.com/jonocarroll/mathpix |
Checks environmental variables for MATHPIX_APP_ID
and MATHPIX_APP_KEY
values.
credentials()
credentials()
a list of detected credentials (or this package's credentials)
Get a mathpix API key
get_api_key()
get_api_key()
NULL (invisibly). Used for the side-effect of opening a browser.
Given an image file location, mathpix
performs the relevant
transformations and send the data to the 'Mathpix' API, which returns a
'LaTeX' expression which should generate the typeset equation/expression in
that image. When using 'RStudio', the resulting 'LaTeX' expression is
automatically inserted into the current rmarkdown
document.
mathpix(img, insert = TRUE, retry = FALSE)
mathpix(img, insert = TRUE, retry = FALSE)
img |
image to be converted to LaTeX |
insert |
Should the resulting LaTeX block be inserted into the document (default: TRUE) |
retry |
If Mathpix is not able to process the image, should we try again with a re-processed image? |
You must save your own API key in your
environment (e.g. ~/.Renviron
) with the identifiers MATHPIX_APP_ID
and
MATHPIX_APP_KEY
. This can be tested with mathpix:::credentials()
.
(invisibly) the rmarkdown
LaTeX equation block
This calls tex_preview
to render a 'LaTeX'
expression into an image, either as a temporary file or saved to disk.
render_latex(latex, fileDir = NULL, ...)
render_latex(latex, fileDir = NULL, ...)
latex |
'LaTeX' code to be evaluated. Surround in |
fileDir |
directory in which to save the image to (defaults to '/tmp/tempfile()'). |
... |
other options to pass to |
NULL (invisibly)