Typearea settings for a scrbook

Here are dirty hacks for page layout in LaTeX and a few useful standard settings.

I load the following document class:

\documentclass[bibliography=totoc,12pt,a4paper,headsepline]{scrbook} 

The option bibliography=totoc puts the bibliography into table of contents. The option 12pt sets normal font size to 12pt instead of the usual 11pt. This font size was a requirement for my thesis. The option a4paper sets DIN A4 paper (which should be the default anyway). The option headsepline adds a line below the header content on pages without a title.

A useful additional option may be oneside, which creates symmetric margins for one-sided print. Again, that was a requirement for the manuscript of my thesis. For the final print, I needed a normal two-sided print. A useful option there is titlepage=firstiscover, which gives equal margins for the first two pages (the book cover).

Usually you don’t want to tamper with the margins that LaTeX gives you. But in some cases, you may have specific guidelines that you need to adhere to. Or you have a fixed number of pages and run out of space, so you want smaller margins. Anyway, this is not recommended, I am just showing you how it works, because I can.

We have loaded the documentclass scrbook which is the KOMA-Script document class for an DIN A4 page book with a font size of 12pt. At that paper and font size, KOMA-Script uses a value of DIV=12 to calculate margins and text area sizes. The page has a width of 157.50mm and a height of 222.75mm for the text area. The top margin is 24.75mm and the inner margin 17.50mm. You can increase or decrease the margins by setting a different DIV value. So if you use the option DIV=13 for example, you will have a bigger text area (161mm wide instead of only 157mm). You can play around with the values until you find something you like. Here are the measurements for different DIV values for an DIN A4 page:

If you don’t find anything you like, you can set all values by hand with the geometry package. Use at your own peril. This is an example with a larger text height:

\usepackage[width=157.50mm,top=35mm,left=24mm]{geometry}  % gives textheight=226.36mm

When you play around with margins and text area settings, the package showframe is useful to see what you are doing:

\usepackage{showframe}

Include pages from a pdf into a LaTeX beamer presentation

As you know, I do basically everything with LaTeX. But, I have colleagues who work with other tools and sometimes we exchange slides. Fortunately by now people have realized that I don’t like to get weird formats, so they send me pdfs. Yay!

It is actually really easy to include pages from a presentation in pdf format into a LaTeX beamer presentation. You will need the package pdfpages and then just write:

{
\setbeamercolor{background canvas}{bg=}
\includepdf[pages=3-8]{slides.pdf}
}

The first line is necessary, because it seems like otherwise the pdf slides end up being inserted behind the background of the slides, which doesn’t make so much sense to me, but anyway.

You can also include one pdf page into a beamer-slide (“frame”). This is useful if you want to edit the slide a bit, for example to hack your own footer back into the slide to get consistent page numbering:

{
\setbeamercolor{background canvas}{bg=}
\begin{frame}[t]
\includepdf[pages=3]{slides.pdf}

\vspace{0.81\paperheight} % go down to where we want the footer

\hspace*{0.31\paperwidth} % space to the left
\begin{minipage}{0.6\paperwidth} % insert my footer
\tiny\colorbox{white}{~\insertshortauthor: \insertshorttitle} 
\hfill \insertframenumber ~/ \inserttotalframenumber
\end{minipage}

\end{frame}
}

Positioning rests in the middle of a two-voice line

In choir scores, you often have the score for two voices (e.g., soprano and alto) in one line:

      \new Staff  = "Frauen"<<
         \new Voice = "Sopran" { \voiceOne \global  \soprano }
         \new Voice = "Alt" { \voiceTwo \global  \alto }
      >>

When they both have a pause at the same time with the same length, lilypond will still print two rests in different positions. If you (like me) think this looks weird, here is how you can change it:

soprano = \relative c' { a2 \oneVoice r4 \voiceOne a4 }
alto = \relative c' { a2 s4 a4 }

In one voice, change to only one voice with \oneVoice for the rest and then back to the usual voice, here /voiceOne. If you do the same in the other voice, you will get warnings about clashing notes, so instead of using a rest, use an invisible rest (spacer) with s.

An alternative is the following command which causes all rests to appear in the middle of the line. It should be used inside the \layout block:

   \override Voice.Rest #'staff-position = #0

LaTeX presentation background picture

In one slide of a presentation I wanted to have a background picture and overlay it with several text blocks one after the other to have the effect of the text “coming out of” the background. It is tricky to align things in LaTeX beamer, especially if you want to have them on top of each other, so this is my solution: Two minipages that cover the whole slide on top of each other.

A slide is more or less 7cm high (depending a bit on your template). There probably is a length defined for that, but I was too lazy to look for it so I took the actual value. The width of the slide is of course \textwidth. I use vertically centered alignment for the minipage, but that is up to you (see the post Set height of a minipage for the options you can give to minipage).

The way it now works is the following. Create one minipage of full width and height. Use this to display the background image. Then jump back the full height and create a second minipage of full width and height to display the text inside of that. This is the code for my slide:

\begin{minipage}[c][7cm][c]{\textwidth}
\centering
\includegraphics[width=0.8\linewidth]{img/Reviews}
\end{minipage}

\vspace{-7cm}
\begin{minipage}[c][7cm][c]{\textwidth}
\centering

\visible<2->{
\colorbox{white}{\fbox{\textcolor{blue}{I was impressed by the fast shutter speed of D3200.}\only<3->{\textcolor{darkgreen}{~(\emph{positive})}}}}
}

\vspace{1cm}
\visible<4->{
\colorbox{white}{\fbox{\textcolor{blue}{The autofocus was \textbf{not} so reliable.}\only<5->{\textcolor{red}{~(\emph{negative})}}}}
}
\end{minipage}

Adjusting spacing in lilypond

Because I always forget how to do it, this is my default (for explanations see the Lilypond manual):

\paper {
   top-markup-spacing #'basic-distance = #5 % title to page top
   markup-system-spacing #'basic-distance = #15 % first system to title
   system-system-spacing #'basic-distance = #20 % between systems
}