R Markdown 中未定义 Tex Proof 环境,生成的 Tex 文件中未定义 amsthm

2024-03-29

[编辑以提供更多信息]

我正在使用以下 R markdown 文件来生成以下 Tex 文件。我在 .rmd 标头中包含 amsthm,它生成一个没有 amsthm 的 Tex 文件。因此,在编译期间并未定义证明环境。

这是我的 .rmd 文件:

---
title: Real Analysis Notes 01
header_includes:
- \usepackage{amsthm}
 output:
  pdf_document:
   keep_tex: true
---

This is a test file.

\begin{proof}
This is a proof.
\end{proof}

编译时给出以下输出:

> require(rmarkdown); render('RA01-notes.rmd')
Loading required package: rmarkdown


processing file: RA01-notes.rmd
  |.................................................................| 100%
  ordinary text without R code


output file: RA01-notes.knit.md

/usr/bin/pandoc +RTS -K512m -RTS RA01-notes.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output RA01-notes.tex --template /usr/lib/R/library/rmarkdown/rmd/latex/default-1.17.0.2.tex --highlight-style tango --pdf-engine pdflatex --variable graphics=yes --variable 'geometry:margin=1in' --variable 'compact-title:yes' 
! LaTeX Error: Environment proof undefined.

Error: Failed to compile RA01-notes.tex. See RA01-notes.log for more info.
Execution halted

shell returned 1

生成这个 Tex 文件:

\documentclass[]{article}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
\else % if luatex or xelatex
  \ifxetex
    \usepackage{mathspec}
  \else
    \usepackage{fontspec}
  \fi
  \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
\fi
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\usepackage[margin=1in]{geometry}
\usepackage{hyperref}
\hypersetup{unicode=true,
            pdftitle={Real Analysis Notes 01},
            pdfborder={0 0 0},
            breaklinks=true}
\urlstyle{same}  % don't use monospace font for urls
\usepackage{graphicx,grffile}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
}
\setlength{\emergencystretch}{3em}  % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{0}
% Redefines (sub)paragraphs to behave more like sections
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi

%%% Use protect on footnotes to avoid problems with footnotes in titles
\let\rmarkdownfootnote\footnote%
\def\footnote{\protect\rmarkdownfootnote}

%%% Change title format to be more compact
\usepackage{titling}

% Create subtitle command for use in maketitle
\newcommand{\subtitle}[1]{
  \posttitle{
    \begin{center}\large#1\end{center}
    }
}

\setlength{\droptitle}{-2em}

  \title{Real Analysis Notes 01}
    \pretitle{\vspace{\droptitle}\centering\huge}
  \posttitle{\par}
    \author{}
    \preauthor{}\postauthor{}
    \date{}
    \predate{}\postdate{}


\begin{document}
\maketitle

This is a test file.

\begin{proof}
This is a proof.
\end{proof}


\end{document}

The pandoc选项是header-includes(连字符而不是下划线)。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

R Markdown 中未定义 Tex Proof 环境,生成的 Tex 文件中未定义 amsthm 的相关文章

  • 在 Bookdown 中呈现附录图号

    Bookdown 是一个很棒的软件包 我期待看到它如何发展 但现在我在渲染数字方面遇到了麻烦pdf document2附录中的数字时的格式 具体来说 当带有标题的图形位于附录中时 图形编号应采用 A 1 A 2 B 1 B 2 等形式 但图
  • 从 data.frame 创建新列

    我有一个长格式的数据集 其中测量 时间 嵌套在 Networkpartners NP 中 而 Networkpartners NP 又嵌套在人员 ID 中 下面是它的示例 真实数据集有数千行 ID NP Time Outcome 1 11
  • 使用 ggplot_build 和 ggplot_gtable 后使用 ggsave 保存图形

    我正在通过更改 ggplot build 生成的数据来修改使用 ggplot 构建的图表 原因类似于包括 geom boxplot 中填充美学中使用的缺失因子水平的空间 https stackoverflow com questions 1
  • 使用 gbuffer 在 R 中缓冲(地理)空间点

    我正在尝试缓冲数据集中半径为 100 公里的点 我正在使用该功能gBuffer从包装中rgeos 这是我到目前为止所拥有的 head sampledf postalcode lat lon city province 1 A0A0A0 47
  • 使用facet时ggplot2控制每行的面板数量?

    Is it possible to control the number of panels per row in a ggplot I can only get an equal number of panels on each row
  • 使用列表中的数据框:删除变量,添加新变量

    定义一个列表dats有两个数据框 df1 and df2 dats lt list df1 data frame a sample 1 3 b sample 11 13 df2 data frame a sample 1 3 b sampl
  • 从 Cox PH 模型预测概率

    我正在尝试使用 cox 模型来预测时间 称为停止 3 后失败的概率 bladder1 lt bladder bladder enum lt 5 coxmodel coxph Surv stop event rx size number cl
  • 网页抓取(R 语言?)

    我想获取中间栏中的公司名称this http www consumercomplaints in bysubcategory mobile service providers page 1 html页面 以蓝色粗体书写 以及登记投诉者的位置
  • 为什么 rbind 会抛出警告

    这与是否有更优雅的方法将不规则的数据转换为整洁的数据框 https stackoverflow com questions 25102617 are there more elegant ways to transform ragged d
  • R 的 dplyr 切片中的奇怪行为

    打电话时slice df i 在 R 的 dplyr 包中 如果我要求的行索引不存在 nrows lt i 它似乎返回除组中的第一行之外的所有行 就像我调用的那样slice df 1 例如 library dplyr c1 lt c a b
  • 为 ggplot 定义新的尺度轴变换

    我正在尝试创建一个squared使用 y 轴变换scales trans new但遇到错误 MWE data data frame x 1 10 y runif 10 z rnorm 10 10 library ggplot2 ggplot
  • 根据列A:列B范围内的值查找数据框中的相应行[重复]

    这个问题在这里已经有答案了 我有一个 data frame 和一个向量 例如 df data frame id 1 3 start c 1 1000 16000 end c 100 1100 16100 info c a b c vec c
  • 我可以在 R 中并行读取 1 个大 CSV 文件吗? [复制]

    这个问题在这里已经有答案了 我有一个很大的 csv 文件 需要很长时间才能阅读 我可以使用 parallel 或相关的包在 R 中并行读取此内容吗 我尝试过使用 mclapply 但它不起作用 根据OP的评论 fread来自data tab
  • R中的等值线绘图问题

    编辑 我已经意识到问题的根源 我只有我有数据的县的计数信息 该信息少于我正在绘制的区域中的县数量 按理说 问题代码行在这里 mapnames lt map county plot FALSE 4 names colorsmatched lt
  • 计算数据框中每一行的 R 条件运行总和

    我想创建一个等于 data Rating 的运行总和的列 假设第 3 列和第 4 列中有两个条件成立 特别是 data Year 换句话说 这应该计算直到上一年为止每个 id 的评分累积总和 它应该对数据框中的每一行 大约 50 000 行
  • 如何将环境变量传递给shinyapps

    我想将安全参数传递给shinyapps io部署 以便我的应用程序可以通过以下方式获取它们 Sys getenv PASSWORD X 我找不到任何相关内容deployApp函数在rsconnect包裹 您可以使用Renviron网站 or
  • plot xts if (on == "years") { 中的错误:缺少 TRUE/FALSE 需要的值

    我正在尝试绘制 xts 对象 但出现有关年份的错误 xts 对象只有一个数值和一个 POSIXct 索引 下面的代码显示了 xts 和尝试绘图时的错误 关于需要对 xts 对象做什么才能正确绘制的任何想法 xTest lt as xts 3
  • 访问动态创建的 Shiny 模块的返回值

    我正在寻找构建一个闪亮的应用程序 它动态创建返回简单表单的模块 通过 callmodule 我有两个未解决的问题 希望得到一些指导 首先 当向用户提供多个表单 通过单击按钮 时 先前呈现的表单上的值将恢复为默认值 如何停止这种行为 以便值保
  • svyby比例的置信区间

    是否存在创建置信区间的现有函数 从一个svyby比例对象 在我的例子中 是一个二进制项目的交叉表survey包裹 我经常比较各组之间的比例 如果有一个可以提取置信区间的函数 使用调查函数svyciprop而不是confint 下面的示例显示
  • 如何在RcppParallel中调用用户定义的函数?

    受到文章的启发http gallery rcpp org articles parallel distance matrix http gallery rcpp org articles parallel distance matrix 我

随机推荐