[OS X TeX] Emulating LaTeXit with regular latex

Alan Munn amunn at gmx.com
Mon Aug 30 11:44:05 EDT 2010


Thanks, Ross.  This is very helpful.  It's always useful to learn some  
new tricks.

Alan

On Aug 29, 2010, at 5:50 PM, Ross Moore wrote:

> Hi Alan,
>
> On 30/08/2010, at 12:28 AM, Alan Munn wrote:
>
>> On Aug 29, 2010, at 2:05 AM, Ross Moore wrote:
>
>>>
>>> Presumably this is what LaTeXit does. Certainly it is what  
>>> LaTeX2HTML does, when it makes images for use with web pages.
>
> Actually, LaTeX2HTML does not do it this way.
> It crops a larger page down to the desired size.
>
>>> There may be some more graphics manipulations to get the size and  
>>> resolution correct. This is all pretty standard technology, for  
>>> say 20 years or more now.
>>
>>
>> Hi Ross, it may be standard technology, but not for (mere) LaTeX  
>> users like me, I think, since \shipout is a command that although  
>> I'm aware of its existence, I've certainly had no occasion to use.   
>> (Especially since any discussion of TeX's output routine (which is  
>> where \shipout is most often used?) usually comes along with dire  
>> warnings about how tricky it can be :-).
>
> True. But that is about building a full page,
> with header, footer, margins, floats, background, etc.
> That is all rather complicated, and not to be meddled
> with lightly.
>
>>
>> I guess I'll read up a bit on output routines
>
> This has nothing to do with the \output routine.
> You can just \shipout a box, whenever you want,
> irrespective (touchwood) of what is in the rest
> of the document.
>
>> although a simple example that would get me started would probably  
>> help too.
>
> Try the following, in both pdfLaTeX and XeLaTeX,
> to get the right idea.
>
>
> \documentclass{article}
> \usepackage{amsmath,color,graphicx}
> \usepackage{ifpdf}
> \usepackage{ifxetex}
>
> \newbox\shipbox
>
> \edef\fullpagesize{\noexpand\special{papersize=\the\paperwidth, \the 
> \paperheight}}
>
> \begin{document}
>
> This is stuff on this page.
>
> {\fboxrule=0pt
> \setbox\shipbox =\hbox{\framebox{$c^2 = a^2 + b^2$}}
> \hsize=\wd\shipbox
> \dimen0=\ht\shipbox \advance\dimen0 by\dp\shipbox
> \def\thispagedimens{}%
> \ifpdf
> \pdfpagewidth=\hsize
> \pdfpageheight=\dimen0 \relax
> \else
> \ifxetex
>  \edef\thispagedimens{\noexpand\special{papersize=\the \hsize, \the 
> \dimen0}}%
> \else
>  \typeout{What is the driver?
> You may need \string\special\space support to set the page size.}%
> \fi\fi
> \hoffset=-1truein \voffset=-1truein
> \immediate\shipout\vbox to \hsize{\noindent\box\shipbox 
> \thispagedimens}%
> \ifxetex\aftergroup \fullpagesize\fi
> }
>
> And even more stuff on the same page.
>
> \end{document}
>
>
> You can easily turn the above coding into a macro.
>
> Note how you need to pass the page size to the PDF engine,
> via setting primitives locally, or with a \special .
> If a \special is used, then you may subsequently need another
> to reset to the full paper size, for the surrounding document.
>
>>
>> Alan
>>
>> -- 
>> Alan Munn
>> amunn at gmx.com
>
>
> Hope this helps,
>
> 	Ross
>
> ------------------------------------------------------------------------
> Ross Moore                                       ross.moore at mq.edu.au
> Mathematics Department                           office: E7A-419
> Macquarie University                             tel: +61 (0)2 9850  
> 8955
> Sydney, Australia  2109                          fax: +61 (0)2 9850  
> 8114
> ------------------------------------------------------------------------
>
>
>
> ----------- Please Consult the Following Before Posting -----------
> TeX FAQ: http://www.tex.ac.uk/faq
> List Reminders and Etiquette: http://email.esm.psu.edu/mac-tex/
> List Archive: http://tug.org/pipermail/macostex-archives/
> TeX on Mac OS X Website: http://mactex-wiki.tug.org/
> List Info: http://email.esm.psu.edu/mailman/listinfo/macosx-tex
>

-- 
Alan Munn
amunn at gmx.com







More information about the MacOSX-TeX mailing list