Graphics, Figures & TablesText and lines over a figure

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
jhapk
Posts: 81
Joined: Tue Apr 20, 2010 9:33 pm

Text and lines over a figure

Post by jhapk »

Hi,

I have a image like this:
http://arrow.utias.utoronto.ca/~jhapk/latex/image.jpg
and in my beamer presentation I want to change it to something like this.
http://arrow.utias.utoronto.ca/~jhapk/latex/image1.jpg
I want my lines and arrows to be very accurate and exact length that I want. I have been trying to read about and trying different packages - but I am not able to figure it out how to do it right.

Can someone tell me what is the right way to do it? And also if possible, a sample code :( I have been trying for last 6 hours :(

Thanks

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

php1ic
Posts: 192
Joined: Wed Jan 28, 2009 8:17 pm

Text and lines over a figure

Post by php1ic »

Have a look at the overpic package

http://www.ctan.org/tex-archive/macros/ ... b/overpic/

Using the image you linked as an example

Code: Select all

\documentclass[11pt,a4paper]{article}

\usepackage{xcolor}
\usepackage[percent]{overpic}


\begin{document}

\begin{figure}
\begin{overpic}[width=\textwidth]{image.jpg}
\put(30,50){\color{white}\rule{0.4\textwidth}{1pt}}
\put(30,50){\color{white}\rule{1pt}{30pt}}
\put(70,50){\color{white}\rule{1pt}{30pt}}
\put(50,45){\color{white}ABC}
\end{overpic}
\end{figure}

\end{document}
jhapk
Posts: 81
Joined: Tue Apr 20, 2010 9:33 pm

Re: Text and lines over a figure

Post by jhapk »

Hi,

is it possible to add arrows using overpic?

I looked into the manuals, but didn't find nothing.

Thanks
php1ic
Posts: 192
Joined: Wed Jan 28, 2009 8:17 pm

Text and lines over a figure

Post by php1ic »

You can either use \vector or \line to create an arrow. The vector has a very small head, so a combination of lines may be better, as in the modified code below

Code: Select all

\documentclass[11pt,a4paper]{article}

\usepackage{xcolor}
\usepackage[percent]{overpic}


\begin{document}

\begin{figure}
\begin{overpic}[width=\textwidth]{image.jpg}
\put(30,50){\color{white}\rule{0.4\textwidth}{1pt}}
\put(30,50){\color{white}\rule{1pt}{30pt}}
\put(70,50){\color{white}\rule{1pt}{30pt}}
\put(50,45){\color{white}ABC}
\put(35,50){\color{white}\vector(0,-1){5}}
\put(40,50){\color{white}\line(0,-1){4}}
\put(40,46){\color{white}\line(-1,1){3}}
\put(40,46){\color{white}\line(1,1){3}}
\end{overpic}
\end{figure}

\end{document}
see this link for information about the \line and \vector command.
http://web.mit.edu/bdr/MacData/afs/dev/ ... x-257.html
jhapk
Posts: 81
Joined: Tue Apr 20, 2010 9:33 pm

Text and lines over a figure

Post by jhapk »

Hi,

thanks for the help. That helped. I am facing a weird issue with another figure. I have a figure:
http://arrow.utias.utoronto.ca/~jhapk/l ... iatour.jpg
and I want to modify it to something like
http://arrow.utias.utoronto.ca/~jhapk/l ... atour3.jpg

In my latex file I am using the following command

Code: Select all

    \begin{figure}
      \vspace*{-1.5ex}
      \hspace*{-1.5ex}
      \begin{overpic}[width=4.5in]{Fire_breathing_2_Luc_Viatour.jpg}
	\linethickness{2.25pt}	
	\put(16,44){\color{red}\line(1,1){8}}
	\put(19,41){\color{red}\line(1,1){8}}
	\put(28,50){\color{red}\line(-1,1){4}} %line number 3
	\put(19,41){\color{red}\line(-1,1){4}} %line number 4
	\put(4,60){\color{white}Stoichiometric mix}
	\put(53,60){\color{white}Fuel}
        \put(56,59){\color{white}\vector(2,-3){15.5}}
	\put(10,8){\color{white}Oxidizer (Air)}
	\put(12,58){\color{white}\vector(1,-1){10}}
	\put(34,36){\color{white}\vector(-1,1){10}}
      \end{overpic}
    \end{figure}
When I do this, I get the following result
http://arrow.utias.utoronto.ca/~jhapk/latex/result1.png

And if I change the line length in the above mentioned line number 3 and 4 to 3, I get the following warning

Code: Select all

LaTeX Warning: \oval, \circle, or \line size unavailable on input line 88.


LaTeX Warning: \oval, \circle, or \line size unavailable on input line 88.
and my result changes to
http://arrow.utias.utoronto.ca/~jhapk/latex/result2.png

Somehow my \linethickess command is not working and also there is some issue with smaller line lenghts. Any idea what is going wrong?

The documentclass is beamer
php1ic
Posts: 192
Joined: Wed Jan 28, 2009 8:17 pm

Re: Text and lines over a figure

Post by php1ic »

Hi jhpak,

I had the same problem when I made the example I posted, which is why the arrow head is so large. However the minimum line length I could use was 3 and not 4?!.

I'm sorry, but I don't know how to solve this problem. Either create the smallest box you can and position it where you think it highlights the point the clearest, or try using some other shape to show the area, i.e. \circle, or if you have the time draw a Bezier curve to make an ellipse.

http://www.ursoswald.ch/LaTeXGraphics/p ... cture.html
Post Reply