2016-06-07 41 views
0

我正在通過調用r中的降價文件來創建多個報告,在pdf文件中輸出。當一個pdf文件被創建時,我想碰撞內容並轉到實際頁面。如何將內容鏈接到Rmarkdown中的實際頁面pdf輸出

,我使用目前的代碼是:

--- 
title : "My report" 
author: "Myself" 
output: pdf_document: 
     fig_caption: yes 
     number_section: yes 
header-includes: 
     - \usepackage{wallpaper} 
     - \usepackage{\wpXoffset}{7.0cm} 
     - \usepackage{\wpYoffset}{12.5cm} 
     - \usepackage{longtable} 
     - \usepackage{hyperref}   
--- 

some text 
\newpage 

# Introduction 

\newpage 

# Mytables 


```{r, tables,echo = FALSE, results= "asis"} 

y= 1; 
for (current_table in table$tablename) 
{ 
    cat("##",current_schema); 

    for (current_subtable in subtable$field_name) 
     name_subtable = paste("###",subtable$field_name[y],"",sep = ""); 
     cat(name_subtable,"\n","&nbsp",fill = TRUE); 
    y = y + 1 
} 
``` 

即當我點擊:

介紹................. .......................... 6

我想在去第6頁

感謝您的幫助。

+1

嘗試在頭文件的pdf_document部分中添加'toc:yes'。這應該是你需要的一切。 – Benjamin

+0

嗨@Benjamin,我試過了,但是不適合我。與toc =是我的比賽有2層,而不是3,即1 2 2.1而不是1 2 2.1 2.1.1 2.1.2和Iinks不工作。我正在使用福昕閱讀器來打開文件。 – Luca1988

+0

您是否找到解決方案? –

回答

1

請嘗試以下代碼。

--- 
title : "My report" 
author: "Myself" 
output: 
    pdf_document: 
    fig_caption: yes 
    number_section: yes 
    toc: true 
header-includes: 
    - \hypersetup{colorlinks=true, linkcolor=blue} 
--- 
相關問題