15

What I'm asking might not be within my capabilities, but I'm trying to change a document to print on 74 pages of A5 instead of 74 pages of A4. I have managed to change the papersize to A5 but it prints on 146 pages, as the fonts are still at the original size!

I haven't a clue how to 'scale' all the fonts by 0.5 (i.e. make every instance of every character 50% of its original size). I've found some clues that adding [scaled=0.5] to a font package is something of a solution, but it doesn't work with the document I'm trying to change. Changing the \documentclass from 10pt to 5pt doesn't do anything (and maybe it wouldn't - I am clueless)

The header is below, I hope it's OK to post it all.

I can follow simple instructions, but this is my first exposure to this world!

\documentclass[10pt,a5paper,twoside]{article}

\usepackage[latin1]{inputenc}
\usepackage[german,english]{babel}
\usepackage[textwidth=11.3cm,textheight=18.0cm,includehead]{geometry}
\usepackage{multicol}
\usepackage{ifthen}




\newboolean{germanorder}
\setboolean{germanorder}{false}

\newboolean{usepdflinks}
\setboolean{usepdflinks}{true}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[RO,LE]{\textbf\thepage}
\fancyhead[RE]{\textbf{\nouppercase{\leftmark}}}
\fancyhead[LO]{\textbf{\nouppercase{\rightmark}}}
\renewcommand{\sectionmark}[1]{\markboth{test}{\thesection.\ #1}}

\fancypagestyle{plain}{
    \fancyhf{}
    \fancyfoot[R]{\textbf{\thepage}}
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{0pt}
}

\ifthenelse{\boolean{usepdflinks}}
{\usepackage[pdftex,pdfborder={0 0 0}]{hyperref}}
{
    \newcommand{\hyperlink}[2]{#2}
    \newcommand{\hypertarget}[2]{#2}
}

\newcommand{\comment}[1]{}   % Remove comments
\newcommand{\explanation}[1]{}   % Remove comments
\newcommand{\cardtext}[2][]{#2}
\newcommand{\apx}[2][]{#2}
\newcommand{\ruling}[2][]{#2}
\newcommand{\notenglish}[1]{#1$^\dagger$}
\newcommand{\changed}[2][]{#2}
\newcommand{\MOOR}{\textsc{MOOR}}

\newcommand{\de}[1]{(\textsl{\foreignlanguage{german}{#1}})}
\newcommand{\numberref}[1]{\textbf{\small #1}}
\newcommand{\cardref}[3]{\hyperlink{#3}{#1 %
\ifthenelse{\boolean{germanorder}}{\de{#2}}{\numberref{#3}}}}

%\newcommand{\card}[5]{\hypertarget{#3}{}%
%\ifthenelse{\boolean{germanorder}}{%   German and other languages
%\noindent\textbf{\textsl{#2}}\hfill\numberref{#3}\nopagebreak

%\noindent\textbf{#1}\hfill{\tiny#4}}{% English
%\noindent\textbf{#1}\hfill{\tiny#4\hspace{0.5em}}\numberref{#3}}%
%\nopagebreak

%\noindent#5\vspace{0.3\baselineskip} }

\newcommand{\card}[5]{\hypertarget{#3}{}%
\noindent\parbox[b]{5.24cm}{\noindent\textbf{#1}\\[-1ex]{\tiny#4}}%
\hfill{\hfill\raisebox{4pt}{\textbf{\Large #3}}}%
\nopagebreak

\noindent#5\vspace{0.5\baselineskip} }

\newcommand{\action}[3]{\noindent\hypertarget{#2}{\textbf{#1}}\hfill%
\nopagebreak

\noindent#3\vspace{0.3\baselineskip}}

\newcommand{\actionref}[2]{\hyperlink{#2}{``#1''}}

\newlength{\guessheight}
\settoheight{\guessheight}{I}
\newlength{\guessdepth}
\settodepth{\guessdepth}{g}
\addtolength{\guessheight}{0.6\guessdepth}
\addtolength{\guessdepth}{0.2\guessdepth}
\newlength{\guesswidth}
\settowidth{\guesswidth}{I}

\newcommand{\ecp}[2][]{\makebox[2pt][l]{\rule{\fboxrule}{\guessheight}\rule[\guessheight]{\guesswidth}{\fboxrule}}#2\makebox[2pt][r]{\rule[-\guessdepth]{\guesswidth}{\fboxrule}\rule[-\guessdepth]{\fboxrule}{\guessheight}}}

\newcommand{\english}[1]{%
\ifthenelse{\boolean{germanorder}}{}{\item \textsl{#1}}
}

\newenvironment{explanationlist}{\small\begin{list}{$\Rightarrow$}{\setlength{\topsep}{0pt}\setlength{\itemsep}{0pt}}}{\end{list}}

\newcommand{\sectionline}{\begin{center}\rule{4cm}{0.2mm}\end{center}}

\addtolength{\columnsep}{1mm}


\begin{document}
  • Welcome to TeX.SX! In the standard classes (article, book, report) only 10pt (which is default) 11pt and 12pt are allowed font sizes, with any other sizes the default 10pt is used. – Torbjørn T. Nov 10 '13 at 18:02
  • 7
    Isn't it simpler to do that at printing time? I mean, leave the document in a4 size and tell the PDF reader to print it in a5 paper? – karlkoeller Nov 10 '13 at 18:17
  • If I were printing it at home yes, but I need an A5 PDF to send to an online printshop to have the document with a cover and spiral bound. They have to have the .pdf file at the exact print size. – lewis Nov 10 '13 at 18:29
  • 1
    Doesn't Cutepdf, or, another printer driver (adobe professional, if you have adobe virus on your computer) have that scaling facility, ie, print the document to another pdf, scaling it by 50%. – Nicholas Hamilton Nov 10 '13 at 18:33
  • Tried that (Acrobat X direct, via MS Word etc etc), but it outputs an enormous graphics-based file - not vector fonts. Acrobat will output a font-based file e.g to MS Word, but it doesn't preserve line spacing and suchlike well enough, so many lines are clipped where the line spacing has been manually set. – lewis Nov 10 '13 at 18:35
19

Perhaps you could use the pdfpages package to do this. Create a new .tex file that contains the following:

\documentclass[a5paper]{article}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages=-]{originalfile}
\end{document}

Where originalfile.pdf is your original A4 document. Compile this with pdflatex and you should get an A5 version of your original.

(In response to a comment:) Using the filecontents environment you could keep the above code in the same file as your main file, and with arara you could automate the compilation. Code example:

% arara: pdflatex
% arara: pdflatex: { files: [a5version.tex]}
% arara: clean: { files: [a5version.tex, a5version.aux,a5version.log]}

\documentclass[a4paper]{article}
\usepackage{kantlipsum} % for dummy text

% create the file for a5 version
\usepackage{filecontents}
\begin{filecontents}{a5version.tex}
\documentclass[a5paper]{article}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages=-]{originalfile} % insert filename of main file here
\end{document}
\end{filecontents}

\begin{document}
\kant
\end{document}
  • You sir, are a genius. It worked absolutely perfectly. I had wasted TWO days on that job. Many many thanks – lewis Nov 10 '13 at 20:13
  • Just for the hell of it, could you use package filecontents to store this and the main document in a single file? (Not sure how it's all implemented, so wondering if it'll work). – alexis Nov 10 '13 at 22:40
  • 1
    @alexis You could, and combined with arara you could automate the compilation as well. I'll add an example. – Torbjørn T. Nov 10 '13 at 22:50
  • In @tohecz comment here: tex.stackexchange.com/questions/126566/… he says that scaling is really not a good practice. Isn't the suggested solution here boils down to downscaling? – Dror Jan 2 '14 at 20:43
  • @Dror Yes, this is just downscaling, so not ideal, but on the other hand that's what the OP asked for. – Torbjørn T. Jan 2 '14 at 22:09
8

An easier solution with pgfpages (part of the pgf package).

You just need to use the following setup and your document will be resized to A5 paper.

\pgfpagesuselayout{resize to}[a5paper]

MWE

\documentclass[a4paper]{article}

\usepackage{pgfpages}
\pgfpagesuselayout{resize to}[a5paper]

\usepackage{blindtext} % just for the example

\begin{document}

\blinddocument % just for the example

\end{document} 

Output (in A5 format)

enter image description here

  • "A word of warning: using pgfpages will destroy hyperlinks." (From the PGF manual.) – krlmlr Sep 7 '15 at 12:50
4

Using Ghostscript

Here is a little script, which can rescale your PDF to any paper format. The script uses the first parameter as input of a .pdf-file, the second parameter is the desired paper format. It writes the output to a file with the same name and and appends the new paper format to the name.

Please keep in mind, that scaling only works as expected for DIN A� Formats, because these have a long edge/short edge ratio of √2, no matter what size.

Run with bash.

#!/bin/sh

# Usage: First argument is PDF file
#        Second argument is paper format (e.g. a4)

gs -q -dNOPAUSE -dBATCH \
    -sDEVICE=pdfwrite \
    -sPAPERSIZE=$3 \
    -dFIXEDMEDIA \
    -dPDFFitPage \
    -sOutputFile="${1%%.*}-$2.pdf" \
    "$1"
echo "Output written to ${1%%.*}-$2.pdf"
exit 0
  • Thank you too, Henri. I can't yet try your suggestion because I fail at the first hurdle "run with bash"! However, I will have a look into that as a solution for future problems. Many thanks to you too. – lewis Nov 10 '13 at 20:20
  • @lewis The code I posted is a shell script, which is to be used on a GNU/Linux operating system. If you are on GNU/Linux, just save the code as say rescale_pdf.sh, open a terminal and run the script like sh rescale_pdf.sh "file.pdf" a5. In this call sh is most certainly a shortcut for bash. – Henri Menke Nov 11 '13 at 8:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.