[Tex/LaTex] How to use LaTex to mark the delta y and the delta x

bracketsgraphics

I know it is possible to use curly brackets (braces) in both vertical and horizontal orientation in Latex. Can I somehow use this to mark my change in y and my change in x on a Coordinate plane?

Here's an image of what I am trying to accomplish.

change in y over change in x

This graphic is produced in Geogebra 4.2 and as you can see it's a very simple idea. But I had to use the pen tool to draw the curly bracket and I used Latex to typeset the delta y and delta x. Why not use Latex for both of these?

Here's another image where I actually used Latex commands \rbrace and \underbrace to produce the brackets.

second image

It worked out pretty good in this case. But had the slope of this line been bigger and I wanted to mark a larger distance the bracket would not be long (or high) enough. What I have done with these two is I have increased it's "size" to make it bigger. But this results in a much thicker lines. Can I control the width and length of the bracket by some argument?

What is the syntax and what are the possible arguments for the \underbrace command? Is there any official resource page where I can look this up? Like a command catalog?

Best Answer

You can use decoration={brace, amplitude=5pt} from decorations.pathreplacing library of tikz.

\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}
\draw[dashed, thin,gray!50] (0,0) grid (12,12);
\draw[very thick, -latex](-1,0) -- (12,0);
\draw[very thick, -latex](0,-1) -- (0,12);
\draw[thick, ](0,0) -- (11,9);
\draw[very thick, ](8.5,6.95) -- (8.5,3);
\draw[very thick,rotate=0,decorate, decoration={brace, amplitude=5pt}] (8.7,6.95)--(8.7,3);  %%%  <----Puts the vertical brace
\draw[very thick, ](8.5,3) -- (3.7,3);
\draw[very thick,rotate=0,decorate, decoration={brace, amplitude=5pt}] (8.5,2.8) -- (3.7,2.8);  %%% Puts the horizontal brace.
\node at (9.4,5) {\Large $\Delta y$};
\node at (6.1,2.36) {\Large $\Delta x$};

\node at (3.5,3.2) {\Large A};
\node at (8.4,7.25) {\Large B};
\node at (8.7,2.7) {\Large C};

\foreach \x in {1,2,...,11} { \draw[thick] (\x,0) -- (\x,-0.2); }
\foreach \y in {1,2,...,11} { \draw[thick] (0,\y) -- (-0.2,\y); }

\foreach \x in {1,2,...,11} { \node [anchor=north] at (\x,-0.3) {\x}; }
\foreach \y in {1,2,...,11} { \node [anchor=east] at (-0.3,\y) {\y}; }
\node at (-0.5,-0.5) {0};

\end{tikzpicture}

\end{document}

enter image description here

For more details type: texdoc pgfmanual from command prompt, or goto www.texdoc.net and search for pgfmanual. You can draw your graph entirely with tikz and/orpgfplots. If you find it difficult, draw the graph in geogebra, export it as tikz code and use the lines that produce the braces with appropriate co-ordinates (The lines are pointed to by comments in code).