生成LaTex/Beamer文件的预处理器
beamer-gen的Python项目详细描述
光束发生器
预处理器,从更紧凑的语言生成乳胶束代码。
新的子语言的需求是:
- 紧凑性:以便尽可能少地删除类型格式信息,
- 表现力:允许用清晰和简短的语法格式化大多数波束器帧, 柔韧性:不含太多的乳胶。
在tex环境中,被封装在\begin{env}
和\end{env}
标记中,这使得它明确无误,但需要复制环境的名称。
在这里,为了紧凑,我们选择使用缩进作为环境标记。
因此,压痕是重要的和强制性的。
功能
beamer_gen
代码具有以下当前乳胶/光束器功能的快捷方式:
- 节,使用
s Section title
, - 帧,使用
+ Frame title
, - 块,使用
b Block title
, - 项,在自动创建环境时使用
- item text
, - 列,在自动创建环境时使用
c{ratio}
(相对于\columnwidth
的比率, - 数字,使用
f{ratio}{filename}
(相对于\columnwidth
的比率)。
帧、块、图形和项支持beamer overlay指令(<...>
)。
帧也可以有选项([...]
),在这种情况下,它们必须在可选的beamer指令之后指定(例如,+<+->[fragile] Title
)。
列还可以有一个放置选项(例如[c]
),需要在大小之前指定该选项。
其他的一切都是逐字复制的。
用法
用法很简单:
usage: beamer_gen.py [-h] filename [filename ...]
Generate LaTeX/beamer files from a stub.
positional arguments:
filename name of the file to be processed.
optional arguments:
-h, --help show this help message and exit
通过创建一个新文件来处理每个文件,该文件的原始扩展名替换为.tex
。
示例
以下来源:
+[allowframebreaks] Example 1
b<+-> Example block
- first item
- subitem
- other subitem
- second item
b<+-> second block
c{0.4}
f<3->{0.8}{figure1.png}
c[t]{0.6}
Some generic text:
- and items
翻译成:
\begin{frame}[allowframebreaks] \frametitle{Example 1}\begin{block}<+->{Example block}\begin{itemize}\item first item \begin{itemize}\item subitem \item other subitem \end{itemize}\item second item \end{itemize}\end{block}\begin{block}<+->{second block}\begin{columns}\column{0.4\columnwidth}\includegraphics<3->[width=0.8\columnwidth]{figure1.png}\column[t]{0.6\columnwidth} Some generic text: \begin{itemize}\item and items \end{itemize}\end{columns}\end{block}\end{frame}