I have a .tex file which goes something like this:


and more......

I use the above latex file to finally create a PDF having words at particular placed XY Coordinates (known beforehand) where the put command is used. Now, apart from this, I also want to include the pictures (stored as seperate image files by the names 1.jpg, 2.jpg...) at particular X-Y Coordinates as I did with words.

What I did was, in the .tex file, I inserted this line (before the positioning of the word Swine): \Put(415,1171){\includegraphics[width=515, height=243{/home/John/Desktop/1.jpg}}

Here, (415,1171) are the coordinates and the path is the location of the image. When I try to convert the above tex file into a PDF, it shows an error (which without was working completely fine) and gives the following error and stops:

</home/John/Desktop/1.jpg, id=1, 516.93124pt x 243.91125pt>
! Illegal unit of measure (pt inserted).
<to be read again> 
  • 1
    There is a typo (missing ] after height=243. I am not sure if you can pass dimensionless arguments to width and height. Try with \includegraphics[width=515pt, height=243pt]{/home/John/Desktop/1.jpg}
    – Aditya
    Apr 9 '16 at 4:28
  • @John Package textpos can be used to position text and graphics at specific positions on a page.
    – Ross
    Apr 9 '16 at 4:34
  • @Aditya, it gives the following error: Runaway argument? 4){\makebox (15,7)[lb]{\resizebox {15\unitlength }{7\unitlength }{\raisebox \ETC . ! File ended while scanning use of \Put. <inserted text> \par <*> abc . I think this error is coming because I am not adding the line at a proper place (that is, after word Swine). Do you think I should put it somewhere else?
    – John
    Apr 9 '16 at 5:36
  • @Nunkulla, how can I add it in this file? Can you give me an example by editing the above tex file?
    – John
    Apr 9 '16 at 5:37
  • Your \Put macro needs two couples of distances before text. Try \Put(415,1171)(100,100){\includegraphics[width=515pt, height=243pt]{example-image}}. Apr 9 '16 at 6:30

The Textpos package can be useful for this purpose. The positioning of your elements would require a lot of interpretation so the following code is illustrative only. The textboxes in the example are shown relative to the margins, which are generated using the showframe option of the geometry package.

\usepackage[lmargin=24mm,rmargin=24mm,tmargin=25mm,bmargin=25mm,showframe]{geometry} %Set margins and show them
\usepackage[absolute,showboxes]{textpos} % Positioning textblocks in absolute terms




\begin{textblock}{2}(24,25) % Place a * at the intersection at the top and left margins
    $*$ %Top left

\begin{textblock}{40}(140,50) %Place an image in a box 40 mm wide 140 mm from the left edge and 50 mm from the top
    \includegraphics[scale=0.20]{example-image}%From mwe package

\begin{textblock}{20}(24,100) %Place a textblock on the left margin (24 mm), 100 mm from the top.
Swine \\
flu \\
tightens \\
its \\
grip \\
over \\

\begin{textblock}{40}(90,120) %Place a textblock 90 mm from the left edge and 120 mm from the top
Swine \\
flu \\
tightens \\
its \\
grip \\
over \\

\begin{textblock}{2}(186,272) % Place a * at the intersection of the bottom and right margins
     $*$ %Bottom right


enter image description here

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.