如何在R Markdown文章中创建表格内部跳转链接?
The [@table_1] syntax you're using is designed for bibliographic citations (like referencing a paper in your references list), not cross-referencing tables or figures in your document. That's why it's not working. Here's how to set up clickable internal links to your table:
Step 1: Add a Label to Your Table
When creating your table with kable(), include a label parameter. This gives LaTeX (the engine behind PDF output) a target to link to. It's a good convention to prefix table labels with tab: for clarity, but it's not strictly required.
Modify your table chunk like this:
{r echo=F, warning=F, message=F} df1 <- tibble(column1= 1:10, column2=11:20) table_1 <- df1 %>% kable("latex", booktabs=T, caption = "example table", label = "tab:table_1") %>% kable_styling(latex_options = "hold_position") table_1
Step 2: Reference the Table in Your Text
In the "Empirical Results" section, use LaTeX's \ref{} command to link to the table's label. If you want the reference to automatically include the word "Table" (instead of just the number), use \autoref{} instead (this requires the hyperref package, which is included by default in pdf_document).
Update your text to either:
In \ref{tab:table_1} you can see something....
Or for automatic "Table" prefix:
In \autoref{tab:table_1} you can see something....
When you knit your document to PDF, clicking the reference will jump directly to the table.
内容的提问来源于stack exchange,提问作者TobKel

