i made some tikzpicture and tested them outside of the main document cause then there's less compiling duration.
However i alway used \documentclass{article}
.
I set the fonts with \begin{tikzpicture}[auto, font = {\sf \myfont}, thick]
.
For \myfont
i used \newcommand{\myfont}{\footnotesize}
.
After creating the tikzpicture i wanted to add the tikzpicture
with \input{mytikzpicture.tex}
in to my main document.
But somehow the change of the fontsize i set with \begin{tikzpicture}[auto, font = {\sf \myfont}, thick]
has no effect now.
In my main document i set the font size using this code:
\documentclass[
pdftex,
a4paper,
11pt,
oneside,
fleqn,
listof=totoc,
headlines=2.1,
headsepline,
numbers=noenddot,
hyphens,
]{scrreprt}
What i already tried:
-
\tikzset{font={\fontsize{9pt}{12}\selectfont}}
I wanted to use this to decrease the font size in a tikzpicture only. I got this solution from searching the internet (Change fontsize in TikZ figure). Unfortunately it had no effect on the fontsize in the tikzpicture at all. -
changing the fontsize using kind of scoping (also no effect): found at
this thread{\footnotesize % change the font size \begin{tikzpicture}[auto, font = {\sf \myfont}, thick] ... \end{tikzpicture} } % end of scope of \footnotesize macro
What's the reason it doesn't work and what can i change?
If i didn't provide all necessary information to solve the problem feel free to tell me.
edit1:
here a minimum example of my problem.
the tex file i use for developing my tikzpictures:
\documentclass{article}
\usepackage{amsmath}
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usepackage{textgreek}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{shapes.multipart}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows.meta, calc, positioning, shapes, matrix}
\usetikzlibrary{arrows}
\usetikzlibrary{calc}
\newcommand{\myfont}{\footnotesize}
\tikzstyle{block} = [draw,
rounded corners]
\begin{document}
\begin{tikzpicture}[auto, font = {\myfont}, thick]
% Hilfslinien
\draw[help lines] (-5,-5) grid (5,5);
\node[block, align=center] (isolation) {hello};
\end{tikzpicture}
\end{document}
minimum example if i put my developed stuff into the main document:
\documentclass[
pdftex,
a4paper,
11pt,
oneside,
fleqn,
listof=totoc,
headlines=2.1,
headsepline,
numbers=noenddot,
hyphens,
]{scrreprt}
\usepackage{amsmath}
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usepackage{textgreek}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{shapes.multipart}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows.meta, calc, positioning, shapes, matrix}
\usetikzlibrary{arrows}
\usetikzlibrary{calc}
\newcommand{\myfont}{\footnotesize}
\tikzstyle{block} = [draw,
rounded corners]
\begin{document}
\begin{tikzpicture}[auto, font = {\myfont}, thick]
% Hilfslinien
\draw[help lines] (-5,-5) grid (5,5);
\node[block, align=center] (isolation) {hello};
\end{tikzpicture}
\end{document}
Outputs:
The left side shows the output of my 'devolopment' file. The right is the output of the main document.
As you can see if i put it into the main document the fonts are slightly bigger. This is enough to distort all my tikzpictures.
Thank in advance
Best Answer
The default font size for KOMA-Script classes is
11pt
, but for standard classes it is10pt
.Maybe you can change the font size for all tikzpictures to
10pt
usingCode:
Example with
article
:Result: