6

I have a document, where I want two versions: one versions 10pt size and another version, 2 page to a side 12pt. So I currently have:

\documentclass[10pt,a4paper,oneside,openany,article]{memoir} 
\newif\ifprintver
%\printvertrue

\ifprintver
\usepackage{pgfpages}  
\pgfpagesuselayout{2 on 1}[a4paper,border shrink=1mm,landscape]
\fi

But I have to change the font size by hand. What can I put inside my \if that would change the font size document wide?

4 Answers 4

6

You can define your printver boolean before \documentclass and then use \documentclass inside an \ifprintver conditional:

\newif\ifprintver
%\printvertrue

\ifprintver
\documentclass[12pt,a4paper,oneside,openany,article]{memoir} 
\else
\documentclass[10pt,a4paper,oneside,openany,article]{memoir} 
\fi

% ... other code

\ifprintver
\usepackage{pgfpages}  
\pgfpagesuselayout{2 on 1}[a4paper,border shrink=1mm,landscape]
\fi

\usepackage{lipsum}

\begin{document}

\lipsum[1-100]

\end{document}
3
  • Nice solution, but you should swap 10pt and 12pt in your code example.
    – lockstep
    Commented Jan 22, 2011 at 23:58
  • @lockstep: thanks for noticing, I've made the change. Commented Jan 23, 2011 at 8:59
  • I'm beginning to learn that "the first line in your .tex file must be a document class" is a LIE!!!! Thanks for this.
    – Seamus
    Commented Jan 23, 2011 at 12:07
3

The KOMA-Script-classes feature the macro \changefontsizes which allows you to change the main font size mid-document. This macro is also part of the scrextend package, which can (or at least it seems so) be made compatible with the memoir class.

\documentclass[10pt,a4paper,oneside,openany,article]{memoir} 

\makeatletter
\let\@textsubscript\relax
\let\setfootnoterule\relax
\let\multiplefootnotemarker\relax
\makeatother

\usepackage{scrextend}

\newif\ifprintver
\printvertrue

\ifprintver
\usepackage{pgfpages}  
\pgfpagesuselayout{2 on 1}[a4paper,border shrink=1mm,landscape]
\changefontsizes{12}
\fi

\usepackage{blindtext}

\begin{document}

\blindtext

\end{document}
1
  • Should be noted, that the correct way to do this is \KOMAoption{fontsize}{12pt}. changefontsizes is for calculating relative sizes like footnotesize for non-standard base sizes. Meaning the calculated values overwrite the default/standard values. But changing the fontsize means recalculating the type block. memoir has its own commands to deal with that.
    – Johannes_B
    Commented Jan 17, 2015 at 11:17
3

use a variable for the font size setting, e.g.

\documentclass[\FontSize, a4paper]{article}

and then run pdflatex with

pdflatex '\def\FontSize{12pt}\input{<your_file>.tex}'

now you can simply change the fontsize

1
  • You could also use pdflatex '\PassOptionsToClass{12pt}{article}\input{<your file>.tex}' Commented Jan 30, 2011 at 19:59
0

I am not sure if it is a good idea, just to set the font-size. There are more subtle differences, such as setting equation number sizing etc. What LaTeX does when processing the options is that it imports a file with the sizing and other related definitions with the extension .clo. You can try this:

\input{size12.clo}

For each class LaTeX uses slightly different conventions, for example in the book class, it uses bk10.clo.

1
  • 2
    The .clo files use \newcommand, so you have to undefine all of the sizing commands before this works. Commented Jan 23, 2011 at 0:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .