[R] [VON EXTERN] Symbols in pdf output of flextable() via R markdown
Eik Vettorazzi
E@Vettor@zz| @end|ng |rom uke@de
Wed Oct 7 14:50:02 CEST 2026
Hi Paul,
I cannot replicate the error; my TeX installation (MiKTeX) rendered
everything fine.
A few things you might try:
Check if "Symbol" is available in R:
systemfonts::system_fonts() |> dplyr::filter(family=="Symbol")
If you are not bound to use pdfLaTeX and can switch to XeLatex (for
instance, by adding `% !TeX program = XeLaTeX` as first line) you can
use native utf-8 symbols directly:
add_footer_lines(ft, value=as_paragraph("𝜒² of 10.89 "))
Finally, you could use as_equation from flextable,
which avoids the cumbersome `as_chunk("c", props = ...` at all:
as_equation("\\chi^2")
Best Eik
Am 06.10.2026 um 13:57 schrieb Paul Sherliker via R-help:
> 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
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Eik Vettorazzi
Universitätsklinikum Hamburg-Eppendorf
Institut für Medizinische Biometrie und Epidemiologie
Christoph-Probst-Weg 1
4. Obergeschoss, Raum 04.1.021.1
20246 Hamburg
Telefon: +49 (0) 40 7410 - 58243
Web: www.uke.de/imbe
--
_____________________________________________________________________
Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen Rechts; Gerichtsstand: Hamburg | www.uke.de
Vorstandsmitglieder: Prof. Dr. Christian Gerloff (Vorsitzender), Joachim Prölß, Prof. Dr. Blanche Schwappach-Pignataro, Corinna Wriedt
_____________________________________________________________________
More information about the R-help
mailing list