[OS X TeX] pdf the size of printed text?

Ross Moore ross at ics.mq.edu.au
Thu Oct 5 01:28:30 CEST 2006


Hi Maarten,

On 05/10/2006, at 8:42 AM, Maarten Sneep wrote:

> On 4-okt-2006, at 0:51, Ross Moore wrote:
>
>> All these methods work, but are way more complicated than necessary.
>>  pdfTeX can do it directly.
>>
>> See the PDF examples at:
>>    http://www-texdev.ics.mq.edu.au/WARM/WARMhome/node5.html
>
> This page fails to load for me. All my comments are based on the  
> snippet below.

Hmm; dunno why.
It's all text and a few small icons.
The interesing PDFs and LaTeX source are hyperlinked to it.

Can anyone else report on the availability on this site?

>
>> These are multipage PDFs containing at least one page that
>> is sized to fit the content.
>>
>> The examples also have a link to download the (La)TeX source.
>> There's about 10 lines of TeX coding towards the end
>> that does the \shipout of a box with the correct size and
>> contents.
>>
>> Here are the relevant bits:
>>
>> \newbox\shipoutbox
>>
>> \setbox\shipoutbox=\hbox{%
>>   ... your LaTeX material ...
>>   ... properly sized and boxed ...
>> }
>>
>> \setbox0=\vbox{\kern-1truein
>>    \hbox{\kern-1truein
>>     \framebox{\box\shipoutbox }%
>>     \kern1 truein}%
>>    \kern1truein}%
>> \dimen0\ht0 \advance\dimen0\dp0
>> \pdfpageheight\dimen0
>> \pdfpagewidth\wd0
>> \shipout\box0
>>
>>
>> That's it.
>> You can put as many of these into a document as you like.
>> Then you can use \includegraphics[page=<num>]{....}
>> to extract the pages as separate PDF images,
>> for use within other LaTeX documents.
>
> This isn't that different from the code I use in http:// 
> mactextoolbox.sourceforge.net/articles/baseline.html
> The main difference is that I use LaTeX methods, while this is  
> closer to the metal, in the form of TeX code.

Yep. I use this kind of thing a lot, and know the underlying TeX
principles, so use them --- except for the \framebox, which is
unnecessary, but appropriate for these examples.

> Of course, my method is limited to a single equation, but if you  
> keep in mind what the destination most likely is (a Keynote  
> presentation), then that isn't much of a limitation. If I need a  
> latex equation in another latex document, I'll use \input, if the  
> need arises.

For multiline equation environments you'll need nested boxes.
e.g. something like this should work:

  \setbox\shipoutbox=\hbox{\setlength{\hsize}{8cm}\vbox{%
    \setlength{\textwidth}{\hsize}%
    \begin{align*}
      ... aligned mathematics ...
    \end{align*}
   }%  close the \vbox
  }%  close the \hbox

That 8cm  value can be whatever you want; you have to set it
manually, because a display always takes the full typesetting width.

Also, that \textwidth may need to be \columnwidth or \linewidth instead,
depending upon what documentclass and LaTeX packages you are using.

>
> Ross, can you phrase the advantage of this code over mine?

Here are a few things that spring to mind:

*  The shell-scripts are not needed, so there's also no need to
write values out to the log-file.

*  This coding can be used many times within the same document,
for images of different sizes. Thus there's no need to
adjust the geometry --- which affects many more things
than what is necessary for the desired results.

*  It doesn't rely upon LaTeX's complicated \output  routine
to shipout the images, after adding header/footer/floats etc.


Indeed, it can be easily wrapped into a macro,
called \shipoutimage say, that helps to keep your
source document nice and neat.


>
> Regards,
>
> Maarten
>
> Murphy's Law, supplemental: Friends come and go, but enemies  
> accumulate.
>

Hope this helps,

	Ross

------------------------------------------------------------------------
Ross Moore                                         ross at maths.mq.edu.au
Mathematics Department                             office: E7A-419
Macquarie University                               tel: +61 +2 9850 8955
Sydney, Australia  2109                            fax: +61 +2 9850 8114
------------------------------------------------------------------------


------------------------- 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 Archive: http://tug.org/pipermail/macostex-archives/




More information about the macostex-archives mailing list