Giter Site home page Giter Site logo

beamer2pptx's Introduction

beamer2pptx

A python script to convert Beamer (latex) presentations to PowerPoint presentations

Goal

the goal of this script is to help automatize the process of converting a Beamer Presentation (Latex) into a microsoft powerpoint. It parses the file given in the variables texfile using regular expressions and creates a powerpoint document with the same number of slides, with the slides titles, the images in each slides (but does not keep the size or layaout yet) and creates an image for each equation that are also added to the slides

Installation

you need to install the python-pptx package

pip install python-pptx

Usage

replace the right part in line texfile='example.tex' using the name of you latex file and then run the script using python

python beamer2pptx.py

Limitations

It is very basic for now, it doesn't even recreate the bullet points. But is it still usefull as a first step to speed up manual conversion.

The main problem is that it uses regular expressions to parse the latex document. Parsing the latex robustly with regular expression seems difficult in case of nested brackets etc. We should instead use a actual parser like plasTeX or maybe convert the document to xml using LaTexXML for example and then use a xml python parser. Or we could first convert to html using the command htlatex or tex4ht and then parse the html but on my machine the conversion does not seem to work as it converts only the first slide.

the latex equations are converted into images and thus cannot be edited. It would be good to be able to keep them as editable equation in powerpoint using some latex plugin for powerpoint, or convert them into powerpoint equations.

Alternatives

You can compile the beamer into a pdf file and then convert the pdf to powerpoint using pdf2pptx. This works by converting the pdf into a set of images (one image for each slide) and then make a powerpoint from these images. An obvious limitation of that approach is that you cannot reedit the slides in powerpoint and change the theme.

You can compile the beamer into a pdf file and then open the pdf in libreOffice (tested with version 4.2.8.2). The text might not be well preserved if you use some latin encoding for example (you may see many strange characters), but the positions of the images are good. However the latex equations won't be well preserved. You might then be able to export into an ODF that you might be able to import in powerpoint.

If you are interested in converting powerpoints files to beamer you can have a look at pptx2beamer which uses the .Net Microsoft framework and requires Microsoft Visual Studio for the compilation.

beamer2pptx's People

Contributors

martingithub avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

beamer2pptx's Issues

Convert to Python3

Please update script for Python3 as Python2.7 is already EOL.

Using 2to3 produces a seemingly correct version of the script. Changes seem trivial, though I didn't scrutinize each one very closely. I would make a PR, but I get the feeling that isn't the reason this hasn't been done before, so I thought I would check.

'header.tex' not found when running example

I'm attempting to run the script using the 'example.tex' file, but it errors out when pdflatex attempts to convert the equations. I've tried this on 2 OS's (OS X and Fedora 20), and I get the same error. Any idea why? Am I missing a TeXLive dependency? Full error output is below.

[username@localhost beamer2pptx-master]$ python beamer2pptx.py
add slide First Slide (1 over 4)
add slide Slide with images (2 over 4)
add slide Equations (3 over 4)
This is pdfTeX, Version 3.1415926-2.6-1.40.14 (TeX Live 2014/dev)
restricted \write18 enabled.
entering extended mode
(./tmp_equation.tex
LaTeX2e <2011/06/27>
Babel <3.9h> and hyphenation patterns for 2 languages loaded.
(/usr/share/texlive/texmf-dist/tex/latex/standalone/standalone.cls
Document Class: standalone 2012/09/15 v1.1b Class to compile TeX sub-files stan
dalone
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty)
(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/share/texlive/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/keyval.tex)))
(/usr/share/texlive/texmf-dist/tex/latex/standalone/standalone.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/preview/preview.sty
(/usr/share/texlive/texmf-dist/tex/latex/preview/prtightpage.def)))

! LaTeX Error: File `header.tex' not found.

Type X to quit or to proceed,
or enter new name. (Default extension: tex)

Enter file name:

ascii unicode error?

Hello, don't know what could be...

WARNING: unrecognized command/environment: PassOptionsToPackage
.......
WARNING: unrecognized command/environment: @FirstOfTwo
WARNING: unrecognized command/environment: pdfobj
WARNING: unrecognized command/environment: pdfrefobj
WARNING: unrecognized command/environment: pdflastobj
.... )
( /usr/local/lib/python2.7/dist-packages/plasTeX/Packages/hyperref.pyc )..
WARNING: unrecognized command/environment: graphicspath
WARNING: unrecognized command/environment: hypersetup
..
ERROR: Error while reading argument "self" of title in on line 26
('ascii' codec can't decode byte 0xc3 in position 0: ordinal not in
range(128))
ERROR: Error while expanding "title" in on line 26 ('ascii' codec
can't decode byte 0xc3 in position 0: ordinal not in range(128))
ERROR: An error occurred while building the document object in on
line 26 ('ascii' codec can't decode byte 0xc3 in position 0: ordinal not in
range(128))
could not parse the latex fil eusing plasTex
Traceback (most recent call last):
File "beamer2pptx.py", line 75, in
document = tex.parse()
File "/usr/local/lib/python2.7/dist-packages/plasTeX/TeX.py", line 412, in parse
for item in tokens:
File "/usr/local/lib/python2.7/dist-packages/plasTeX/TeX.py", line 46, in next
return self._next()
File "/usr/local/lib/python2.7/dist-packages/plasTeX/TeX.py", line 321, in iter
tokens = obj.invoke(self)
File "/usr/local/lib/python2.7/dist-packages/plasTeX/Base/LaTeX/Packages.py", line 160, in invoke
Command.invoke(self, tex)
File "/usr/local/lib/python2.7/dist-packages/plasTeX/init.py", line 366, in invoke
self.parse(tex)
File "/usr/local/lib/python2.7/dist-packages/plasTeX/init.py", line 476, in parse
**arg.options)
File "/usr/local/lib/python2.7/dist-packages/plasTeX/TeX.py", line 722, in readArgumentAndSource
toks, source = self.readToken(expanded, parentNode=parentNode)
File "/usr/local/lib/python2.7/dist-packages/plasTeX/TeX.py", line 784, in readToken
for t in tokens:
File "/usr/local/lib/python2.7/dist-packages/plasTeX/TeX.py", line 244, in itertokens
t = inputs[-1][-1].next()
File "/usr/local/lib/python2.7/dist-packages/plasTeX/Tokenizer.py", line 368, in iter
token = next()
File "/usr/local/lib/python2.7/dist-packages/plasTeX/Tokenizer.py", line 272, in iterchars
code = whichCode(token)
File "/usr/local/lib/python2.7/dist-packages/plasTeX/Context.py", line 716, in whichCode
if char in c[Token.CC_LETTER]:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128)

Requests

Hello

I had to install "requests" and "plasTeX" with pip

;)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.