# How can I use LaTex to mark my delta y and my delta x?

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.

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.

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?

-
Do you mean drawing a graphics like this (just the first item out of thesearch)? tex.stackexchange.com/questions/69281/… The question is really difficult to understand. – percusse Mar 24 '13 at 12:29
Welcome to TeX.SE! It would be very helpful if you posted some code to show what you've tried so far. Ideally, you'd post an MWE (minimum working example), which might load various LaTeX packages, that generates the issue you're trying to resolve. – Mico Mar 24 '13 at 12:32
Yeah, something like that. Just as you would normally do it on paper. I will update the question with an image in a minute. – sammyg Mar 24 '13 at 13:04
I'm not sure this should be tagged "brackets". This is more of a graphics question. – kahen Mar 24 '13 at 14:37
It is also possible to create braces like that directly in Geogebra using a custom tool, see geogebratube.org/material/show/id/33499 – Jan Hlavacek Mar 25 '13 at 0:28

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}


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).

-
Yeah, something like that would be nice. The only problem is that I am a complete newbie when it comes to Latex. I only know some basic commands that I use on web forums. But I understand I need a text editor, right? I have just installed Texmaker. And I understand I will need some Latex distribution? I am installing MikTex right now. Will that include Tikz? Or do I need to get that separately? How do i install it? What software packages did you use to produce this graphic? – sammyg Mar 24 '13 at 15:40
@Sammy Install complete MiKTeX (Not basic installation) hoping that you use windows. That will include tikz. And Texmaker as the editor. These two suffice to do any thing like the above. I used miktex as tex distribution and winedt 7 as the editor to produce above. – Harish Kumar Mar 24 '13 at 16:33
I have managed to reproduce the same graphic using your code. Unfortunately I installed the basic MikTex version. But running the code it prompted me to install additional packages. It installed the files standalone.ds, tikz.sty, everyshi.sty, xcolor.sty and supp-pdf.mkii. I installed Texmaker separately, I installed that one first. When it couldn't run any commands I figured out I needed a Latex distribution installed. Yes, I'm on Windows. – sammyg Mar 24 '13 at 16:53
The problem for me now will be to make this my own. Can I use this setup now as a replacement for Geogebra when graphing functions? Or can I somehow integrate all this into Geogebra? There is an option in Geogebra to export the graphics as PGF/Tikz. So maybe I can export from Geogebra and then make these modifications in Texmaker using Latex? – sammyg Mar 24 '13 at 17:08
Can you please point me to some web resource where I can learn about the commands you used here? Whcih line actually describes the braces here? – sammyg Mar 24 '13 at 17:11

You could use TikZ for this thing. Position your image inside a tikzpicture environment like so:

\documentclass{standalone}
\usepackage{tikz}
\usepackage[demo]{graphicx} % Do not use demo in your code!!!

\begin{document}
\begin{tikzpicture}
\node (pic) at (0,0) {\includegraphics{test.pdf}};
\coordinate (A) at (3,4); % Play arround to get the coordinates by hand
\coordinate (B) at (8,4);
\coordinate (C) at (8,8);
% Use the code from the Question mentioned bellow and use the defined coordinates
\end{tikzpicture}
\end{document}


Then use the tip described in Draw Curly Braces in TikZ.

You could also use pgfplots and then position the nodes at some specific (x,y) coordinates and this would help you avoid manual fidling when searching for proper A, B and C coordinates.

There are some answers related to node positioning in PGF plots here:

The pgfplots manual can be found here.

-
What is TiKZ and pgfplots? Are these just some packages or extensions of some sort, or are they complete programs with user interface? And do I need both of them? If they are extensions, what are they extensions of? What software application (with a graphical user interface) can utilize these? Can I use them in Geogebra? – sammyg Mar 24 '13 at 13:41
Well TiKZ and pgfplots are packages for LaTeX. The first can handle quite a lot of vector graphics drawing needs. You can find lots of examples on texample.net. The latter is for plotting functions using TiKZ and gnuplot straight from LaTeX. I guess, that you need both only if you want to use pgfplots. Otherwise you can get away only with using TiKZ. – gns-ank Mar 24 '13 at 13:44
So can I use this in Geogebra? – sammyg Mar 24 '13 at 13:48
I guess that no. It is a solution using different tools. In this case you need to use TiKZ with PGFplots inside your LaTeX document, or you need to use Geogebra and then inside your LaTeX document you use TiKZ. – gns-ank Mar 24 '13 at 15:11
What do I input for "demo"? What is "test.pdf"? – sammyg Mar 24 '13 at 17:17