<br><div class="gmail_quote">On Wed, Mar 30, 2011 at 1:35 PM, Peter Davis <span dir="ltr"><<a href="mailto:pfd@pfdstudio.com">pfd@pfdstudio.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I'm working on a program to convert XML documents into LaTeX.  The XML has several possibly ways of specifying how an image should be placed, and I'm trying to find ways to produce LaTeX that will place the image correctly, without having to actually open the image file in the XML->LaTeX converter.</blockquote>
<div><br></div><div><br></div><div>I had some success just using \begin{picture}(w,h) to reserve the area for the picture.  Then \put(x,y) let me place the image within that area.  So I tried using Heiko's settobox package to get the dimension of the image, but the picture environment won't let me specify actual dimensions.  They apparently have to be dimensionless quantities:</div>
<div><br></div><div>\begin{picture}(400,300) %works</div><div>\begin{picture}(400pt,300pt) %fails  (! Missing number, treated as zero.)</div><div><br></div><div>I was hoping to do something like the following example, but I don't know how to get around the "missing number" problem.  Am I barking up the wrong tree?  Thanks!</div>
<div><br></div><div><div>\documentclass[letterpaper]{article}</div><div>\usepackage{graphicx}</div><div>\usepackage{grffile}</div><div>\usepackage[absolute]{textpos}</div><div>\usepackage{settobox}</div><div>\setlength{\TPHorizModule}{1bp}</div>
<div>\setlength{\TPVertModule}{\TPHorizModule}</div><div>\setlength{\parindent}{0pt}</div><div>\setlength{\unitlength}{1bp}</div><div>\pagestyle{empty}</div><div>\newlength{\imgHeight}</div><div>\newlength{\imgWidth}</div>
<div>\usepackage[paperwidth=792.000000bp,paperheight=612.000000bp]{geometry}</div><div><br></div><div>\newsavebox{\PicA}\sbox{\PicA}{\includegraphics[scale=1.0]{C:/Users/Public/Pictures/Sample Pictures/Chrysanthemum.jpg}}</div>
<div><br></div><div>\begin{document}</div><div><br></div><div>\begin{textblock}{235.000000}(12.000000,20.000000)</div><div><br></div><div>\settoboxtotalheight{\imgHeight}{\PicA}</div><div>\settoboxwidth{\imgWidth}{\PicA}</div>
<div><br></div><div>\begin{picture}(\imgWidth,\imgHeight)</div><div>\usebox{\PicA}</div><div>\end{picture}</div><div><br></div><div>\end{textblock}</div><div><br></div><div>\end{document}</div></div><div><br></div></div><br>
-- <br><span style="font-family:arial, sans-serif;border-collapse:collapse">----<div>The Tech Curmudgeon</div><div><a href="http://www.techcurmudgeon.com/" style="color:rgb(17, 65, 112)" target="_blank">http://www.techcurmudgeon.com</a></div>
<div style="font-size:10.8333px"><br></div></span><br>