Plurrrr

Thu 09 Jul 2026

Changing margin and paper size

Yesterday I learned how to change the margin of the PDF file Pandoc generates. But I forgot about the paper size. I live in the Netherlands and A4 is the common format here. First, I wanted to know how to check the current paper size. This can be done on the command line as follows:

mdls freecodecamp.pdf |
    grep -i page

This reports the number of pages, the height (792 for US letter) and width (612 for US letter). The values are in PostScript points; 1" equals 72 points or 8.5" × 11" for US letter.

How to change this? Well, it turns out that with one Pandoc variable one can control both the margin and the paper size:

-V geometry="margin=1in,a4paper"

So the command for generating the PDF via Pandoc in a Docker container and viewing the output in the Preview application on macOS becomes:

docker run --rm \
-v "$(pwd):/data" \
-u $(id -u):$(id -g) \
pandoc/latex freecodecamp.md \
-V geometry="margin=1in,a4paper"\
-o freecodecamp.pdf &&
open freecodecamp.pdf

Checking the dimensions with mdls reports 841.89 points × 595.2760009765625 points which matches the dimensions of an A4 page.

History with time stamps

In the evening I wanted to know at which time exactly I had run a specific command on the command line of macOS. Could I get the history of commands entered on the command line with each a time stamp? The answer is yes, with fc (Fix Command):

fc -li 1

This lists (-l) the history from the start (1) with time stamps in ISO8601 format (-i). Note that without the 1 you get the last maximum 16 commands.

Now I could grep the output of this command. But wait, fc comes with a match option (-m):

fc -li -m 'docker*' 1

This lists all events in the history that starts with docker and shows the ISO8601 time stamp.