[R] Symbols in pdf output of flextable() via R markdown
Paul Sherliker
p@u|@@her||ker @end|ng |rom ndph@ox@@c@uk
Tue Oct 6 13:57:28 CEST 2026
I am trying to produce some tables in flextable(), sending the results to .pdf. The target format is not negotiable, and because I must produce them at volume, I can't have any human intervention after the code is run; flextable() might be negotiable, but I would be loath to try to learn something else. (both R markdown and flextable() are new to me)
My problem is a difficulty with a single character that my tables must contain - a chi in the footer. (Again, not negotiable - my bosses are not going to be persuadable.)
I have tinytex installed to allow the use of .pdf.
Sample R markdown code showing the problem (for me!) follows (the body of the table is irrelevant):
________________________________________
title: "Example"
author: "Paul Sherliker"
date: "2026-10-06"
output: pdf_document
________________________________________
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
R Markdown
```{r cars}
require(flextable)
ft <- flextable(head(cars))
ft <- add_footer_lines(ft, value=as_paragraph(
as_chunk(paste0("* The % change in log RR is displayed only if the log ",
"RR to be changed differs by >3.3 SE from zero (")),
as_chunk("c", props = fp_text_default(font.family = "Symbol")),
as_sup("2"),
as_chunk(" of 10.89; p<0.001).")))
ft
```
What I get does not have the chi character that I would expect, but instead a 'c'. Is there some way to get the chi without adding too much extra complexity, please?
Thank you for your time and, I hope, for your help.
Paul
More information about the R-help
mailing list