[Tex/LaTex] Place two tikz nodes next to each other

tikz-pgf

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

\begin{tikzpicture}[font=\ttfamily]    
\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...
\end{tikzpicture}

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)

Best Answer

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=

\documentclass[11pt]{scrartcl}  
\usepackage[utf8]{inputenc} 
\usepackage{fourier,tikz}
 \usetikzlibrary{positioning}
\begin{document}  
  Font  by default

\begingroup 
\ttfamily\small
\begin{tikzpicture}
\node {Text in he node};
\end{tikzpicture} 

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

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

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

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

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

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

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

enter image description here

Related Question