# standalone - Can I specify the font size in the document?

I'd like to define the font size in a standalone document so that it is identical to the one in my "real" big document.

I have several standalone-documents. In those, I'd like to implement an option which makes the standalone-documents simply adhere to what is written in font-config.tex (see MWE)--which is currently empty.

(In my main document, I of course define the size as an option for the documentclass (scrreprt), but I am a bit clueless what to do here since standalone does not take \KOMAoptions obviously.)

What should I write into font-config.tex so that it basically mimics whatever I define for my real document?

## MWE

\documentclass[
12pt
]{standalone}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}

\input{font-config}
%\KOMAoptions{fontsize=11pt}

\usepackage{
tikz,
}

\begin{document}
\begin{tikzpicture}[font=\small]
\draw
(0,0) coordinate (A)
(1,1) coordinate (B)
;
\draw[thick] (A) rectangle (B) node[anchor=south west, align=left] {Words abc.\\Test.};
\end{tikzpicture}
\end{document}


standalone uses article as its 'base' class, but you can change this with the class=<classname> option. Hence, you could tell standalone to use a KOMA class with

\documentclass[class=scrreprt]{standalone}


You can then use the \KOMAoptions directly in your standalone files, place it in the font-config file, or add the fontsize declaration to the class options directly.

• But when I use this class, I no longer get the nice feature of standalone that my document is perfectly sized to my image. Mar 5, 2017 at 22:42
• @CarlSorensen Ehm, yes you do. Just try, \documentclass[class=scrreprt]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw (0,0) grid (5,5); \end{tikzpicture} \end{document} Mar 5, 2017 at 23:24
• @Torbjørn T. Only if the width of the image is less than the width of the page in the scrreport. Try \documentclass[class=scrreprt{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw (0,0) grid (30,5); \end{tikzpicture} \end{document} Mar 6, 2017 at 0:36
• @CarlSorensen Works perfectly fine here. I have no idea why you'd see different, so I'd suggest you ask a new question. Add \listfiles at the start of that code, and add the code and the .log file to the question. Mar 6, 2017 at 7:26

You could also just set the fontsize:

\fontsize{10}{12}\selectfont

First argument is the font size, second the baselineskip.