18

I had my documentclass set at 10pt and I import my TikZ figures just with \input. Everything was working fine but now I want to have 11pt in the document and all my nodes are bigger because the fonts are now bigger and everything is distorted.

So, how can I set the fontclass (or whatever name it has) in TikZ to 10pt so the normalfont in the figures is 10pt as I had designed everything with in mind instead of 11pt that would be the actual document?

0

1 Answer 1

17

If you do not change the font size within your pictures, it is fairly simple and you could just try this:

\documentclass[11pt]{article}
\usepackage{tikz}
\tikzset{
  font={\fontsize{10pt}{12}\selectfont}}
\begin{document}
  This is some text.

  \begin{tikzpicture}
    \node {This is a node.};
  \end{tikzpicture}

  This is some text.
\end{document}

size switch

Obviously, if you use commands like \small etc. within pictures, things are more complicated.

8
  • 2
    Wouldn't \tikzset{font=\small} work as well?
    – Pier Paolo
    Feb 8, 2015 at 15:21
  • 4
    @PierPaolo Yes. But I would specify it explicitly so that if I later change the global setting, the figure will still come out correctly. (E.g. if I later decide to go back to 10pt or if I decide on 12pt.) Since the diagram requires a specific size, it makes more sense to use an absolute specification than one dependent on the document default setting. That is, the advantage of \small is that it will automatically adjust if you change the global size. But that is precisely what is not wanted in this case.
    – cfr
    Feb 8, 2015 at 15:46
  • @cfr I have a document with 12pt and would like to have the all tikz graphics at 10pt. And I still want to use \small to get the respective 10pt \small variant in the picture. How can I get that?
    – n4pK
    Dec 25, 2019 at 16:30
  • @n4pK Why would you want to do that? I mean you could, if you really wanted to change the meaning of \small in every tikzpicture, but why not just use a different command in these cases?
    – cfr
    Dec 26, 2019 at 4:51
  • @n4pK I would define a new macro to give the size you want and then \let\standardsmall\small\let\small\newsizemacro at the start of the environment, where the font is set to 10pt. But I'd only do this if, like the OP, your code is already written and you need a 'quick fix'. Otherwise, better to use the \newsizemacro directly.
    – cfr
    Dec 26, 2019 at 4:53

You must log in to answer this question.

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