A Simple Tool for Generating Tex
Project description
A Simple Python Toolbox for Generating Latex from Markdown txt
Installation:
pip install pydbeamer -i https://www.pypi.org/simple/
There are three ways to generating latex files
- write the like-markdown file for generating a document, which is simpler
- write the objects for building a document, which is more flexible
- combine the obove two methods
V0.3.9
1. write the like-markdown file for generating a document, which is simpler
结果示例
参考md文件
# 标题1, 副标题1
# 标题2, 副标题2
## Section1
--- 当前Section第一页幻灯片
```teal
title: 这是颜色为teal的一个Box
1. # title为可选项, 一个井号表示最大号字体
2. ##b 注意开始和结束的标识, 两个井号表示次大号字体, b表示蓝色, 有b, r, k, p四种颜色可选
--- 当前Section第二页幻灯片
title: 这是一段代码
```python
def sum(a, b):
return a + b
## Section2
--- 第一页幻灯片
||
lratio: 0.48
```teal
title: 这是一个分栏显示
para: 表示一个段落, 与其他的区分
- 表示列表项1
- 表示接下来的列表项
|
title: 这是右边栏
- 列表项1
- 列表项2
||
```python
filename = "demo.md" # 上面的markdown语句对应的文件
f = open(filename)
txt = f.read()
LatexFile(txt)
2. write the objects for building a document, which is more flexible
from pydbeamer.pydbeamer import *
title0 = TitlePage("标题1", "副标题1")
title1 = TitlePage("标题2", "副标题2")
#一般可以在各个字符串里输入需要的latex语句
doc = Beamer(title0, title1) #可以有一个标题页或多个标题页
s = Section("Section1", parent = doc)
f = Frame("当前Section第一页幻灯片", parent = s)
b = tealBox('这是颜色为teal的一个Box', parent = f)
l1 = "第一行示例"
l2 = "第二行示例"
nl = NumList(*l(2), parent = b)
f = Frame("当前Section第二页幻灯片", parent = s)
b = bgreenBox('这是一段代码', parent = f)
code = '''
def sum(a, b):
return a + b
'''
pb = PythonBlock(code, "demo", head = False, parent = b)
#####################################################
s = Section("Section2", parent = doc)
f = Frame("第一页幻灯片", parent = s)
cols = Columns(parent = f, no = 2)
b = tealBox('这是一个分栏显示', parent = cols.left)
Para("表示一个段落, 与其他的区分", parent = b)
l1 = '表示列表项1'
l2 = '表示接下来的列表项'
nl = ItemList(*l(2), parent = b)
b = tealBox('这是右边栏', parent = cols.right)
i1 = "列表项1"
i2 = "列表项2"
il = ItemList(*i(2), parent = b)
doc.build() #生成文档
查看详细的函数和类的说明
import pydbeamer.pydbeamer as P
help(P)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pydbeamer-0.4.2.tar.gz
(40.1 kB
view details)
Built Distribution
pydbeamer-0.4.2-py3-none-any.whl
(40.0 kB
view details)
File details
Details for the file pydbeamer-0.4.2.tar.gz
.
File metadata
- Download URL: pydbeamer-0.4.2.tar.gz
- Upload date:
- Size: 40.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41d93fbbadce8db8f05530aac2747d574798811acfe5862c25ff729943c1a93e |
|
MD5 | 303b222b2e4f867cc90a91a409d74bdd |
|
BLAKE2b-256 | 886310f332a698751269bfcf509e948b41149e80f7b05bb76d4e1df1b517d56e |
File details
Details for the file pydbeamer-0.4.2-py3-none-any.whl
.
File metadata
- Download URL: pydbeamer-0.4.2-py3-none-any.whl
- Upload date:
- Size: 40.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b63d3951869bd1147fe00373c9805e4c99d39dfe083ce573d9ec7e9a556b8dd |
|
MD5 | 2558f7ef378b944d9ebe2404daec9c59 |
|
BLAKE2b-256 | 89301ab4b0ad1b6a4dd1b1c75587d44aa2c436fbbb584e8da42d1f0ebae20c79 |