Sign up ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to achieve the following:

  1. I want a single page to consist of N "regions."

    Each region has a x-start, y-start, and a \hbox (denoting the contents of the region).

  2. Furthermore, for each region, I want to be able to define "anchors" within the reason.

  3. I want to be able to draw arrows pointing from one anchor to another anchor.

What is the best way to achieve this in TeX?

share|improve this question
If they are floating then what does x-start, y-start represent? – Peter Grill Nov 20 '12 at 4:20
Sounds like a classical box-and-pointer diagram to me, so TikZ would be the canonical answer. If you describe a little more what the diagram should look like (or show an example), more detailed advice can be given. – Stephan Lehmke Nov 20 '12 at 4:51
The tags on this are definitely wrong. – Ryan Reich Nov 20 '12 at 5:08
I want to specify the x and y coordinates. – user19174 Nov 20 '12 at 5:32
My point was if you are specifying the x and y coordinates then they are not floating, they are a fixed spot on the page. – Peter Grill Nov 20 '12 at 6:24

1 Answer 1

up vote 4 down vote accepted

Here is one way to do it with, what else, but tikz:

enter image description here

The content is placed with

\AnchoredRegion[<draw options>]{<name of region>}{x,y}{<content>}


  • <draw options> is an optional parameter used to style the box. If you don't want the box, you can use fill=none. If you want a solid box use draw=<color>, etc...
  • <name of region> is the name given to this node which can later be used to reference it's location
  • x,y is the x and y offset form the south west corner of the page. The units for this default to cm, but if you prefer other unit you can provide them. For example {1in,1in} would be equivalent to {2.54cm,2.54cm} or {2.54,2.54}.
  • <content> is the content that is to be placed

After the boxes are placed then you can draw line from one to the other as desired with:

\DrawLines[<draw options>]{<name of region>}{<name of region>}

Only a very small subset of the options that are avilable are illustrated here. For other draw options one should refer to the tikz/pgf user manual.


  • This does require two runs. First one to determine the locations, and the second to do the drawing.
  • Note that no test is made to ensure you are no overlapping boxes. So, if that is not desired, you may need to tweak the x, y coordinates of the locations of these tikz nodes.



    % #1= draw options
    % #2= name of this node
    % #3= x,y offset from south west of current page
    % #4= content for node
    \begin{tikzpicture}[overlay,remember picture, outer sep=0, inner sep=5pt]
        \node [#1] (#2) at
            ($(current page.south west)+(#3)$)

    \begin{tikzpicture}[overlay,remember picture, outer sep=0, inner sep=5pt]
        \draw [ultra thick, #1] (#2) to (#3);

\newcommand*{\TextA}{\parbox{3.0cm}{\raggedright Some small text over two lines.}}%
\newcommand*{\TextB}{\parbox{3.0cm}{\raggedright Some longer piece of text that takes up three lines.}}%
\newcommand*{\TextC}{\parbox{3.0cm}{\raggedright Some even longer piece of text thatjust goes on and on and on and on..... Well you get the idea.}}%


    \DrawLines[out=130,in=-130,-stealth, red]
    \DrawLines[out=30,in=-90,-stealth, brown, dotted]
    \DrawLines[-stealth, violet]{BlueRegion.south}
    \DrawLines[out=-150,in=120, distance=6cm, -stealth, green]
share|improve this answer
I haven't tested, but I assume TeX has to be run twice for this to work? If yes, maybe you should add a remark to your answer. – Stephan Lehmke Nov 20 '12 at 9:26
@StephanLehmke: Thanks. That is part of my usual answers, but missed it this time -- perhaps because I removed \tikzmark as it was not needed. Have updated solution. – Peter Grill Nov 20 '12 at 23:44
Amazing. I like. – user19174 Dec 5 '12 at 0:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.