knit_print: Print tex or matrix class as latex

Description Usage Arguments See Also Examples

Description

‘knitr_print()' will print an object with math form in the r markdown chunk or inline. It can be an tex or a matrix. In the chunk, 'results = ’asis'' option should be assigned to that chunk. Printing matrix becomes more compact than before. It will be printed math form in the inline, i.e. 'r matrix'. Here, the function does not have to be written. If in-chunk option is choosed, normal matrix form in R console will be printed.

Usage

1
2
3
4
5
## S3 method for class 'tex'
knit_print(x, inline = FALSE, ...)

## S3 method for class 'matrix'
knit_print(x, inline = FALSE, ...)

Arguments

x

'tex' or 'matrix' to be printed

inline

Choose between inline versus in-chunk. The default is set to be 'inline = FALSE', in-chunk.

...

Additional arguments passed to the S3 method.

See Also

bmatrix Printing matrix latex form by using the function

Examples

1
2
3
4
5
6
7
8
A <- matrix(1:9, nrow = 3)
library(knitr) # to use knit_print() function directly, knitr package needed
knit_print(as_tex(A))
knit_print(as_tex(A), inline = TRUE)
knit_print(A)
knit_print(A, inline = TRUE)
## In case of matrix, $`r A`$ or $$`r A`$$ works.
## vignette will provide the details.

ygeunkim/rmdtool documentation built on July 1, 2019, 1:57 p.m.