1.6.12

Align text and image on the same line?


Since you mention the need to precisely position the text, may I suggest using TikZ? Here's an example that uses one node for the image, and two nodes placed using the positioninglibrary to have a horizontal gap of 5 mm to the image, with their vertical centers positioned 5 mm and 23 mm below the top of the image:
enter image description here
The image is taken from Wikipedia
\documentclass[twocolumn]{article}
\usepackage{tikz,lipsum}
\usetikzlibrary{positioning}
\begin{document}
\lipsum[1]
{
\raggedleft
\begin{tikzpicture}
\node (bottle) {\includegraphics{normflasche}};\node [left=0.5cm of bottle.north west, yshift=-5mm] {Cap};\node [left=0.5cm of bottle.north west, yshift=-23mm] {Pearls};\end{tikzpicture}
}
\lipsum[2-6]
\end{document}

Other way

Development Phase

enter image description here

Production Phase

enter image description here

Source Code

\documentclass[twocolumn]{article}
\usepackage{graphicx,lipsum,pst-node}
\begin{document}
\lipsum[1]
\noindent
\begin{center}
{
\endlinechar=-1\relax
\newsavebox\IBox
\savebox\IBox{\includegraphics[width=0.5\linewidth]{hen.jpg}}
\newdimen\WIDTH\WIDTH=\linewidth
\newdimen\HEIGHT\HEIGHT=1\ht\IBox
\psset
{
    xunit=0.1\WIDTH,
    yunit=0.1\HEIGHT,
    nodesep=5pt,
    style=gridstyle}


\pspicture(\WIDTH,\HEIGHT)
% put figure 
\rput[bl]
    (
        \dimexpr\WIDTH-\wd\IBox\relax,
        \dimexpr\HEIGHT-\ht\IBox\relax
    ){\usebox\IBox}
% add an annotation to mouth
\pnode(0.6\WIDTH,0.8\HEIGHT){a}
\rput[rt](0.4\WIDTH,0.8\HEIGHT)
    {
        \rnode[r]{A}{Mouth}
    }
\ncline[linecolor=blue]{->}{A}{a}
% add an annotation to feet
\pnode(0.7\WIDTH,0.1\HEIGHT){b}
\rput[rt](0.4\WIDTH,0.5\HEIGHT)
    {
        \rnode[r]{B}{Feet}
    }
\ncline[linecolor=blue]{->}{B}{b}
% turn of this grid in the production phase!
%\psgrid
\endpspicture
}
\end{center}
\lipsum[2-4]
\end{document} 

No hay comentarios:

Publicar un comentario