首页 > 解决方案 > 如何解决 titlesec 中的链接问题?

问题描述

按照这个答案,我正在使用titlesec包来获取我的无衬线标题。

看起来很漂亮;但是,使用rmarkdown. 书签很混乱,文档中的链接也不能正常工作(即单击书签不会正确跳转到标题)。

我正在显示 Acrobat Reader 书签的图像,其中 titlesec 行已激活(左)并已注释掉(右):

在此处输入图像描述

有什么建议么?我正在使用 MiKTeX。

MWE:

---
output: pdf_document
subparagraph: yes
header-includes:
- \usepackage{lipsum}  # produces dummy text
- \usepackage[sf,bf]{titlesec}  # titlesec line
---

# Header1
\lipsum[1]

## Header1.1
\lipsum[1-7]

### Header1.1.1
\lipsum[1-7]

## Header1.2
\lipsum[1-7]

### Header1.2.1
\lipsum[1-7]

会话信息:

> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=German_Switzerland.1252  LC_CTYPE=German_Switzerland.1252   
[3] LC_MONETARY=German_Switzerland.1252 LC_NUMERIC=C                       
[5] LC_TIME=English_United States.1252 

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.19      rstudioapi_0.8    knitr_1.20        magrittr_1.5      hms_0.4.2        
 [6] devtools_1.13.6   munsell_0.5.0     colorspace_1.3-2  rlang_0.2.2       tools_3.5.1      
[11] data.table_1.11.8 rio_0.5.10        withr_2.1.2       htmltools_0.3.6   readxl_1.1.0     
[16] yaml_2.2.0        rprojroot_1.3-2   digest_0.6.18     tibble_1.4.2      crayon_1.3.4     
[21] zip_1.0.0         curl_3.2          memoise_1.1.0     evaluate_0.12     haven_1.1.2      
[26] rmarkdown_1.10    openxlsx_4.1.0    cellranger_1.1.0  compiler_3.5.1    pillar_1.3.0     
[31] scales_1.0.0      forcats_0.3.0     backports_1.1.2   foreign_0.8-71    pkgconfig_2.0.2 

标签: rlatexr-markdownknitrpandoc

解决方案


推荐阅读