If I draw a triangle in stand alone, how do I label my drawing? I am able to draw my picture but I cant label any of the angles or sides.
-
4And which code exactly are you using? How are you drawing your image? Please add a complete, minimal version of the document showing the relevant settings. – Gonzalo Medina Apr 28 '14 at 00:10
-
Why would standalone make a difference? Does it work when you don't compile it with standalone? – cfr Apr 28 '14 at 01:28
-
http://tex.stackexchange.com/a/173270/19356 should help you. – kiss my armpit Apr 28 '14 at 02:17
2 Answers
With angles library, it is easy.
\documentclass[tikz,border=5pt]{standalone}
\usetikzlibrary{angles}
\begin{document}
\begin{tikzpicture}
\draw (0,0) coordinate (A) -- node[midway,below]{A} (5,0) coordinate (B)
-- node[midway,right]{B} (2.5,5) coordinate (C) -- node[midway,left]{C} (A)
pic [fill=olive!50] {angle = A--B--C}
pic [draw,<-,red,thick,angle radius=5mm] {angle = C--B--A}
pic [draw,<-,red,thick,angle radius=5mm] {angle = B--A--C}
pic [draw,<-,red,thick,angle radius=5mm] {angle = A--C--B};
\end{tikzpicture}
\end{document}

It is not exactly clear what your question is. But, I am guessing that you want to alter the a diagram in the main text that is done as a standalone diagram. If that is the case, you could make use of \providecommand and .provide style (as per the link in the References below) to define the standalone diagram.
The MWE below consists of three files:
MyPreamble.stywhich contains the preamble for both the main file and thestandalonefigure.MyTriangle.texwhich is the standalone figure.- The main .tex file which
\inputsMyTriangle.texthree times with altered the settings.
The first figure is the default figure, the second shows a case where you don't want any text labels, and the third shows how to change the labels. Also illustrated is how to change the style of the figure:

References:
Code:
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{MyPreamble.sty}
\usepackage{standalone}
\usepackage{tikz}
%% https://tex.stackexchange.com/questions/22640/is-there-something-like-providetikzstyle-similar-to-providecommand
\tikzset{/handlers/.provide style/.code={%
\pgfkeysifdefined{\pgfkeyscurrentpath/.@cmd}{}%
{\pgfkeys {\pgfkeyscurrentpath /.code=\pgfkeysalso {#1}}}%
}}
\end{filecontents}
\begin{filecontents*}{MyTriangle.tex}
\documentclass[tikz,border=5pt]{standalone}
\usepackage{MyPreamble}
\begin{document}
\providecommand*{\SideALabel}{$A$}%
\providecommand*{\SideBLabel}{$B$}%
\providecommand*{\SideCLabel}{$C$}%
\tikzset{My Line Style/.provide style={thick, black}}
\tikzset{My Node Style/.provide style={}}
\begin{tikzpicture}[scale=0.5]
\draw [My Line Style] (0,0) coordinate (A)
-- node[midway,below, My Node Style] {\SideALabel} (5,0) coordinate (B)
-- node[midway,right, My Node Style] {\SideBLabel} (2.5,5) coordinate (C)
-- node[midway,left, My Node Style] {\SideCLabel} (A);
\end{tikzpicture}
\end{document}
\end{filecontents*}
\usepackage{MyPreamble}
\begin{document}
\begin{minipage}{0.3\linewidth}
\input{MyTriangle.tex}%
\end{minipage}
\begin{minipage}{0.3\linewidth}
\tikzset{My Line Style/.provide style={ultra thick, draw=blue, fill=yellow}}
\tikzset{My Node Style/.provide style={text=white}}
\input{MyTriangle.tex}%
\end{minipage}
\begin{minipage}{0.3\linewidth}
\newcommand{\SideALabel}{$X$}%
\newcommand{\SideBLabel}{$Y$}%
\newcommand*{\SideCLabel}{$Z$}%
\tikzset{My Line Style/.provide style={ultra thick, draw=none, fill=green}}
\tikzset{My Node Style/.provide style={text=red}}
\input{MyTriangle.tex}%
\end{minipage}
\end{document}
- 223,288