Beamer: Image Animation
Beamer makes it very easy to include a series of images and display them in a serial animated style in separate frames (slides).
For example, to display the images foobar-0.png, foobar-1.png and foobar-2.png in a serial fashion use:
\usepackage{xmpmulti}
\begin{frame}
\multiinclude[format=png]{foobar}
\end{frame}
xmpmulti is a package that ships along with the Beamer package. \multiinclude is the command that takes care of putting the foobar-x.png into different frames. Make sure that the files are named as basename-number.format, i.e., the basename and the number are separated by a hyphen. The format option is the extension of the files.
\multiinclude starts from file number 0. To start from a different number, say 9:
\multiinclude[format=png,start=9]{foobar}
\multiinclude inserts all files that are in the above format. To make it stop at a certain number, say 7:
\multiinclude[format=png,end=7]{foobar}
Typically, images are inserted using the \includegraphics command. The settings passed to \includegraphics can be passed to \multiinclude using its graphics option. For example, to set the scale of the image to 0.3:
\multiinclude[format=png,graphics={scale=0.3}]{foobar}
By default, the images are placed one on top of another. To replace each image over the other:
\multiinclude[<+>][format=png]{foobar}
IrfanView: Replicate Crop on Multiple Images
I had a series of images and wanted to crop all of them with the same bounds. Eyeballing the original crop and approximating the same on the rest of the images was out of the question, since the crops had to match to the very last pixel.
I tried to note down the crop parameters and redo the same on the rest of the images. When a crop rectangle is drawn on the image, its parameters can be seen on the Irfanview titlebar. The first 2 numbers are the coordinates of the origin (top left) and the next two numbers are the dimensions of the crop rectangle.
Redoing this crop manually on many images turned out bad since it was tiring to draw the rectangle with a mouse correctly to match the parameters.
Thankfully, the swiss army knife that is IrfanView has a better solution. Choose Edit → Create custom crop selection. If you have chosen a crop rectangle its parameters will already be displayed. Click on Save current values, click on Apply to image and crop the image. Open the rest of the images and do the same.
Beamer: Frame Title and Subtitle
The common method to provide the title and subtitle for a frame (slide) is:
\begin{frame}
\frametitle{News}
\framesubtitle{Technology}
\end{frame}
A shorter version which involves lesser typing is to provide the title and subtitle to \begin{frame} itself:
\begin{frame}{News}{Technology}
\end{frame}
PDF: Split into Multiple Files
Ensure that PDFTK is installed and the directory of pdftk.exe is in the %PATH% environment variable.
To split a PDF file into multiple PDF files, one per page of the original PDF file, invoke:
$ pdftk foobar.pdf burst output foobar-%d.pdf
If foobar.pdf is a 2 page PDF, this splits it into foobar-1.pdf and foobar-2.pdf.
It would be much nicer to invoke the above simply as:
$ splitpdf foobar
To be able to do that, turn the above invocation into a batch file:
REM splitpdf.bat pdftk %1.pdf burst output %1-%%d.pdf
The %1 is the first input argument to the batch file invocation. And %% is the way to escape %, which is a special character in a batch file.
(via Beamer + Ipe + views)
Beamer: Fonts
If you are not satisfied with the font themes that ship with Beamer, you can use any font family you want for your Beamer document. The font family you intend to use has to be available as a package. For example, to use the Helvetica font family include:
\usepackage{helvet}
The font theme has to match the style of the font family, else the resulting document may have a mix of fonts used in it. That is, use the serif font theme for a serif font family and so on. For example, to use the Concrete Math font family (which is serif):
\usefonttheme{serif} % Font theme: serif
\usepackage{ccfonts} % Font family: Concrete Math
\usepackage[T1]{fontenc} % Font encoding: T1
Sometimes, a font encoding may also have to be specified for the font family. For example, the T1 font encoding for Concrete Math font family in the example above.
Beamer: Font Themes
A Beamer font theme represents the style of the font used in the document. Beamer comes with the following predefined font themes:
default(This issans serif.)professionalfontsserifstructureboldstructureitalicserifstrucutresmallcapsserif
To set the font theme for a Beamer document use the \usefonttheme command in the preamble of the document. For example:
\usefonttheme{structurebold}
LaTeX: Preamble
The preamble of a LaTeX document is the section between \documentclass and \begin{document}.
Gmail: Mark All Incoming Email as Read
Since I have been following Inbox Zero for quite a while now, the only email seen in my inbox are unread email. If there is new email when I open Gmail, it is acted upon immediately or moved to other labels (folders) for later action. So, there is no point of the read-unread status of email in the inbox for me. Also, I do not like to see my inbox showing a unread count or seeing new email in the unread style (bold fonts).
In short, I would like all my incoming email to be marked as read. Since Gmail has no setting to do this, here is how I use a filter to achieve the same:
Python: Product of Elements of a List
Python has a built-in function to find the sum of the elements of a list:
alist = [10, 3, 8] sum(alist) # 21
But, there are no such built-in functions for other arithmetic operations. Defining such arithmetic functions that operate on sequences like lists is easy.
Here is how to write a method that gives the product of the elements of a list:
import functools
import operator
def product(seq):
"""Product of a sequence."""
return functools.reduce(operator.mul, seq, 1)




