我正在尝试使用 pandoc 将普通 Markdown 文档转换为 PDF。我收到 LaTeX 错误

我正在尝试使用 pandoc 将普通 Markdown 文档转换为 PDF。我收到 LaTeX 错误

以下是完整 markdown:

---
title: Calculus hw
author: Jewel
date: April 21, 2023
---

> Question 1

$$
f(x) =
\begin{cases}
Asin(x)+Bcos(x) & \text{if } x < 0 \\
x^2+1 & \text{if } x \geqslant 0
\end{cases}
$$

For $f(x)$ to be continuous at $x=0$ ,
$RHL = LHL = f(0)$

$RHL = \lim_{x \to 0} (x^2+1)\ = 1$
$LHL = \lim_{x \to 0} (Asin(x)+Bcos(x))\ = B$
$f(0)=1 \implies B =1$

for $f$ to be differentiable at 0 :  
RHD = LHD

##### RHD at $x=0$

$\lim_{h \to 0} {\dfrac{(0+h)^2 + 1 - 0^2-1}{h}} = 0$

<!-- ##### LHD at $x=0$ : -->
$= \lim_{h \to 0} { \dfrac{Asin(0+h)+Bcos(0+h)-Asin(0)-Bcos(0)}{h}}$

$= \lim_{h \to 0} { \dfrac{Asin(h)+Bcos(h)-B}{h}}$

$= \lim_{h \to 0} { \dfrac{Asin(0+h)+Bcos(0+h)-Asin(0)-Bcos(0)}{h}}$

$= A+ B\lim_{h \to 0} { \dfrac{cos(h)-1}{h}}$

Applying L'Hopital as it is a $\dfrac{0}{0}$ case

$ = A+ \lim_{h \to 0}{-sin(h)} = A+0 = A$

so for RHD = LHD , $A=0$

 $(A,B)=(0,1)$

---  

> Question 2

Let $f(t)$ denote distance (in km) travelled in time $t$ ( in minutes) .
$ f(0)=0, f(5) = 5$ *( in question )*

$f$ is continuous , differentiable in $[0,5]$ assuming smooth motion of car

So by Mean-Value Thereom , $ \exists$ $c$ $\in [0,5] $ such that :
$$ f'(c) = \dfrac{f(5)-f(0)}{5-0} = 1 km/min = 60km/hr$$
so at some  $c \in (0,5)$ , Alice's speed $> 58km/hr$ . So she will be fined.

---

> Question 3

$f : (0,\frac{\pi}{2}) \to \mathbb{R} $.
$f(x) = sin(x)^\pi-\pi sin(x) +\pi $
I = $(0,\frac{\pi}{2})$

$f(x)$ is continuous , diffrentiable in I by algebra of continuous and differentiable functions

$f'(c) = \pi sin(c)^ {(\pi-1)} cos(c) - \pi cos(c) \leqslant 0$

Take $m,n \in I , n>m$

$ f$ is diffrentiable , continuous in [m,n] :

By Mean-Value thereom , there $ \exists c \in [m,n]$ st :

$f'(c) = \frac{f(n)-f(m)}{n-m} \leq 0 \implies f(n)< f(m)$

so $f$ is decreasing in I as we chose **any** two points in I

$f(0) = \pi , f(\frac{\pi}{2}) = 1 $
as $f$ is decreasing , its minimum value in I is 1 .
So $f > 0 $ in I





这是错误信息

PS C:\Users\jewel> cd .\OneDrive\Desktop\
PS C:\Users\jewel\OneDrive\Desktop> pandoc nmims.md -o xyz.pdf
Error producing PDF.
! Missing $ inserted.
<inserted text>
                $
l.95 \$ = A+ \lim

这是我第一次使用 markdown。我尝试在线研究该错误,但没有找到任何有用的解决方案。

答案1

最有可能的问题是某些分隔符周围有空格$。Pandoc 手册的Pandoc 的 Markdown > 数学部分,解释道:

两个$字符之间的任何内容都将被视为 TeX 数学。开头$必须紧靠其右侧有一个非空格字符,而结尾$必须紧靠其左侧有一个非空格字符,并且后面不能紧跟数字。因此,$20,000 and $30,000不会解析为数学。

所以$ f(0)=0, f(5) = 5$应该是$f(0)=0, f(5) = 5$$f > 0 $应该成为$f > 0$,等等。

相关内容