Search code examples
rr-markdownkableextra

Degree symbol in kableExtra


I'm trying to put the symbol of degree (º) in a table made it with kableExtra. The symbol which I obtained is a like in the image:

enter image description here

I need just the symbol (º) without the line below, like this:

enter image description here

I've tried with $^\circ$ and with \\degree, with both my execution is halted.

Here are my options:

---
output: 
 pdf_document:
  number_sections: true
  latex_engine: xelatex
 template: NULL
 word_document: default
geometry: left=2cm,right= 2 cm,top=2 cm, bottom=2 cm
papersize: a4
header-includes: 
 - \usepackage{amsmath} 
 - \usepackage{booktabs}
 - \usepackage{pdflscape}
 - \usepackage[justification=justified,labelfont=bf,singlelinecheck=false, font = small]{caption}
 - \usepackage{flafter}
 - \usepackage{float}
 - \usepackage{gensymb}
bibliography: library_tesis.bib
csl: apa7.csl
fontsize: 12 pt
indent: true
linestretch: 1.5

And here is the code for the table

atm <- read_csv("tablas/atmosfericos.csv") %>%
 select(-Cueva)

kbl(atm, "latex",
 caption = "Atmopheric conditions.\\label{tbl:atm}",
 col.names = c("Punto",
  "CO\\textsubscript{2} (ppm)",
  "T (ºC)",
  "RH"),
 align = c("l", "c", "c","c"),
 label = "atm",
 escape = FALSE, 
 booktabs = TRUE, 
 linesep ="") %>%
 row_spec(0, bold = T) %>%
 kable_paper("hover", full_width = F) %>%
 pack_rows("Cueva de la Iglesia", 1, 6) %>%
 pack_rows("Sistema de Tubo de Lava de Chimalacatepec", 7,12) %>%
 kable_styling(latex_options = "hold_position")
 

Thank you very much for your help.


Solution

  • The command is \\textdegree{}.

    Example:

    kbl(data, 
    "latex",
     col.names = c("Primer",
      "Sequences 5'-3'",
      "Amplicon (pb)",
      "T\\textsubscript{M}(\\textdegree{}C)*",
      "Referencia"),
     align = c("l", "l", "c","c", "c"),
     label = "primers",
     escape= FALSE, 
     booktabs= TRUE, 
     linesep="")
    
    

    Result:

    enter image description here