[XeTeX] XeTeX output of less than a complete page

Peter Dyballa Peter_Dyballa at Web.DE
Mon Aug 15 22:44:38 CEST 2005


Hello!

LaTeXiT (http://ktd.club.fr/programmation/latexit.php) is an  
application to create big scaled images of for example a formula to  
embed it in another application's file. Recently it was asked whether  
XeLaTeX could be used to create such images too. LaTeXiT allows the use  
of XeLaTeX instead of pdfLaTeX, but when it comes to scaling of the  
produced picture it comes to an end: while pdfLaTeX produces a tight  
BoundingBox, XeLaTeX creates one as big as the sheet of paper used.

Is there a way to create such a tight output with xdv2pdf?

Or is there a clever tool that can crop the proper image from the page?

The test code Pierre Chatelier uses is:

	\pagestyle{empty}
	\usepackage{geometry}
	\usepackage{graphicx}
	\newsavebox{\latexitbox}
	\newcommand{\latexitscalefactor}{3.600000}
	\newlength{\latexitwidth}
	\newlength{\latexitheight}
	\newlength{\latexitdepth}
	\setlength{\topskip}{0pt}
	\setlength{\parindent}{0pt}
	\setlength{\abovedisplayskip}{0pt}
	\setlength{\belowdisplayskip}{0pt}
	\normalfont
	\begin{lrbox}{\latexitbox}
	  $\displaystyle toto$
	\end{lrbox}
	 
\settowidth{\latexitwidth}{\scalebox{\latexitscalefactor}{\usebox{\latex 
itbox}}}
	 
\settoheight{\latexitheight}{\scalebox{\latexitscalefactor}{\usebox{\lat 
exitbox}}}
	 
\settodepth{\latexitdepth}{\scalebox{\latexitscalefactor}{\usebox{\latex 
itbox}}}
	\newwrite\foo \immediate\openout\foo=\jobname.sizes  
\immediate\write\foo{\the\latexitdepth (Depth)}
	  \immediate\write\foo{\the\latexitheight (Height)}
	\addtolength{\latexitheight}{\latexitdepth}
	\addtolength{\latexitheight}{0.720000 pt}
	\addtolength{\latexitheight}{0.000000 pt}
	\addtolength{\latexitwidth}{0.000000 pt}
	  \immediate\write\foo{\the\latexitheight (TotalHeight)}
	  \immediate\write\foo{\the\latexitwidth (Width)}
	\closeout\foo  
\geometry{paperwidth=\latexitwidth,paperheight=\latexitheight,margin=0pt 
,left=0.000000 pt,top=0.000000 pt}
	\begin{document}
	  \scalebox{\latexitscalefactor}{\usebox{\latexitbox}}
	\end{document}

either with a LaTeX header

	\documentclass[10pt]{article}
	\usepackage{color}\color[rgb]{0.000,0.000,0.000} %pour la couleur
	\usepackage{amssymb} %maths
	\usepackage{amsmath} %maths
	\usepackage[utf8]{inputenc} %utile pour taper directement les  
caractères accentués

or with a XeLaTeX header

	\documentclass[10pt]{article}
	\usepackage{color}\color[rgb]{0.000,0.000,0.000} %pour la couleur
	\usepackage{amssymb} %maths
	\usepackage{amsmath} %maths
	\usepackage{xunicode,fontspec}
	\setromanfont[Mapping=tex-text]{Hoefler Text}

When running the files TeX creates files <jobname>.sizes that will  
contain:

0.0pt(Depth)
22.14287pt(Height)
22.86287pt(TotalHeight)
60.90016pt(Width)

The BoundingBoxes, reported by gs (in big points) or pdfinfo (obviously  
in big points too), will be slightly different in the LaTeX case, and  
very different for XeLaTeX's output:

		  LaTeX		 gs bbox [big pt]      [TeX pt]
------------------------------------------------------------
gs		pdfLaTeX	=>  59.2746 × 22.4467 = 59.497 × 22.531
pdfinfo	pdfLaTeX	=>  60.6726 x 22.7775 = 60.900 × 22.863
gs		 XeLaTeX	=>  59.3459 × 22.464  = 59.568 × 22.548
pdfinfo	 XeLaTeX	=>  595 x 842 pts (A4)

pdfinfo can be very exact ...


Looking at the output of XeLaTeX it puts the string `toto´ into the  
upper left corner and all the rest on the big page is blank space.  
pdfLaTeX produces a page as small as the tight box around the string  
...

--
Greetings

   Pete

                   Sorry my terrible English, my native language Lisp!



More information about the XeTeX mailing list