# Copy sectioning and non-text environments to new file (for presentation)

My situation is as follows: I've completed a thesis in LaTeX (memoir) and now need to create a presentation for its defense. That means copying all of the document structure from the thesis (including at least some of the figures and equations) into a beamer document.

Ideally, I'd run a script which would copy a configurable set of non-text elements into a new file and perhaps even put the figures and equations into beamer frames. It wouldn't be too hard to selectively comment/uncomment or delete lines by hand (or to write my own script) but it seems like jumping between a presentation and an article is such a common scenario that a toolset would already have been developed to handle it.

I'm using TeX-Live (installed January 2012) on Linux.

-
Does the beamer document you'll be creating for your defense have to include all of the document structure, or can you be selective? E.g., do you need an abstract, an introduction, a section performing a review of the literature, etc.? The reason I ask is that's it may not be a good idea to have the thesis defense be structured entirely in parallel to the thesis document. Presentations have additional/separate logical and layout requirements, and aren't just a "shortened" version of the longer document. –  Mico Feb 5 '12 at 18:34

There's beamerarticle, but no beamerthesis or beamermemoir (probably because so much content from a longer document would get thrown away, or because it would be difficult to predict which parts you'd want to keep).

Given a UNIX-like system, here's what I'd to to extract the structure from a thesis. In this particular example, I have a thesis manual in memoir, with thesis-manual.tex including several chapters from a thesis-manual-content folder below it:

user@host:thesis-manual-content$for file in grep include ../thesis-manual.tex | cut -d/ -f2 | cut -d'}' -f1; do egrep '^\\chapter|^\\section'$file.tex; done
\chapter{The Essentials}
\section{Purpose of the Guide}
\section{Ethical Standards}
\section{Definitions}
\chapter{Thesis/Dissertation Elements and Style}
...
\section{Commencement}
\chapter{Sample Tables}


You may be able to get away with a simpler method, but mine ensures that it goes through all the included chapters in order, rather than assuming the chapters are ordered alphabetically by filename. The backquoted grep with the pipes finds lines of the form \include{folder/file} and strips out the filename. The list of extracted filenames is fed into the for loop, and we grep out any \chapter or \section commands (though you could go to the subsection level, I can't imagine why you would want to).

My regex skills aren't up to extracting figures automatically. I could do it in Python or another language given enough time, but I don't know if it's worth automating, since you probably won't want most of the figures (or possibly any of the tables).

-
Looks like the answer is no. Thanks for your script, I'll probably end up reworking it to do what I need. –  mmdanziger Feb 13 '12 at 21:57