How to include symbols in flextable?

Viewed 236

Problem

I want to include symbols that represent parameters in a flextable. Following is an example:

library(flextable)


params_names <- c("T", "A_i", "b", "delta", "s_0")


params_values <- c(0.97, 3.83, 2.83, 1.29, 1.07)



data_tab <- data.frame(Parameter = params_names,
                       Value = params_values)


ft <- flextable(data_tab)

Current Output

enter image description here

Desired Output

I created the following desired output in Word:

enter image description here

What I tried

I tried using the Tex function from latex2exp package, and also the mkpar from flextable package. But I do not get the desired output. Please guide me how can I change the current output to the desired output?

1 Answers

Here is a solution:

library(flextable)
# equatags::mathjax_install()
params_names <- c("T", "A_i", "b", "\\Delta", "s_0")
params_values <- c(0.97, 3.83, 2.83, 1.29, 1.07)

data_tab <- data.frame(Parameter = params_names,
                       Value = params_values)

ft <- flextable(data_tab)
ft <- compose(ft, j = "Parameter", value = as_paragraph(as_equation(Parameter)))
ft

enter image description here

Related