Featured Book

LaTeX Beginners Guide

Who is online

In total there are 18 users online :: 0 registered, 0 hidden and 18 guests (based on users active over the past 5 minutes)
Most users ever online was 1327 on Tue Nov 05, 2013 7:11 pm

Users browsing this forum: No registered users and 18 guests

Partner Sites

TeXwelt - Fragen und Antworten goLaTeX
TeXblog
TeXnicCenter
TeXample

Curved over-head Arrows connecting Numbers

Add tags Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)

Curved over-head Arrows connecting Numbers

Postby HunterDX77M on Sun Jul 22nd, 2012

Hello all,

I am going to be teach my student about the FOIL method of multiplication. In order to do that, I thought it would be a nice visual helper if I could draw arrows curving from one number to another and I was wondering if that was possible with LaTeX.

For example if I have (a + b)*(c + d), I want to draw an arrow coming out of "a" going over "b" and terminating at "c". Can that be done with LaTeX?

Thanks for any input! :D
WARNING: You are in the presence of a n00b. Stupid questions can and will be asked.

Operating System: Ubuntu Linux 12.04 LTS
Editor/IDE: TexMaker
HunterDX77M
 
Posts: 2
Joined: Tue Jun 19th, 2012

Re: Curved over-head Arrows connecting Numbers

Postby cgnieder on Sun Jul 22nd, 2012

Clemens
------------------------------
New German Q&A site about TeX: http://texwelt.de/wissen
System: TeXlive 2013, OpenSUSE 12.3
User avatar
cgnieder
Site Moderator
 
Posts: 1696
Joined: Sat Apr 16th, 2011
Location: Germany

Re: Curved over-head Arrows connecting Numbers

Postby localghost on Sun Jul 22nd, 2012

A soluton with pgf/tikZ.
Code: Select all  •  Open in writeLaTeX
\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usetikzlibrary{calc,matrix}

\begin{document}
  \begin{equation}
    \begin{tikzpicture}[>=stealth,baseline,anchor=base,inner sep=0pt]
      \matrix (foil) [matrix of math nodes,nodes={minimum height=0.5em}] {
        ( & a & + & b & ) & \cdot & ( & c & + & d & ) \\
      };
      \path[->] ($(foil-1-2.north)+(0,1ex)$)   edge[red,bend left=45]    ($(foil-1-8.north)+(0,1ex)$)
                ($(foil-1-2.north)+(0,1ex)$)   edge[green,bend left=60]  ($(foil-1-10.north)+(0,0.5ex)$)
                ($(foil-1-4.north)+(0,0.5ex)$) edge[blue,bend left]      ($(foil-1-8.north)+(0,1ex)$)
                ($(foil-1-4.north)+(0,0.5ex)$) edge[orange,bend left=45] ($(foil-1-10.north)+(0,0.5ex)$);
    \end{tikzpicture}
 
\end{equation}
\end{document
}



Thorsten
Attachments
FOIL.png
The obtained output.
FOIL.png (7.71 KiB) Viewed 1349 times
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 13.1 (Linux 3.11.10), TeX Live 2013 (vanilla), TeXworks 0.5 (r1351)
² Posting stopped indefinitely due to offenses
User avatar
localghost
Site Moderator
 
Posts: 9219
Joined: Fri Feb 2nd, 2007
Location: Braunschweig, Germany


Return to Text Formatting

Who is online

Users browsing this forum: No registered users and 18 guests