首页 > 解决方案 > 如何在用 kable 生成的表格的脚注中插入引文?

问题描述

我试图在脚注(甚至表格中的任何文本)中添加引文,但它不起作用,引文文本按原样显示。我以为我需要将格式表更改为markdown而不是latex使用bookdown::pdf_document2,但两者都没有解决问题。另一种尝试是使用单独的代码块在 kable 外部创建引用文本,然后paste在内部footnote也不起作用。这是我的代码:

---
title: "scientific report"
output:
  pdf_document:
   fig_caption: true
   keep_tex: true
   number_sections: yes
   latex_engine: xelatex
csl: elsevier-with-titles.csl
bibliography: citations.bib
link-citations: true
linkcolor: blue
---



# This is an exaample


the number of the table below is [\ref{do}]

P.S. I wrote the superscript (a) manually in the xlsx file.

```{r  echo=FALSE }
library(knitr)
library(kableExtra)
library("readxl")

dfdf <-  read_excel("dyss_count.xlsx")
df <- as.data.frame(dfdf)

options(knitr.kable.NA = '')

kable(df, "latex", longtable = T, booktabs = T,escape = F ,caption = 'dosage \\label{do}',align = "c") %>%
  kable_styling(latex_options = c('repeat_header'), font_size = 7) %>%

 footnote(general ="A general footnote",


           alphabet = 'the source is @Burg_2019',

           general_title = "General: ", number_title = "Type I: ",
           alphabet_title = "Type II: ", 
           footnote_as_chunk = T, title_format = c("italic", "underline")
           )


结果是:

我将非常感谢任何有用的信息。

标签: r-markdownkable

解决方案


好吧,经过多次尝试,它与这里的传统交叉引用一起工作。所以如果其他人有同样的问题,我只是这样做:

(ref:caption) The source is [@Burg_2019]在块之外,然后在脚注内footnote(general ="A general footnote",alphabet = "(ref:caption)" )


推荐阅读