【问题标题】:how to insert citation in a footnote of table generated with kable?如何在用 kable 生成的表格的脚注中插入引文?
【发布时间】:2020-04-24 19:53:56
【问题描述】:

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

---
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")
           )


result is:

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

【问题讨论】:

    标签: r-markdown kable


    【解决方案1】:

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

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

    【讨论】:

      【解决方案2】:

      您可以尝试使用 css -> kable_styling(extra_css = ..) 添加标题,以便修改其样式属性?只是一个想法。

      【讨论】:

      • 我不确定,但是 extra_css 是一个 html 选项,不是吗?
      猜你喜欢
      • 2013-11-30
      • 1970-01-01
      • 2016-01-28
      • 1970-01-01
      • 1970-01-01
      • 2020-05-21
      • 2020-06-27
      • 2016-07-18
      • 2021-05-16
      相关资源
      最近更新 更多