Is it possible to write LaTeX
codes on tikz
? Let me clarify this with an example: i want to create the unit circle (this part is done) with a separated text with latex code with stuff like $\sin²+\cos²=1$ or $\tan(x)=\frac{\sin(x)}{\cos(x)}$
combined with text to explain all that, at the right of the unit circle, i think that it is using
\begin{tikzpicture}
% Unit circle drawing part
%Text
\node[right] (1,0) {the latex code}
\end{tikzpicture}
BUT, when i post the LaTeX
code with the $\cos²+\sin²=1$
etc, it does not form a different line or space. How can i create new lines if all this is possible? I've tried with the thing above, using double \
for new line or $$code$$
for new line but it does not work either. Help?
this is the code
,tex
\begin{tikzpicture}[scale=5]
\draw[step=.5cm,gray,very thin] (-1.4,-1.4) grid (1.4,1.4);
\filldraw[fill=green!20,draw=green!50!black] (0,0) -- (3mm,0mm) arc
(0:30:3mm) -- cycle;
\draw[->] (-1.5,0) -- (1.5,0) coordinate (x axis);
\draw[->] (0,-1.5) -- (0,1.5) coordinate (y axis);
\draw (0,0) circle (1cm);
\draw[very thick,red]
(30:1cm) -- node[anchor=east,fill=white] {$\sin \alpha$} (30:1cm |- x axis);
\draw[very thick,blue]
(30:1cm |- x axis) -- node[below=2pt,fill=white] {$\cos \alpha$} (0,0);
\draw[very thick,orange] (1,0) -- node [right=1pt,fill=white]
{$\tan \alpha \color{black}=
\frac{{\color{red}\sin \alpha}}{\color{blue}\cos \alpha}$}
(intersection of 0,0--30:1cm and 1,0--1,1) coordinate (t);
\draw (0,0) -- (t);
\filldraw (15:2mm) node[green!50!black] {$\alpha$};
\foreach \x/\xtext in {-1, -0.5/-\frac{1}{2}, 1}
\draw (\x cm,1pt) -- (\x cm,-1pt) node[anchor=north,fill=white] {$\xtext$};
\foreach \y/\ytext in {-1, -0.5/-\frac{1}{2}, 0.5/\frac{1}{2}, 1}
\draw (1pt,\y cm) -- (-1pt,\y cm) node[anchor=east,fill=white] {$\ytext$};
\node[draw, align=right] at (2.7,0) {The $\color{green}\text{angle }\alpha$\\ is $30^{\circ}$ in the example ($\frac{\pi}{6}$ in radians). \\ The $\color{red}{\text{sine of }\alpha}$ , which is the height\\ of the red line is\\ ${\color{red}{\sin \alpha}}=\frac12$ \\ By the Pythagoream Theorem,\\ we have \\ ${\color{blue}\cos^2 \alpha}+{\color{red}\sin^2 \alpha}=1$. \\ Thus the length of the blue line, \\ which is the$\color{blue}{\text{cosine of }\alpha}$,\\ must be\\ ${\color{blue}\cos \alpha}=\sqrt{1-\frac14}=\frac{1}{2}\sqrt{3}$\\ This shows that $\color{yellow}{\tan \alpha}$, \\ which is the height of the orange line is \\ ${\color{yellow}{\tan \alpha}}=\frac{{\color{red}{\sin \alpha}}}{\color{blue}{\cos \alpha}}=\frac{1}{\sqrt{3}}$}; \end{tikzpicture}