[XeTeX] Shrink/expand page-height to fit
Clinton Gormley
clint at traveljury.com
Thu Jan 7 15:44:30 CET 2010
> > The column width is known beforehand, but the height isn't (other than
> > an absolute maximum for the physical page height).
> >
> > So I'd like to be able to crop the page height to fit the contents,
> > after the contents have been rendered.
>
> > Additionally, I'd like to draw a border around the content, with rounded
> > edges - obviously I need to know the content height before drawing this
> > box.
Ulrike - your solution below is JUST what I needed. Many many thanks!
Clint
>
> \documentclass{article}
> \usepackage{lipsum}
> \usepackage{tikz}
> \usetikzlibrary{backgrounds}
> \usepackage[%
> paperwidth=8cm,
> vmargin=10pt
> ]{geometry}
>
> \begin{document}
> \newbox\mycontent
> \savebox\mycontent{%
> \begin{tikzpicture}
> [background rectangle/.style=
> {double,ultra thick,draw=red,top color=blue,
> rounded corners},
> show background rectangle]
> \node[use as bounding box]{\parbox{\linewidth}{\lipsum[1]abc}};
> \end{tikzpicture}}
>
> \pdfpageheight=\dimexpr\dp\mycontent+\ht\mycontent+20pt
>
> \noindent\makebox[\linewidth]{\usebox\mycontent}
> \end{document}
>
More information about the XeTeX
mailing list