In LaTeX, how can I place text over an imported graphics object? [closed]
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this questionI have an image in the eps format that I want to include in my document. The image contains only the geometry of the object; it does not contain the necessary text. It has some ar开发者_如何学编程rows, and I'd like to add the text in LaTeX so the labels (which include math) look clean.
How can I place an equation at a particular location over an imported figure?
You can use pgfonlayer and tikz. It is a bit complicated, but here is an example I have from a beamer presentation:
\pgfdeclarelayer{foreground}
\pgfdeclarelayer{background}
\pgfsetlayers{background,main,foreground}
\begin{tikzpicture}
\begin{pgfonlayer}{foreground}
\path (1.0,2.0) node (c) {{\color{blue} Some info...}}
(1.0,1.5) node (b) {{\color{blue}... which is cool!}};
\end{pgfonlayer}
\begin{pgfonlayer}{background}
\path (0,0) node (o) {
\includegraphics[width=\textwidth]{./figures/somefigure.eps}};
\end{pgfonlayer}
\end{tikzpicture}
Look at the overpic package by Rolf Niepraschk: http://www.ctan.org/pkg/overpic It combines includegraphics (graphicx package) and a picture environment. It is very easy to use!
The psfrag package enables you to splice arbitrary LaTeX, including math, in place of text appearing in a .eps file. I find it indispensable.
You might want to look into the textpos package. See here
I decided to just attempt to use \rput(x,y){text}
, and it worked after some trial and error with the coordinates. This is working for now but I'm still interested if someone has a better way. :)
精彩评论