R 使用LaTeX模板进行向下预订
我正在用bookdown写论文。但是这种预定格式不符合我所在大学的要求。我尝试了在twerking YAML元数据内容时提供的各种解决方案,但无法满足所需的要求 我进一步了解了在bookdown中使用LaTeX模板覆盖pandoc模板的可能性。我获得了我所在大学的LaTeX模板及其“.sty文件”,并在此处进行了讨论:。但是我得到了错误信息:!LaTeX错误:缺少\begin{document} 以下是我的索引文件中的YAML元数据:R 使用LaTeX模板进行向下预订,r,latex,bookdown,R,Latex,Bookdown,我正在用bookdown写论文。但是这种预定格式不符合我所在大学的要求。我尝试了在twerking YAML元数据内容时提供的各种解决方案,但无法满足所需的要求 我进一步了解了在bookdown中使用LaTeX模板覆盖pandoc模板的可能性。我获得了我所在大学的LaTeX模板及其“.sty文件”,并在此处进行了讨论:。但是我得到了错误信息:!LaTeX错误:缺少\begin{document} 以下是我的索引文件中的YAML元数据: --- title: "Role of Public Exp
---
title: "Role of Public Expenditure"
subtitle:
- "By"
- "Blaise Saanuo"
- "(BSc. Economics & Business Administration, Management)"
author:
- "A thesis submitted to the Department of Accounting and Finance, Kwame Nkrumah University of Science and Technology, Kumasi in partial fulfilment of the requirements for the award degree of"
- "MASTER OF PHILOSOPHY IN BUSINESS ADMINISTRATION"
- "[FINANCE]"
date: "June, 2020"
output:
bookdown::gitbook:
css: style.css
split_by: chapter
config:
toc:
collapse: section
before: |
<li><a href="...">My MPhil Thesis Report</a></li>
<li><a href="...">Blaise Boya Kuubetertii Saanuo</a></li>
after: |
<li><a href="...">Proudly published with bookdown</a></li>
toolbar:
position: fixed
search: yes
download: no
edit: no
fontsettings:
theme: white
family: sans
size: 2
sharing:
facebook: yes
twitter: yes
github: yes
all: false
bookdown::pdf_book:
includes:
in_header: preamble.tex
template: null
keep_tex: yes
latex_engine: xelatex
citation_package: none
pandoc_args: --top-level-division=chapter
mainfont: "Times New Roman"
fontsize: 12pt
papersize: a4
linestretch: 1.5
toc: true
toc-depth: 3
lof: True
lot: True
site: bookdown::bookdown_site
documentclass: book
classoption: knustthesis.tex
bibliography: ["book.bib", "packages.bib"]
csl: harvard-educational-review.csl
link-citations: yes
geometry: "left=4cm, right=2.5cm, top=2.5cm, bottom=2.5cm"
---
.sty文件的内容如下所示:
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[left=4.00cm, right=2.50cm, top=2.50cm, bottom=2.50cm]{geometry}
\newtheorem{definition}{Definition}
\newtheorem{example}{Example}[section]
\newtheorem{theorem}{Theorem}[section]
\usepackage{enumerate}
\usepackage{tabularx}
\usepackage{placeins}
\setlength{\parindent}{1.5cm}
\pagestyle{plain}
\usepackage{tocloft}
\usepackage{setspace, latexsym}
\doublespacing
\usepackage[round]{natbib}
%\bibpunct{(}{)}{;}{a}{,}{,}
\renewcommand{\chaptername}{CHAPTER}{\Large}
\usepackage{titlesec}
\titleformat{\chapter}[display]
{\normalfont\Large\bfseries\centering\Numberstring{section}}{\chaptertitlename\ \thechapter}{20pt}{\Large}
\titlespacing*{\chapter}{0pt}{0pt}{0em}
\renewcommand{\baselinestretch}{1}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\bibname}{REFERENCES}
Yihui建议我使用remotes::install\u github('rstudio/rmarkdown')
,但没有帮助
如果能帮助我用我所在大学的LaTeX模板替换pandoc模板,我将非常高兴。提前感谢您的帮助。如果您不向我们提供一个最小的可复制示例(如果您知道怎么做,您可以在Github回购中发布它),几乎不可能为您提供帮助。@YihuiXie,现在我对这个可复制示例感到茫然。我可以获得一个可复制示例的链接,或者如何发布到Github repo。谢谢。删除文档中不应共享的任何内容,确保问题仍然可以重现,压缩所有文件,并共享压缩存档。共享文件的方式有很多种(例如Dropbox)。你也可以将一个问题提交到那里并上传zip文件。谢谢你,非常感谢。我已经附上了一个我试图通过这个问题实现的示例。我用微软Word创建了它。我仍然需要帮助。谢谢你的期待。
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[left=4.00cm, right=2.50cm, top=2.50cm, bottom=2.50cm]{geometry}
\newtheorem{definition}{Definition}
\newtheorem{example}{Example}[section]
\newtheorem{theorem}{Theorem}[section]
\usepackage{enumerate}
\usepackage{tabularx}
\usepackage{placeins}
\setlength{\parindent}{1.5cm}
\pagestyle{plain}
\usepackage{tocloft}
\usepackage{setspace, latexsym}
\doublespacing
\usepackage[round]{natbib}
%\bibpunct{(}{)}{;}{a}{,}{,}
\renewcommand{\chaptername}{CHAPTER}{\Large}
\usepackage{titlesec}
\titleformat{\chapter}[display]
{\normalfont\Large\bfseries\centering\Numberstring{section}}{\chaptertitlename\ \thechapter}{20pt}{\Large}
\titlespacing*{\chapter}{0pt}{0pt}{0em}
\renewcommand{\baselinestretch}{1}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\bibname}{REFERENCES}