I am looking for some possibility to only scale the text inside a node without using the commands like \tiny or \scriptsize.

In my styleset I am using the line

every node/.style={font=\scriptsize, very thin, scale=.7} 

This do a scaling of the font, however also scales the dimensions of the node. I want to achieve that my picture is getting excatly the correct width without using just resizebox as this cann result that all my pictures have slightly diffferent font sizes and line widths.

Using the fonts \tiny and \sriptsize is no option for me as ,in my opionion, they look very ugly due to the horizontal stretch.

So is there as easy possibility to just use a global option that all content inside a node is scaled using a given factor?

Found this however this post was 7 years ago and I do not completely understand the added code. Maybe there is a new implementation using newer functions of Tikz?


just for fun an experiment using anyfontsize package, showing the variation of font size from 1 to 20 pt in the node 3; node 2 is scaled from 0.1 to 2.0...


enter image description here


% arara: pdflatex: {synctex: yes, action: nonstopmode}
% arara: animate: {density: 100, delay: 20 , other: -background white -alpha remove}
% arara: showanimate
    \foreach \x in {1,...,20}{
    \draw (-2.5,7) rectangle (10,-7);
        node[draw,text width=3cm](N1){Node 1\\ The text width is 3cm. in mormal size font.}
        node[below right= 1 and 1 of N1,draw,text width=3cm,scale=\x/10](N2){Node 2\\ The text width is 3cm. in mormal size font. but all is scaled \pgfmathprintnumber[fixed,fixed zerofill,precision=1]{\s}}
        node[above right= 1 and 1 of N1,draw,text width=3cm,font=\fontsize{\x}{10}\selectfont](N3){Node 3\\ The text width is 3cm. and size font is changed to \x};
        (N1.center) circle (2pt)
        (N2.center) circle (2pt)
        (N3.center) circle (2pt);;

PSD: to animate I use imagemagick converter.

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.