Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R bookdownplus:dnd模板错误!未定义的控制序列。l、 61\超目标_R_R Markdown_Knitr_Tinytex - Fatal编程技术网

R bookdownplus:dnd模板错误!未定义的控制序列。l、 61\超目标

R bookdownplus:dnd模板错误!未定义的控制序列。l、 61\超目标,r,r-markdown,knitr,tinytex,R,R Markdown,Knitr,Tinytex,我正在使用带有dnd模板的bookdownplusR包。我使用了以下代码 library('bookdownplus') bookdownplus('dnd', render = TRUE, rproj = TRUE) 当我编译文档时,它抛出错误: ! Undefined control sequence. l.61 \hypertarget {chapter-1-bookdownplus} 任何解决问题的提示。谢谢 会话信息 sessionInfo() R

我正在使用带有
dnd
模板的
bookdownplus
R
包。我使用了以下代码

library('bookdownplus')
bookdownplus('dnd', render = TRUE, rproj = TRUE)
当我编译文档时,它抛出错误:

! Undefined control sequence.
l.61 \hypertarget
                 {chapter-1-bookdownplus}
任何解决问题的提示。谢谢

会话信息

sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.2 LTS

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] bookdownplus_1.5.6

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.1      bookdown_0.9.2  packrat_0.5.0   digest_0.6.18  
 [5] magrittr_1.5    evaluate_0.13   stringi_1.4.3   rstudioapi_0.10
 [9] rmarkdown_1.12  tools_3.5.3     stringr_1.4.0   tinytex_0.11   
[13] xfun_0.6        yaml_2.2.0      compiler_3.5.3  htmltools_0.3.6
[17] knitr_1.22.8  
已编辑

使用@Maurits Evers的建议,我使用
wget-qO-https://yihui.name/gh/tinytex/tools/install-unx.sh“| sh
Ubuntu 18.04 LTS
上。我仍然得到错误:`!未定义的控制序列。 l、 61\超目标 {第1章-bookdownplus}{%

错误:无法编译dnd.tex。有关调试提示,请参阅。`任何想法

报告错误


已报告错误。

我无法在运行MacTex的MacOS上使用
bookdownplus\u 1.5.6
重现您的问题

library('bookdownplus')
bookdownplus('dnd', render = TRUE, rproj = TRUE)
给出以下输出

#trying URL 'https://github.com/pzhaonet/bookdownplus/raw/master/upload/dnd/demo.zip'
#Content type 'application/zip' length 3325858 bytes (3.2 MB)
#==================================================
#downloaded 3.2 MB
#
#
#
#processing file: dnd.Rmd
#  |......................                                           |  33%
#  ordinary text without R code
#
#  |...........................................                      |  67%
#label: unnamed-chunk-1 (with options)
#List of 2
# $ type  : chr "quotebox"
# $ engine: chr "block"
#
#  |.................................................................| 100%
#  ordinary text without R code
#
#
#output file: dnd.knit.md
#
#/usr/local/bin/pandoc +RTS -K512m -RTS dnd.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output dnd.tex --table-of-contents --toc-depth 3 --template tex/template_dnd_dev.tex --number-sections --highlight-style tango --latex-engine pdflatex --natbib --top-level-division=chapter --variable tables=yes --standalone
#
#Output created: _book/dnd.pdf

我认为问题可能与您的LaTeX环境不完整/缺失有关。您看到的错误表明您缺少。根据您的操作系统,我相信大多数(全部?)标准(La)TeX发行版(例如MacTex/TeX在MacOS上运行,MiKTeX在Windows上运行,…)默认情况下包括
hyperref
。因此,要做的第一件事是确保您的操作系统上有一个工作的TeX发行版。然后尝试重新编译
bookdownplus
示例


确保你有一个功能性的TeX分布 让我们创建一个包含以下内容的示例LaTeX文件
test.tex

\documentclass{article}
\usepackage{hyperref}
\begin{document}
\href{https://www.r-project.org}{The R Project for Statistical Computing}
\end{document}
将文件存储在一个文件夹中,并从该文件夹中打开一个R终端,用

tinytex::pdflatex("test.tex")

输出应该是一个PDF文件
test.PDF

您的错误消息说要运行
get\u templates
。是吗?是的,它显示有一个名为“dnd”的模板,而不是一个名为“dnd\u dev”的模板。这似乎是一个很容易修复的打字错误。感谢@camille的评论。这些命令是从中获取的。但是,在将
dnd_dev
更改为
dnd
后,这些命令仍然有效。但是,它没有正确编译并抛出错误:
!未定义的控制序列。l.61\hypertarget{chapter-1-bookdownplus}
。有什么想法和提示吗?我不知道,但如果问题不再是关于你的打字错误,你可能至少应该编辑问题和标题,以反映问题的实际内容about@camille:编辑问题和标题以反映问题。我可以在Ubuntu18.10上复制,运行TexLive,使用bookdownplus版本1.5.6x文件缺少preamble命令\usepackage{hyperref}。如果我手动将其添加到tex文件中,它会编译得很好。看起来像是bookdownplus错误,他们忘记了将此语句包含在此VersionTanks@Maurits Evers上的模板中以供您回复。我使用
wget-qO-"https://yihui.name/gh/tinytex/tools/install-unx.sh“|sh
Ubuntu 18.04 LTS
上。我仍然得到错误:
!未定义的控制序列。l.61\hypertarget{chapter-1-bookdownplus}”{%错误:未能编译dnd.tex。请参阅https://yihui.name/tinytex/r/#debugging 调试提示。
有什么想法吗。@MYaseen208是否按照链接中的说明安装了
tinytex
install.packages('tinytex');tinytex::install_tinytex()
这看起来您仍然没有必要的TeX发行版。@MYaseen208我编辑了我的帖子,展示了如何通过编译示例LaTeX文档来确认您安装了有效的TeX发行版。请看一看。感谢@Maurits Evers的帮助。是的,
tinytex::pdflatex(“test.TeX”)
工作正常。