我正在使用 Overleaf 制作一个 beamer 风格的演示文稿。以下代码在文本编辑器中运行良好,但无法编译。以下代码在其他文件中也能正常工作。实际上,我在其他地方(我使用 Typora)运行良好的所有方程式都无法在这里编译。
[更新]
我打开了一个新模板。无需添加新
框架,它就可以正常工作。然后我只添加了一行代码,即我的方程式。它显示
错误- 然后我删除了我的方程式。它工作正常。
我添加的唯一代码是第 40 行,它是一个等式。
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mathabx}
\usepackage{mathpazo}
\usepackage{eulervm}
\usepackage{natbib}
%% Load the markdown package
\usepackage[citations,footnotes,definitionLists,hashEnumerators,smartEllipses,tightLists=false,hybrid]{markdown}
\markdownSetup{rendererPrototypes={
link = {\href{#2}{#1}},
headingThree = {\begin{frame}\frametitle{#1}},
headingFour = {\begin{block}{#1}},
horizontalRule = {\end{block}}
}}
\usetheme{Dresden}
\usefonttheme{serif}
\usecolortheme{rose}
\title{Writing Beamer Slides with Markdown}
\author{LianTze Lim}
\institute{Overleaf}
\begin{document}
\maketitle
\frame{\tableofcontents}
\begin{markdown}
## How?
### We can do that?
$ Q_{ijt}^{A} \sim N (Q_{j}, \sigma^2_{A}) $
- Yeah to some extent, with \texttt{markdown} package :-)
- __$\hash$__ and __$\hash\hash$__ for section and subsection headers (in ToC)
- Redefine __$\hash\hash\hash$__ to start a frame and frametitle
- (Nested) bullet and numbered lists
- Text formatting (*italic*, **bold becomes italic + alerted**)
- Redefine __$\hash\hash\hash\hash$__ to start a block with title \linebreak
and __\texttt{-{}-{}-{}-}__ to end the block
- ___Compile with \texttt{-{}-shell-escape}___ (Overleaf does this already)
- (Alternative approaches: Pandoc, wikitobeamer)
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%
### Caveats
- Nothing too complicated!
- No verbatim or fragile stuff!
- No $\hash$ and \textunderscore{} characters!\linebreak
(I used `$\hash$` and `\textunderscore`)
- Can't pass options to frames
- __Need to write \texttt{\textbackslash end\string{frame\string}} manually!__
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%
%%% # and ## are still sections and subsections
# Example
## Proposed Menus
%%% ### starts a frame + frametitle
### Breakfast Menu
%%% bulleted lists as usual
- Eggs
* scrambled
* sunny-side-up
- Coffee
* Americano
* Long black
- Tea
* Darjeeling
* English Breakfast
%%% Due to the complicatedness of beamer frames, \end{frame} MUST appear in the source code itself and cannot be "hidden" in another command
\end{frame}
%%%%%%%%%%%
### Lunch Menu
- Spaghetti
* Bolognese
* Aglio olio
- Sandwiches
* Egg
* Ham
* Tuna
\end{frame}
%%%%%%%%%%%
## Budgeting
### Projected Profit
1. And the answer is...
2. $f(x)=\sum_{n=0}^\infty\frac{f^{(n)}(a)}{n!}(x-a)^n$
#. How do we _know_ that?
#. __Maths!__
\end{frame}
### Testing blocks
#### This is a block!
- Here is some content.
- Here's more contents.
---
\end{frame}
### Citations
- This is a book [@BookKey]
- This is an article [@ArticleKey]
\end{frame}
\end{markdown}
\begin{frame}
\renewcommand{\bibfont}{\footnotesize}
\frametitle{Bibliography}
\bibliographystyle{apalike}
\bibliography{refs}
\end{frame}
\end{document}
答案1
问题是_
您的公式中有多个 markdown 识别为斜体的内容。如果您想将它们用作下标,请使用带有underscores=false
选项的 markdown 包或对其进行转义。
答案 1:逃避
% !TeX program = txs:///arara
% arara: pdflatex: {synctex: on, interaction: nonstopmode, shell: yes}
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mathabx}
%% Load the markdown package
\usepackage[citations,footnotes,definitionLists,hashEnumerators,smartEllipses,tightLists=false,hybrid]{markdown}
\markdownSetup{rendererPrototypes={
link = {\href{#2}{#1}},
headingThree = {\begin{frame}\frametitle{#1}},
headingFour = {\begin{block}{#1}},
horizontalRule = {\end{block}}
}}
\begin{document}
\begin{markdown}
### We can do that?
$ {Q\_{ijt}} Q\_{j} $
\end{frame}
\end{markdown}
\end{document}
答案2:underscore=false
请注意,此解决方案_
不再能用作 markdown 元素。
% !TeX program = txs:///arara
% arara: pdflatex: {synctex: on, interaction: nonstopmode, shell: yes}
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mathabx}
%% Load the markdown package
\usepackage[citations,footnotes,definitionLists,hashEnumerators,smartEllipses,tightLists=false,hybrid,underscores=false]{markdown}
\markdownSetup{rendererPrototypes={
link = {\href{#2}{#1}},
headingThree = {\begin{frame}\frametitle{#1}},
headingFour = {\begin{block}{#1}},
horizontalRule = {\end{block}}
}}
\begin{document}
\begin{markdown}
### We can do that?
$ {Q_{ijt}} Q_{j} $
- Yeah to some extent, with \texttt{markdown} package :-)
- $\hash$ and $\hash\hash$ for section and subsection headers (in ToC)
- Redefine $\hash\hash\hash$ to start a frame and frametitle
- (Nested) bullet and numbered lists
- Text formatting (*italic*, **bold becomes italic + alerted**)
- Redefine $\hash\hash\hash\hash$ to start a block with title \linebreak
and \texttt{-{}-{}-{}-} to end the block
- Compile with \texttt{-{}-shell-escape} (Overleaf does this already)
- (Alternative approaches: Pandoc, wikitobeamer)
\end{frame}
\end{markdown}
\end{document}