我在每个页面上定制了带有徽标的rmarkdown文档,YAML标头output: pdf_document: includes: in_header: header.tex
命令。当我包含summary(cars)
命令时,返回错误:
!包tikz错误:对不起,有些包重新定义了数学的含义 - 模式美元符号。这与tikz及其calc库和migh不兼容 导致不可恢复的错误。
使用knitr :: kable生成汇总表没有问题,kable(summary(cars))
使用我的自定义格式正常工作。
我的header.tex:
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{background}
\backgroundsetup{angle=0,
scale=.45,
position=current page.north east,
contents={
\begin{tikzpicture}[remember picture, overlay]
\node [anchor=north east, inner sep=20pt] at (current page.north east)
{\includegraphics{logo.png}};
\end{tikzpicture}
}
}
非常感谢任何能够提供解决方案或解决方案灵感的帮助 添加会话信息:
R version 3.4.4 (2018-03-15)
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=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] stargazer_5.2.1 xtable_1.8-2 kableExtra_0.7.0
gridExtra_2.3 RGA_0.4.2
[6] googleAuthR_0.6.2 httr_1.3.1 AnomalyDetection_1.0 knitr_1.20 RColorBrewer_1.1-2
[11] tmaptools_1.2-3 tmap_1.11-1 countrycode_1.00.0 forcats_0.3.0 stringr_1.3.0
[16] dplyr_0.7.4 purrr_0.2.4 readr_1.1.1 tidyr_0.8.0 tibble_1.4.2
[21] ggplot2_2.2.1 tidyverse_1.2.1
loaded via a namespace (and not attached):
[1] colorspace_1.3-2 deldir_0.1-14 class_7.3-14 gdalUtils_2.0.1.7 leaflet_1.1.0
[6] rgdal_1.2-18 rprojroot_1.3-2 satellite_1.0.1 base64enc_0.1-3 dichromat_2.0-0
[11] rstudioapi_0.7 lubridate_1.7.2 xml2_1.2.0 codetools_0.2-15 splines_3.4.4
[16] R.methodsS3_1.7.1 mnormt_1.5-5 geojsonlint_0.2.0 jsonlite_1.5 broom_0.4.3
[21] png_0.1-7 R.oo_1.21.0 rgeos_0.3-26 shiny_1.0.5 compiler_3.4.4
[26] backports_1.1.2 mapview_2.3.0 assertthat_0.2.0 Matrix_1.2-12 lazyeval_0.2.1
[31] cli_1.0.0 htmltools_0.3.6 tools_3.4.4 bindrcpp_0.2 coda_0.19-1
[36] gtable_0.2.0 glue_1.2.0 reshape2_1.4.3 gmodels_2.16.2 V8_1.5
[41] Rcpp_0.12.16 sunburstR_2.0.0 cellranger_1.1.0 raster_2.6-7 spdep_0.7-4
[46] gdata_2.18.0 nlme_3.1-131.1 udunits2_0.13 iterators_1.0.9 crosstalk_1.0.0
[51] psych_1.7.8 rvest_0.3.2 mime_0.5 gtools_3.5.0 devtools_1.13.5
[56] XML_3.98-1.10 LearnBayes_2.15.1 MASS_7.3-49 scales_0.5.0 hms_0.4.2
[61] parallel_3.4.4 expm_0.999-2 yaml_2.1.18 curl_3.1 memoise_1.1.0
[66] geosphere_1.5-7 stringi_1.1.7 jsonvalidate_1.0.0 highr_0.6 foreach_1.4.4
[71] e1071_1.6-8 boot_1.3-20 spData_0.2.8.1 rlang_0.2.0 pkgconfig_2.0.1
[76] bitops_1.0-6 evaluate_0.10.1 lattice_0.20-35 sf_0.6-0 bindr_0.1.1
[81] labeling_0.3 htmlwidgets_1.0 osmar_1.1-7 plyr_1.8.4 magrittr_1.5
[86] R6_2.2.2 DBI_0.8 pillar_1.2.1 haven_1.1.1 foreign_0.8-69
[91] withr_2.1.2 units_0.5-1 RCurl_1.95-4.10 sp_1.2-7 modelr_0.1.1
[96] crayon_1.3.4 rmapshaper_0.3.0 utf8_1.1.3 KernSmooth_2.23-15 rmarkdown_1.9
[101] grid_3.4.4 readxl_1.0.0 webshot_0.5.0 digest_0.6.15 classInt_0.1-24
[106] httpuv_1.3.6.2 R.utils_2.6.0 openssl_1.0.1 stats4_3.4.4 munsell_0.4.3
[111] viridisLite_0.3.0
和YAML标题:
title: Title
author: "XXX"
date: "`r format(Sys.time(), '%x')`"
output:
pdf_document:
keep_tex: yes
latex_engine: pdflatex
includes:
in_header: header.tex
word_document: default
geometry: margin = 1in
fontsize: 11pt
P.S。,当我使用header-includes
命令和自定义文档布局与乳胶包fancyhdr
时,一切运行良好并成功编译为pdf。