2

I am trying to write code for a diagram I have in tikz. I am very new to tikz so this may be an easy question but here goes. I have some code like the following:

\begin{tikzpicture}[scale=.95]
\draw [<->, thick] (0,0) coordinate (a_1) -- (2,1.8) coordinate (a_2)node[right]{$\mathcal{M}$};
\draw [<->, thick, color=black!40!blue] (1,0) coordinate (b_1) node[right]{$\mathcal{N}$}-- (1,2) coordinate (b_2);

\coordinate (c) at (intersection of a_1--a_2 and b_1--b_2);
\fill (c) circle (2pt) node[right]{$X$};
\end{tikzpicture}

But the issue I am having is that in more complicated diagrams, the text labels are in too large of font and intersects with lines. How can I make the font in the label nodes smaller?

2 Answers2

5

You can use the font key as an optional argument to the tikzpicture.

\begin{tikzpicture}[font=\footnotesize]
% ....
\end{tikzpicture}

Or if you want this for all your tikzpictures in your document, put this somewhere in your preamble:

\tikzset{every picture/.append style={font=\footnotesize}}
cjorssen
  • 10,032
  • 4
  • 36
  • 126
quinmars
  • 5,477
0

As you notice the letters are inside nodes, so you can specify in each node in the attribute ``font'' the size desired, besides that, you can specify the relative positions of your text, below I am attaching your code with some node letter size attributes:


\begin{tikzpicture}[scale=.95]
\draw [<->, thick] (0,0) coordinate (a_1) -- (2,1.8) coordinate (a_2)node[right, font=\tiny, anchor=270]{$M_{270}$}node[right, font=\tiny, anchor=180]{$M_{180}$}node[right, font=\tiny, anchor=150]{$M_{150}$};
\draw [<->, thick, color=black!40!blue] (1,0) coordinate (b_1) node[right, font=\tiny, anchor=south west]{$\mathcal{N}$}-- (1,2) coordinate (b_2);

\coordinate (c) at (intersection of a_1--a_2 and b_1--b_2);
\fill (c) circle (2pt) node[right, font=\tiny, anchor=east]{$X$};
\end{tikzpicture}

enter image description here

Freddy
  • 1