Web Analytics

beampy

⭐ 60 stars Simplified Chinese by hchauvet

Beampy Build Status codecov pypi python version pypi licence pypi download pypi beampy version

主分支的开发目前被冻结,(只会推送紧急错误修复),beampy的新版本目前在dev分支开发,该分支尚不够稳定,不建议使用……

Beampy 是一个用Python创建SVG幻灯片放映的工具,可通过HTML5显示 (已在Firefox和Chromium上测试) 幻灯片的大小固定,类似于Latex Beamer文档。

Beampy演示输出仅生成一个包含所有内容的html文件。

查看Beampy测试演示(源代码在examples/beampy_tests_modules.py*)

安装:

从Python包索引安装:

pip install beampy-slideshow

See full installation documentation

A quick example :

from beampy import *

doc = document()

with slide(): maketitle('Beampy a tool to make simple presentation', ['H. Chauvet'])

with slide('Beampy test'): text(r'\href{#0}{Go to Title}') text(r'Use LaTeX to render text and $$\sqrt{10}$$', align='center')

with slide('Beampy test with animated layers'): text(r'\href{#0}{Go to Title}')[:] text(r'Use LaTeX to render text and $$\sqrt{10}$$', align='center')[1]

save('./simple_one.html')

#To save in pdf just change the above command to the following #save('./simple_one.pdf')

beampy_presentation.html

更新日志:

0.5.5

(种子问题详见 #18), 导致 svg 中缺失部分 LaTeX 内容。

0.5.4

0.5.3

一些小修复:

0.5.2

运算,如:

``python

# 50% of the currentwidth a = rectangle(width='50%', height=10)

# width/height relative to the a element b = rectangle(width=a.width/2+'2cm', height=a.height/'10pt') `

`python

a = rectangle(width='50%', height=10)

b = rectangle(x=a.width+'2cm', y=a.height+5) `

`python

a = rectangle(x='center', y='center', width=50, height=50) b = rectangle(x='center', y='center', width=a.height+100, height=a.height+100, color='red')

# Make b appears below a b.below(a) # equivalent to a.above(b) or a.last() or b.first() `

0.5.1

0.5.0

  • 添加用于装饰组的 box 函数
  • 使用上下文管理器在演示文稿中编写文本的新实验性方法
`python with text(width=400): """ Any comment inside the context manager will be passed to the text function as input argument. This allows clearer source when writing long texts.

No more need to add an r before to protect the text passed to latex, it's now automatically added. """ `

0.4.9

0.4.8

0.4.7

图层作为 python 切片在 Beampy 模块中管理。

`python with slide('Test layers'): text('First printed on layer 0') text('Secondly printed on layer 1')[1] text('Printed from layer 2 to 3')[2,3] text('Printed on all layers')[:] text('Printed on layer 4')[4] with group(width=300)[2:]: text('Printed inside group') text('for layers 2 to end') `

0.4.6

`python with group(): text('toto') with group(width=300): text('tata')

with group(width=200): figure('./niceplot.pdf') text('nice legend') `

`python with group(width=200): figure('./niceplot.pdf') text('nice legend') # Figure and text width will be automatically set to 200 px `
  • 现在可以对自动定位的元素进行相对放置
`python t0 = text('toto') text('tata', x=t0.center + center(0), t0.bottom + 0.1) ` 视频现在可以使用外部链接(带 embedded=True*)而不是包含在html文件中。 当幻灯片显示在屏幕上时,视频从磁盘加载(注意文件路径)。

0.4.5

  • 所有文本在一个latex文件中预处理(仅调用一次Latex:提高编译速度)
  • 缓存错误修复:视频和svg现在正确缓存

0.4.4

  • 改进缓存:每个元素缓存一个文件(避免重复写缓存!)
  • Svg:添加线条和矩形命令,方便绘制线条和矩形
  • 相对定位:添加快捷方式 center(shift)、right(shift) 和 bottom(shift)
用于更改当前元素的锚点。

`python e1 = text('Somthing', x=0.2, y=0.4) e2 = text('An other thing', x=e1.left + right(0.1), y=e1.center + center(0)) ``

0.4.3

Matplotlib 图形现在可以直接传递给 figure(),或者一组 matplotlib 图形可以用 animatesvg()* 动画显示

0.4.2

添加 svg* 命令以在幻灯片中包含原始 svg

0.4.1

安装

请参见 Beampy 文档安装页面

--- Tranlated By Open Ai Tx | Last indexed: 2026-06-05 ---