Featured Book

LaTeX Beginners Guide

Who is online

In total there are 9 users online :: 1 registered, 0 hidden and 8 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: Bing [Bot] and 8 guests

Partner Sites

TeXwelt - Fragen und Antworten goLaTeX
TeXblog
TeXnicCenter
TeXample

write text into a graphic

Add tags LaTeX specific issues not fitting into one of the other forums of this category.

write text into a graphic

Postby 0.8.15 on Thu Sep 4th, 2008

how can i write text into a graphic. i tryed it like:

begin{figure}[h!]
\centering
\put(10,50){$F_N$}
\includegraphics[width=1.00\textwidth]{images/RubbingTIP.jpg}
\caption{Dynamic Forces which are involved while Crocking}
\label{fig:Dynamic Forces which are involved while Crocking}

...how can i add words into this graphic to explain it a bit???
User avatar
0.8.15
 
Posts: 16
Joined: Mon May 26th, 2008
Location: basel

Re: write text into a graphic

Postby spiegboy on Thu Sep 4th, 2008

just edit the picture with photoshop, imagj, acdsee, anysoftware you are familiar with, coz all of them have the basic function to add text into the pictures.
spiegboy
 
Posts: 120
Joined: Thu Dec 6th, 2007

Re: write text into a graphic

Postby Juanjo on Thu Sep 4th, 2008

This example may give you some ideas:
Code: Select all  •  Open in writeLaTeX
\documentclass[a4paper]{article}
\usepackage{graphicx}
\usepackage{pict2e}
\begin{document}

\begin{figure}[!h]
  \centering
  \setlength{\unitlength}{0.1\textwidth}
  \begin{picture}(10,9)
    \put(0,0){\includegraphics[width=\textwidth]{lion_orig.png}}
    \put(0.5,8.5){books}
    \put(0.8,8.45){\vector(1,-1){1.3}}
    \put(0.1,0.1){\framebox(2,1){The \TeX book}}
    \put(7.5,8){\dashbox{0.2}(2.5,1){The CTAN lion}}
  \end{picture}
  \caption{The CTAN lion is an artwork by Duane Bibby.}
  \label{fig:lion}
\end{figure}

\end{document
}

You can get lion_orig.png from the first link in my signature. The pict2e package enhances the default LaTeX picture environment (removes some limitations in the slopes of lines and vectors). The picture environment is described in "A (Not So) Short Introduction to LaTeX2e". See this post for links to this and other introductory LaTeX tutorials.

By the way, in the optional argument of figure, put ! before h, not after. Likewise, the argument of \label should be a short text. It is just a "label" to identify the figure, so you can cite it using \ref. Don't repeat the caption!
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
User avatar
Juanjo
 
Posts: 656
Joined: Sat Jan 27th, 2007

Re: write text into a graphic

Postby T3. on Thu Sep 4th, 2008

spiegboy wrote:just edit the picture with photoshop, imagj, acdsee, anysoftware you are familiar with, coz all of them have the basic function to add text into the pictures.

That's probably the easiest way to do it but the downside is that in-text font will ususally not match that on the graphic and that image editing software rarely (never?) has support for math.

0.8.15 wrote:begin{figure}[h!]
\centering
\put(10,50){$F_N$}
\includegraphics[width=1.00\textwidth]{images/RubbingTIP.jpg}
\caption{Dynamic Forces which are involved while Crocking}
\label{fig:Dynamic Forces which are involved while Crocking}
[...]
\put command should be used inside of the picture environment:
Code: Select all  •  Open in writeLaTeX
\begin{figure}[h!]
\centering
\begin{picture
}(100,60)% width and height of the picture
\put(0,0){\includegraphics[width=1.00\textwidth]{images/RubbingTIP.jpg}}
\put(10,50){$F_N$}
\end{picture}
        \caption{Dynamic Forces which are involved while Crocking}
        \label{fig:RubbingTIP}
\end{figure
}

The disadvantage of the picture environment is that you have to specify the width and height of the picture explicitly, but there is overpic package that automates this.

Another solution is to use TikZ and put your graphic into a node:
Code: Select all  •  Open in writeLaTeX
\documentclass[a4paper]{article}
\usepackage{graphicx}
\usepackage{tikz}
\begin{document}
\begin{figure}[h!]
\centering
\begin{tikzpicture}
\node[above right] (img) at (0,0) {\includegraphics[width=1.00\textwidth]{images/RubbingTIP.jpg}};
\node at (10pt,50pt) {$F_N$};
\end{tikzpicture}
        \caption{Dynamic Forces which are involved while Crocking}
        \label{fig:RubbingTIP}
\end{figure}
\end{document
}
TikZ will keep track of your picture size automatically.

Cheers,

Tomek
User avatar
T3.
 
Posts: 208
Joined: Fri Mar 14th, 2008

Re: write text into a graphic

Postby localghost on Thu Sep 4th, 2008

0.8.15 wrote:how can i write text into a graphic. i tryed it like [...] how can i add words into this graphic to explain it a bit???

The overpic package offers a solution for overlaying a picture with text or other LaTeX structures. In principal this is a similar approach as the suggestions from Juanjo and T3. working also with the picture environment and the graphicx package. Take a look at the documentation to learn more.


Best regards and welcome to the board
Thorsten¹
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

Re: write text into a graphic

Postby 0.8.15 on Fri Sep 5th, 2008

hey thanks for ya contributions. i also found the "overpic" command. it is quite easy to handle!!! 8-)
..........................................................................
\usepackage[percent]{overpic}

...
\begin{overpic}%[width=10cm,grid,tics=10]
{Bild}
\put(20,30){Text}
\end{overpic}
User avatar
0.8.15
 
Posts: 16
Joined: Mon May 26th, 2008
Location: basel


Return to General

Who is online

Users browsing this forum: Bing [Bot] and 8 guests