Formatting HOW-TO
If you're looking for a way to import the text on a mobile device in EPUB format, read E-reader page
Most of the PDFs hosted at theanarchistlibrary.org are ready to be printed. However, you could need to reformat them to suite your own needs (with exotic paper dimension, or adding images). I'll explain you what and how to do it. I assume that you use a flavor of GNU/Linux or a *NIX. No, Windows is not supported, even if something here could be still useful.
Grab the source
The Library ships the LaTeX source of every single text present in the library. You can browse the repository at http://theanarchistlibrary.org/tex-src/
The naming convention generates very, very long filenames, but helps you in the browsing: the name of the file is always Author__Title_format.tex
Software required
The Anarchist Library Tools provide a install.sh script that will install all the software required, including fonts and ConTeXt. It's about 200Mb of installation.
http://gitorious.org/the-anarchist-library-tools/the-anarchist-library-tools/archive-tarball/master
You should modify the PATH environment variable to have the ConTeXt binaries in the first place. Usually is enough to have
source /path/to/context-root/tex/setuptex
in your ~/.bashrc.
GTSD
To get the job done:
1. Retrieve your .tex source
2. Compile the source
context --mode=a4 source.tex
Now a PDF should have been produced. Check if it's all OK.
Imposing
Output dimension
Basically, the dimension of the output paper is always set by the --mode switches, which in turn are defined in the p-anarchistlibrary.tex module, which should be installed by the installer or placed in the current directory if you didn't install the bundle.
The following modes are defined:
- a4 which is (obviously) A4 paper
- a4imposed which is A5 paper
- letterimposed which is half letter
- letter for letter paper.
So, if you want a A4 imposed, you need to output A5, if you want a Letter imposed, you need to output 5.5x8.5 inches pages.
Once you have the pdf, you can choose to impose it. There are some alternatives.
Using pdfjam
It's probably not the best option, because it requires a complete LaTeX installation, which is not needed (anymore) for library files.
http://www2.warwick.ac.uk/fac/sci/statistics/staff/academic-research/firth/software/pdfjam/
If you use pdfjam, this command should get the job done:
pdfbook --short-edge --signature N --paper a4paper --suffix imposed file.pdf
The N argument of --signature means a number multiple of 4 (See below)
Replace file.pdf with the actual PDF to be imposed.
The --short-edge option is meant to set the orientation of the odd pages. Short edge means that to print the even pages, you need to turn the sheets over the short edge. (Try without that option to see what I'm meaning).
For Letter output, run:
pdfbook --short-edge --signature N --paper letterpaper --suffix imposed file.pdf
This will generate an imposed PDF, with a -imposed suffix (e.g. file-imposed.pdf).
The script shipped by the Anarchist Library tools
See here
Usage: ./imposer.pl [ options ] file.tex
Where the file.tex is a ConTeXt source file from the library. In this case you can use some other options:
--minsignature <number>
--maxsignature <number>The optimal signature will be found using the min and the max provided by the user. If needed (and very often *is* needed), white pages will be added by the module *before* the \alibraryflushpages command, so you can use the last page (after the \alibraryflushpages command) as a backcover, if you want so.
Common options:
--paper [ letter | a4 ]
Set the output paper
--debug
It will print to the standard output some informations like the imposition schema, the file used and will not remove the temporary files.
What are signatures?
If you want to imposed a PDF, you need to specify a “signature”, i.e. a group of pages that will be folded together. Considering that a sheet contains 4 pages, the signature must be a multiple of 4.
The simplest case
The PDF produced by the TeX run is very short, just 4 pages. You'll get a new file-imposed.pdf that can be folded.
Medium case
the original PDF is less than 100 pages long. This means at most 25 sheets, that can be folded together in a decent manner. Now, the problem is that the signature must be a multiple of four. If the original PDF doesn't have a number of pages which is a multiple of 4, you're in troubles, because some white pages will be add, and you usually want the first and the last page to match and be placed on the first sheet (to get a “cover” effect).
To achieve this result, you often have to add some white pages in the source .tex, usually after or before the table of contents, or at the end of the text, but before the last page. This is done by the ConTeXt module you should have installed
Hard case: a big book
What if you want to impose a book with more than 100 pages? You need to split in booklets, that you'll bind together at the end.
So, basically, you have to choose an appropriate signature range, with --minsignature and --maxsignature.
Please keep in mind that all the operations described above are already offered by The Anarchist Library engine: signatures and white pages padding included
Our larger pdfs are already shipped in signature. You have just to understand how big is the signature (looking at the first page, which contain the first and the last page of the first signature), print and fold accordingly.
