TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can one change the font/fontfamily for the text of a tikz node? I can't seem to find it anywhere.

\node[text centered, color=white, rotate=-90, shape=rectangle, fill=black,
   font=\huge, inner sep=3pt,minimum height=1cm] at (0,0) {\textbf{Some Text}}
    ...Another node goes here that is "snapped" to the next one along one of its
    sides and not hard coded...

I'd like to put some text right next to the first node without having to hard code the distance(as some text may change)

share|improve this question
If you would like to change the font in whole tikz block, you can use \ttfamily just after the \begin{}, without []. – Sigur Jul 12 '12 at 21:27
I can't seem to change the font family and font size independently. – AbstractDissonance Jul 12 '12 at 21:33
Please add a minimal working example that illustrates your problem. That would clear the confusion about the possible cause of the undesired behavior. – percusse Jul 12 '12 at 21:54
up vote 4 down vote accepted

TikZ is very well integrated to TeX and you can use the same methods to modify some texts. For example you can use TeX's groups outside the tikzpicture environment or inside. You can use specific options inside a tikzpicture environment or inside a node. The main rule is that the text inside a node used the font defined outside if you don't use a specific option to change the font.

Now to put some text right the main node, you can use label= ... to define a label node or you can use the positioning library or you can use anchor=

  Font  by default

\node {Text in he node};

After the \emph{tikzpicture} but inside the group. 

Outside the  \verb+tikzpicture+ and outside the group.

  \node[font=\huge\bfseries] {Text in he node};

 \begingroup \bfseries\small
  \node {First node};
  \node at (0,-1) {Second node}; 

  \node[draw,label={[align=left]right:right label\\ok}] {Main label};

  \node[draw] (main){Main label}; 
  \node[right=0pt of main] (sub){Sub label};

  \node[draw] (main){Main label}; 
  \node[anchor=west] at (main.east){Sub label};

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.