Take the 2-minute tour ×
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 try to achive something like this: Map with explaining pictures

It is a photo I made in the local zoo. Sorry for the poor quality.

I like the idea of a map containing explaining images and try to do the same with beamer. Unfortunately my output is very poor. My first attempt has the following code:

\PassOptionsToPackage{demo}{graphicx}
\documentclass[a4paper]{beamer}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[remember picture, overlay]
  \node[] (image) at (current page.center) {\includegraphics[width=0.6\textwidth]{map.jpg}};
  \begin{scope}[x={(image.south east)},y={(image.north west)}]
    \node[] (descriptionimage) at (1.1, 0.25) {\framebox{\includegraphics[width=0.15\textwidth]{bird.jpg}}};
    \node[] (markhere) at (0.7, 0.25) {};
    \draw [thin, red, fill=red] (markhere) circle (4pt);
    \path[->,red] (descriptionimage) edge [out=90, in=0] (markhere);
  \end{scope}
\end{tikzpicture}
\end{document}

Since I don't use tikz very often I have no idea of how to draw elegant lines between the markhere node (maybe dotted lines) and how to get the small description text below the explaining image.

Could anyone help me to find a more elegant solution and maybe find a more elegant code?

share|improve this question
    
You code looks pretty OK. Can you elaborate on the kind of elegance you are looking for? –  percusse Nov 21 '12 at 13:33
    
The arrow looks quite ungracefull. I'd like to have more modern looking lines (dotted lines horizontal and vertical lines). Is there a way to say "mark here on the map, place the picture here and 'autoroute' a nice looking connection between the mark and the pic"? I'm also looking for a way to set a little text under the explaining pics (see picture above). –  schmendrich Nov 21 '12 at 13:42
    
Do you have those beautiful cut-out animal pictures? Can you sample one here such that we can use it in the solution? I guess any world map will do. –  percusse Nov 21 '12 at 13:52
    
To be honest, I only want to adapt the idea. What I really want to do is to show a technical drawing, mark a point and show a detail (a photo) in the explaining picture. The photos I will use will be cut-out. In my next two comments I will post links to a map and another picture (because of the long link text) –  schmendrich Nov 21 '12 at 13:57
    
A Worldmap: google.de/… –  schmendrich Nov 21 '12 at 13:59
show 3 more comments

4 Answers

You could relatively easily knit your own functions to accomplish this with varying degrees of automation. Here's a starting point building on Simplest way to overlay a text + rectangle label an image?:

\begin{tikzonimage}{bottle.jpg}
    \nicelabel{0.5,0.92}{Lid}
    \nicelabel[nice label position=below right]{0.7,0.56}{Pearls}
    \nicelabel[nice label position=above left]{0.3,0.1}{Corner}
\end{tikzonimage}


Full code:

\documentclass{article}
\usepackage{onimage}

\tikzset{nice label position/.is choice,
    nice label position/above right/.code={
        \def\xpos{1.2}
        \def\startangle{45}
        \tikzset{nice label/.style={anchor=west, yshift=4ex}}
    },
    nice label position/below right/.code={
        \def\xpos{1.2}
        \def\startangle{-45}
        \tikzset{nice label/.style={anchor=west, yshift=-4ex}}
    },
    nice label position/above left/.code={
        \def\xpos{-0.2}
        \def\startangle{135}
        \tikzset{nice label/.style={anchor=east, yshift=4ex}}
    },
    nice label position/below left/.code={
        \def\xpos{-0.2}
        \def\startangle{225}
        \tikzset{nice label/.style={anchor=east, yshift=-4ex}}
    }
}

\newcommand{\nicelabel}[3][]{
    \tikzset{nice label position=above right,#1}
    \node (highlight) at (#2) [circle, draw, orange, ultra thick, minimum width=0.75cm] {};
    \node (label) at (#2-|{\xpos,0}) [nice label] {#3};
    \draw [orange, thick] (highlight) -- ++(\startangle:1.414*4ex) -- (label);
}

\begin{document}
\begin{tikzonimage}{bottle.jpg}
    \nicelabel{0.5,0.92}{Lid}
    \nicelabel[nice label position=below right]{0.7,0.56}{Pearls}
    \nicelabel[nice label position=above left]{0.3,0.1}{Corner}
\end{tikzonimage}
\end{document}
share|improve this answer
1  
Your example has a siginficant lack of birds ;) –  Martin H Nov 21 '12 at 16:03
add comment

For a paper I once wrote I used the spy library of tikz to zoom into a photo. Maybe you can whip up something with the code below.

\documentclass{article}

\usepackage{graphicx}
\usepackage{tikz}
    \usetikzlibrary{spy}
\usepackage[pdftex,active,tightpage]{preview}
    \PreviewEnvironment{tikzpicture}

\newcommand{\imsize}{\linewidth}
\newlength\imagewidth
\newlength\imagescale

\begin{document}

\pgfmathsetlength{\imagewidth}{\imsize}
\pgfmathsetlength{\imagescale}{\imagewidth/5700}
\begin{figure}
    \centering
    \def\magnification{3}
    \begin{tikzpicture}[x=\imagescale,
        y=-\imagescale,
        spy using outlines={rectangle, magnification=\magnification,size=100}]
        \node[anchor=north west,inner sep=0pt,outer sep=0pt] at (0,0) {\includegraphics[width=\imagewidth]{World_map_blank_gmt}};
        \spy [red,connect spies] on (1490,988) in node at (0,2000);
        \node at (0,3000) {Florida};
        \spy [red,connect spies] on (3392,1812) in node at (5700,500);
        \node at (5700,1500) {Madagascar};
    \end{tikzpicture}
\end{figure}

\end{document}

enter image description here

share|improve this answer
    
This is nice, but in this case I don't need a zoomed section of the big picture. I want to "fill the spy glass" with a different pictures. However I will copy your code. I'm shure I will need it someday. –  schmendrich Nov 23 '12 at 9:11
add comment

I used a suggestion from the comments and used inkscape + latex export to render the text. This is strictly speaking not an answer to your question but might solve the underlying problem. Took two minutes to create.

\documentclass{article}

\usepackage{graphicx,xcolor}

\begin{document}

\input{murica.pdf_tex}

\end{document}

enter image description here

share|improve this answer
add comment

I got some nice answers now but I tried to solve it by myself. This is the code:

\PassOptionsToPackage{demo}{graphicx}
\documentclass[a4paper]{beamer}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[remember picture, overlay]
  %Hauptbild einfügen
  \node (image) at (current page.center) {\includegraphics[width=0.8\textwidth]{map}};
  \begin{scope}
    %Markierungskoordinaten
    \node[xshift=-.11cm, yshift=1.3cm] (markhere) at (image.center) {};
    %Markierung zeichnen (Kreis)
    \draw [very thick, red, minimum width=.5cm] (markhere) circle (4pt);
    %Nebenbild einfügen
    \node [xshift=4.5cm, yshift=-.5cm, inner sep=o](descriptionimage) at (image.center) {\framebox{\includegraphics[width=1.5cm]{gimpel}}};
    %Pfad zeichnen
    \coordinate [left=2cm of descriptionimage](between node);
    \draw[red, very thick, dotted] (markhere.east) -| (between node) -+ (descriptionimage.west);
  \end{scope}
\end{tikzpicture}
\end{document}

which gives me the following result:

enter image description here

As you can see, there is a gap in the between node and left of the descriptionimage. I'm wondering why are these gaps there and how could I let them disappear?

Edit: Problem solved after reading Jake's comment.

share|improve this answer
1  
Don't use \node when all you need is a \coordinate (or a \node with the coordinate key). Nodes by default introduce white space due to the inner sep, whereas coordinates don't. –  Jake Nov 21 '12 at 22:03
    
Thanks a lot. This and your hint about inner sep helped to solve the problem. –  schmendrich Nov 21 '12 at 22:19
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.