[XeTeX] Generating cropped PDF graphics file

R (Chandra) Chandrasekhar chandra at ee.uwa.edu.au
Wed Apr 16 10:04:36 CEST 2008


William Adams wrote:

> \usepackage{geometry} to set the xelatex file to the correct size to  
> begin with.

I have included below a sample file of the sort I am working with:
-----------
% logo.tex
% Demo file to generate a sample logo
%
\documentclass[10pt,a4paper,onecolumn]{article}
%
\usepackage[T1]{fontenc}
\usepackage[no-math]{fontspec}
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage[margin=25mm]{geometry}
\usepackage[cmyk,xetex]{xcolor}
%
\usepackage[active,tightpage,xetex]{preview} % Does not work with xelatex
\PreviewEnvironment{tabular}
\setlength\PreviewBorder{0pt} % valid with tightpage option
%
\pagestyle{empty}
%
\setmainfont{Minion Pro}
%
\definecolor[named]{lettercolor}{cmyk}{0, 0.75, 0.75, 0.50}
\definecolor[named]{linecolor}{cmyk}{0.5, 0.1, 0.5, 0.25}
%
\newlength{\mlength}
\newsavebox{\logobox}
%
\begin{document}
\settowidth{\mlength}{\Huge{M}}
\sbox{\logobox}{%
\begin{tabular}{c}
\color{linecolor}\rule[0.0em]{\mlength}{2pt}\\
\color{lettercolor}\Huge{M}\\[-6pt]
\color{linecolor}\rule[0.0em]{\mlength}{2pt}
\end{tabular}
}
%
\usebox{\logobox}
%
\end{document}
-----------

Given that the "bounding box" of the logo text is not known beforehand, how 
might I use the geometry package to the correct size initially in the preamble?

Thanks.

Chandra
16 Apr 08


More information about the XeTeX mailing list