Skip to content

Instantly share code, notes, and snippets.

@jstepien
Created Apr 25, 2010
Embed
What would you like to do?
A LaTeX file for extracting slides from handouts
n=9;for i in `seq $n`; do pages=$(identify wyklad$i.pdf | tail -n 1 | perl -ne '/^wyklad.*?\[(\d+)/; $_ = $1+1; print'); sed -e s/wyklad1/wyklad$i/g -e s/23/$pages/ < slides.tex > slides$i.tex; done
\documentclass[a4paper]{article}
\usepackage[landscape,margin=0pt]{geometry}
\usepackage{graphicx,ifthen,calc}
\def\filename{wyklad1}
\def\slidescount{23}
\newcounter{pagecounter}
\newcommand*\insertgraphicsfiles[2]{
\setcounter{pagecounter}{#1-1}
\whiledo{\value{pagecounter}<#2}{
\stepcounter{pagecounter}
\includegraphics[height=\textheight,viewport=57 569 287 741,clip,%
page=\the\value{pagecounter}]{\filename}
\includegraphics[height=\textheight,viewport=57 335.5 287 507.5,clip,%
page=\the\value{pagecounter}]{\filename}
\includegraphics[height=\textheight,viewport=57 101.5 287 273.5,clip,%
page=\the\value{pagecounter}]{\filename}
}
}
\pagestyle{empty}
\begin{document}
\begin{center}
\insertgraphicsfiles{1}{\slidescount}
\end{center}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment