maxima.engine: 'knitr' maxima engine

View source: R/engine.R

maxima.engineR Documentation

knitr maxima engine

Description

Functions to process Maxima code chunks by knitr.

Usage

maxima.engine(options)

maxima.inline(command)

Arguments

options

named list of knitr options. Supported options are echo, eval, include and output.var. To change the output format of the Maxima engine set the option maxima.options(engine.format) to either "linear" (default), "ascii", "latex" or "mathml".

command

character string containing the Maxima command to be executed.

Details

Upon attachment, i.e. library(rim) function maxima.engine is registered as a knitr engine. Thus, maxima.engine() is called by knit() to evaluate Maxima code chunks. When called upon the first code chunk of a document it starts Maxima in a separate process in server mode. This means that a single Maxima session is used for all Maxima code chunks of an RMarkdown document. Inputs and outputs can thus be used across chunks (e.g. by using Maxima reference labels). maxima.options(engine.format = ..., engine.label = ...) configures the output format and whether or not output reference labels should be printed.

The purpose of maxima.inline is to insert Maxima results as inline text, i.e. on the same line of the preceding text, if it is actually written on the same line of the RMarkdown file. It uses the same running Maxima process as maxima.engine. The output format for inline results can be configured separately from the settings of maxima.engine, i.e. maxima.options(inline.format = ..., inline.label = ...).

Value

This functions prints the resulting output from maxima together with it's code

character string containing the maxima result printed according options set by maxima.options(inline.format = ..., inline.label = ...).

Functions

  • maxima.inline(): This function can be used to insert maxima outputs as inline.

Examples

if (maxima.isInstalled()) {
  maxima.inline("2+2;")
  maxima.stop(engine = TRUE)
}

rim documentation built on Aug. 24, 2023, 5:09 p.m.