[OS X TeX] Auto bounding box for LaTeX document ?
Maarten Sneep
maarten.sneep at xs4all.nl
Tue Jun 21 22:47:56 CEST 2005
On 21 Jun 2005, at 22:15, Pierre Chatelier wrote:
>> For some background info: http://www.xs4all.nl/~msneep/articles/
>> baseline.html
>>
> Great that it is online !
> (just before I forget : there is a typo at the very end : <Eqaution
> instead of Equation>
OK: fixed.
>> You can do it in a single step: the preview package does that for
>> you, and it works with all displayed and in-line material.
>
> Yes, but it seems that it does not work for non mathematical text;
> example :
[snip]
Indeed, I was talking about mathematical material only. Non-
mathematical material can be done inside a parbox, a minipage, or
even just on the page (without headers) and cropping afterwards. For
single line items a normal box, and then just using the makebox trick
will even yield the baseline offset.
> Finally, I would prefer not to rely on pdfcrop not pdftk, and limit
> myself to pdflatex and gs.
> By the way, computing the tight bounding box with gs is interesting
>
>> boundingbox=`gs -dNOPAUSE -sDEVICE=bbox -dBATCH -q $pdfin 2>&1 |
>> awk -F: '/%%HiResBoundingBox/{printf "[%s]",substr($2, 2, length
>> ($2)-1)}'`
Interesting is one way of putting it, a hack is another. It took me
some time to arrive at this one, and it isn't really fast.
> But is it possible to insert this bounding box in the PDF doc
> without using pdftk ? I do not know PDF format, so I do not know
> either what should be done...
The pdf format requires a table of contents at the end of the file
which in turn contains all the offsets to the otehr objects (pages,
etc.). This table of contents is in effect a pointer table, and makes
random access fast, while still allowing the separate objects to be
compressed.
That is also why there are three stages: decompression, alteration,
and repairing the offsets and recompressing the lot.
I think you can use the Mac OS X (tiger) pdf-API to alter the
bounding box of an pdf-image, but I have to do some more reading to
be sure.
Maarten
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>
More information about the macostex-archives
mailing list