【发布时间】:2019-01-27 06:18:20
【问题描述】:
我有兴趣获得在 RMarkdown 工作的 LATEX template。在过去,我可以通过实现.cls 文档来实现这一点。但这不适用于此模板。
在 LATEX 模板的主目录中,我看到了 structure.tex 和 main.tex。其中structure.tex 似乎与我过去使用的以前的.cls 文件相同。
这是我过去如何在 .Rmd 文档中实现此功能的示例
---
title: My Title Goes Here
author: "Author Name"
output:
pdf_document:
keep_tex: yes
latex_engine: xelatex
documentclass: styles/thesis-umich3 #This is where the .cls document is stored
---
这导致我收到以下错误,声称 /chaptermark 未定义。
`documentclass` searches specifically for a `.sty` file
然而在第 173 行我有:
\renewcommand{\chaptermark}[1]{\markboth{\sffamily\normalsize\bfseries\chaptername\ \thechapter.\ #1}{}} % Styling for the current chapter in the header
我已经尝试过什么
在in_header 中而不是在documentclass 中调用.tex 文档
---
title: "fNIRS Guide"
output:
pdf_document:
includes:
in_header: style/structure.tex
---
这会导致以下错误
tlmgr search --file --global "/numeric.dbx"
tlmgr search --file --global "/biblatex-dm.cfg"
! LaTeX Error: Command \chaptermark undefined.
Error: Failed to compile index.tex. See index.log for more info.
In addition: Warning messages:
1: In parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)) :
Failed to find a package that contains numeric.dbx
2: In parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)) :
Failed to find a package that contains biblatex-dm.cfg
Execution halted
我也试过打电话给documentclass
---
title: "index"
output:
pdf_document:
keep_tex: yes
latex_engine: xelatex
documentclass: style/structureSavedAsCLS
---
这也不起作用。有没有人有任何关于将此模板放入cls 以便我可以在 RMarkdown 中使用它的建议?
我知道这可能是一个非常入门级的问题,我不确定它是不是 RMarkdown 或 Latex 问题。非常感谢任何输入。
【问题讨论】:
-
您是否尝试过在文档正文的早期使用 LaTeX 命令
\input{structure.tex}? (这里假设放在文档正文中是有效的。)一般来说,LaTeX 宏是通过 Markdown 传递的。 -
向我们展示
structure.tex在main.tex中提到的位置和方式会很有帮助。
标签: latex r-markdown pdflatex