[OS X TeX] A bug in (Xe)LaTeX?

Peter Dyballa Peter_Dyballa at Web.DE
Thu Aug 18 22:49:22 CEST 2005


Hello!

Two weeks ago a discussion started whether XeLaTeX could be used to  
type aesthetically appealing thing with LaTeXiT  
(http://ktd.club.fr/programmation/latexit_en.php). Its author, Pierre  
Chatelier, offered a little bit of LaTeX code to 'catch' particularly a  
mathematical formula and to report the dimensions of the box into which  
the 'caught' objects fits. Ross Moore contributed some other code to  
handle that object in pdfTeX or in classic TeX.

And I kind of 'ported' that code to XeLaTeX to find a script to do the  
same with XeLaTeX what's so easy in LaTeX. This is the test file's  
body:

	\usepackage{geometry,graphicx}
	\usepackage{ifpdf}
	\pagestyle{empty}
	\newsavebox{\latexitbox}
	\newcommand{\latexitscalefactor}{3.600000}	% used in LaTeXiT
	\newlength{\latexitwidth}
	\newlength{\latexitheight}
	\newlength{\latexitdepth}
	\setlength{\topskip}{0pt}
	\setlength{\parindent}{0pt}
	\setlength{\abovedisplayskip}{0pt}
	\setlength{\belowdisplayskip}{0pt}
	\normalfont
	
	\begin{lrbox}{\latexitbox}
	%  $\displaystyle \frac{\partial}{\partial x} f(x,y) = r^2 +  
\sum_{0}^{100} x^\frac{1}{3} \cdot y^4$
	  $\displaystyle \frac{\partial}{\partial x} f(x,y) =  
\frac{\partial}{\partial y} f(x,y) = 0$
	\end{lrbox}
	
	 
\settowidth{\latexitwidth}{\scalebox{\latexitscalefactor}{\usebox{\latex 
itbox}}}
	 
\settoheight{\latexitheight}{\scalebox{\latexitscalefactor}{\usebox{\lat 
exitbox}}}
	 
\settodepth{\latexitdepth}{\scalebox{\latexitscalefactor}{\usebox{\latex 
itbox}}}
	\addtolength{\latexitdepth}{2\fboxrule}	% correct correction (was 0.72  
pt before)
	%\addtolength{\latexitdepth}{2\fboxsep}	% length contained in  
\latexitdepth
	\addtolength{\latexitheight}{\latexitdepth}
	\newwrite\foo
	 \immediate\openout\foo=\jobname.sizes
	  \immediate\write\foo{\the\latexitdepth (Depth)}
	  \immediate\write\foo{\the\latexitheight (Height)}
	  \immediate\write\foo{\the\latexitheight (TotalHeight)}
	  \immediate\write\foo{\the\latexitwidth (Width)}
	  \immediate\write\foo{\the\fboxsep (fboxsep)}
	  \immediate\write\foo{\the\fboxrule (fboxrule)}
	\closeout\foo
	
	\begin{document}
	{\voffset=-1truein \hoffset=-1truein
	 \ifpdf
	   \pdfpageheight=\latexitheight
	   \pdfpagewidth=\latexitwidth
	 \else
	   \special{papersize=\latexitheight,\latexitwidth}%
	 \fi
	 \shipout\vbox{\scalebox{\latexitscalefactor}{\usebox{\latexitbox}}}%
	}%
	\end{document}


This is the LaTeX header:

	\documentclass[10pt]{article}
	\usepackage{color}\color[rgb]{0.000,0.000,0.000} %pour la couleur
	\usepackage{amssymb} %maths
	\usepackage{amsmath} %maths


And here is the 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,Numbers=Lining]{Hoefler Text}


I used these scripts to LaTeX

	#!/bin/sh
	jobname=latexit-2
	latex -file-line-error -interaction nonstopmode ${jobname}.tex >  
/dev/null
	x=`grep Width       ${jobname}.sizes | awk -F\( '{print $1}'`
	y=`grep TotalHeight ${jobname}.sizes | awk -F\( '{print $1}'`
	echo "$x x $y"
	dvips -q1 -T $x,$y -f ${jobname}.dvi | ps2pdf14 - AusgabeLaTeX.pdf

or to XeLaTeX the TeX documents:

	#!/bin/sh
	jobname=xelatexit-2
	xelatex -no-pdf -file-line-error -interaction nonstopmode  
${jobname}.tex > /dev/null
	x=`grep Width       ${jobname}.sizes | awk -F\( '{print $1}'`
	y=`grep TotalHeight ${jobname}.sizes | awk -F\( '{print $1}'`
	echo "$x x $y"
	xdv2pdf -p $x,$y -o AusgabeXeLaTeX.pdf ${jobname}.xdv

In both cases I got told these box dimensions: 423.05525pt x 81.84862pt  
(for LaTeX in half the time).

TeXShop 1.40 on Panther (Mac OS X 10.3.9) was used to view the PDF  
output. In both cases I see the ¶ in the numerator clipped -- both  
¶ifferently but same in the same file:


	The members of the Mac OS X TeX list are only allowed to read this  
sentence, they are not allowed to view the graphics.


Where is my mistake? Or where are my mistakes? (And why do I see the  
light green background here in Mail with the copies and not in  
TeXShop?)

Adding

	\addtolength{\latexitheight}{1.25\fboxrule}

in LaTeX to the body gives the best look with some white space above  
the ¶. Increasing or decreasing that value makes it only worse! In  
XeLaTeX this makes the ¶ fit exactly, without any space.


Outside my appartement it's full moon as I can see: does this explain  
...


At least it seems as if a way was found to do in XeLaTeX too what is  
possible in LaTeX.

--
Greetings

   Pete

"What is this talk of 'release'?  Klingons do not make software
'releases'.  Our software 'escapes' leaving a bloody trail of
designers and quality assurance people in its wake."


--
Mit friedvollen Gr٤en

   Pete

"They're putting dimes in the hole in my head to see the change in me."
--------------------- 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 Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the macostex-archives mailing list