15

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}
12

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. – Carl Sorensen Mar 5 '17 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} – Torbjørn T. Mar 5 '17 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} – Carl Sorensen Mar 6 '17 at 0:36
  • 1
    @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. – Torbjørn T. Mar 6 '17 at 7:26

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.