1

I have many PNG files, and I want to put them in a latex page in certain positions. Could you please help me how?

I cannot use tabular idea, as many of images are diagonal and using table does not let use of all the page.

I have tried the following so far, which has two problems:

\def\Put(#1,#2)#3{\leavevmode\makebox(0,0){\put(#1,#2){#3}}}
\Put(0,0){ \includegraphics[width=2in]{alanine.png} }
\Put(100,0){  \includegraphics[width=2in]{arginine.png} }
  1. I don't know how to caption each image.
  2. The whitespace of one image covers the other image.

One of the images is as follows: enter image description here

  • 1
    You need to show what you have tried. -and a picture of what you want. – hpekristiansen Feb 7 '15 at 2:17
  • Especially the bit about the images being diagonal. I've never come across a PNG which was not rectangular. I strongly suspect that TeX is not the right tool for the job. (Not to say it can't be done in LaTeX. Just to say that it probably shouldn't be.) – cfr Feb 7 '15 at 2:19
  • Can you provide some diagonal pictures? – user11232 Feb 7 '15 at 2:20
  • The drawing in the picture is diagonal. They are mainly genes and proteins. To use the space in the page I want my images overlap when they have white spaces. – user35555 Feb 7 '15 at 2:36
  • 1
    Using an image editor you can replace a white background with a transparent one. Tikz is your best package for overlapping images and adding captions in odd locations. See tex.stackexchange.com/questions/150367/… as an example. – John Kormylo Feb 7 '15 at 4:17
3

So, I took a previous answer of mine and made it more serious by using captions rather than just minipage text. The I took your image saved it as molecule-orig.png and used imagemagic convert:

 convert molecule-orig.png -transparent white molecule.png

So the background in molecule.png is transparent and doesn't obscure the car.

enter image description here

\documentclass{article}
\usepackage{graphicx,capt-of}
\begin{document}

\setlength\unitlength{1cm}
\vspace*{\fill}
\noindent
\begin{picture}(0,0)\bfseries\large
\put(4,3){\includegraphics{house}}
\put(0.5,5){\parbox{5cm}{\raggedright
\captionof{figure}{If you are feeling generous 
I'd like a house, preferably one with architectural
design integrity, like this}}}

\put(0,17){\includegraphics{car}}
\put(8,21.5){\parbox{3cm}{\raggedright
\captionof{figure}{I'd like a \textbf{Car},
preferably with four wheels.}}}

\put(0,10){\includegraphics{computer}}
\put(0,9){\parbox{6cm}{\raggedright
\captionof{figure}{A new \textbf{computer}
would be nice. (I won't need vim)}}}



\put(8,12){\includegraphics{cake}}
\put(9,11.5){\parbox{3cm}{\raggedright
\captionof{figure}{\textbf{Cake}, of course}}}


\put(5,15){\includegraphics[scale=.4]{molecule}}
\put(10,18){\parbox{3cm}{\raggedright
\captionof{figure}{one of these is apparently needed}}}


\end{picture}
\end{document}
  • 2
    You are almost the father of Latex Mr. Carlisle. I am so honoured to receive this very illustrative and educational answer from you. – user35555 Feb 8 '15 at 18:55
  • Good God, David… – Sean Allred Apr 11 '15 at 22:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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