[OS X TeX] Creating a dvi file

Bruno Voisin bvoisin at mac.com
Mon Apr 16 18:55:18 EDT 2007

On 16 avr. 07, at 19:17, Roussanka Loukanova wrote:

> Thanks, Bruno. We touched upon this issue before. You've described  
> it clearly, incl. the pending problems.
> On Mon, 16 Apr 2007, Bruno Voisin wrote:
>> There's one annoying problem, though: for each .png, .jpg and .pdf  
>> file that it attempts to include, LaTeX expects to find a  
>> matching .bb file containing bounding box information for that  
>> file. Otherwise LaTeX will complain and then stop. There may be  
>> utilities to create such .bb files from the original .png, .jpg  
>> and .pdf files, but I'm not aware of them.

Looking a bit more, it seems the identify tool of the ImageMagick  
suite (available through i-Installer, in particular) offers a way to  
get the bounding box for most graphical file formats. See:


Specifically, running identify in the form:

	identify -format %@ document

where document is an image file, seems to return the bounding box as  
(without the spaces):

	width x height + llx + lly

where using the same notation as in the graphicx package:

llx = horizontal coordinate of the lower left corner
lly = vertical coordinate of the lower left corner
urx = llx + width = horizontal coordinate of the upper right corner
ury = lly + height = vertical coordinate of the upper right corner

I tested that guess with three files of mine, each in a different  

$ identify -format %@ 403.jpg
$ identify -format %@ fig8f.png
$ identify -format %@ fig3.pdf

Then, supposing that for a given image file the 4 quantities llx,  
lly, urx, ury have been computed based on the output of "identify - 
format %@", there are three ways to include the file in a LaTeX  
document. Suppose the image file is myimage.png:

- Method 1: use the graphics package and:


- Method 2: use the graphicx package and:

	\includegraphics[bb = llx lly urx ury]{myimage.png}

- Method 3: create a file myimage.bb containing the single line:

	%%BoundingBox: llx lly urx ury

then use either the graphics or graphicx package and:


Now one problem remains, to make the process automatic: the creation  
of a script which, applied to any image file:

- Runs "identify -format %@" on that file.

- Extracts from the output, of the form (without the spaces) "width x  
height + llx + lly", the values of llx, lly, urx = llx + width, ury =  
lly + height.

- Writes, in the directory of the image file, a file with the same  
name, extension .bb and content the single line (replace llx, lly,  
urx, ury by their values):

	%%BoundingBox: llx lly urx ury

Creating such a script is way beyond my competence. One needs also  
confirmation that the output of "identify -format %@" must indeed be  
interpreted as "width x height + llx + lly".

Now I'm really stopping to look at this!

Bruno Voisin

------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/

More information about the MacOSX-TeX mailing list