[XeTeX] Conflict between fontspec and termcal

Morten Høgholm morten.hoegholm at gmail.com
Thu Aug 21 11:31:22 CEST 2008


On Thu, 21 Aug 2008 02:17:14 +0200, Will Robertson wrote:

> On 21/08/2008, at 6:55 AM, Alan Munn wrote:
>
>> The following minimal document using the termcal package (available
>> at CTAN) fails if fontspec is loaded.
>
> How bizarre.
> I can confirm that the problem still occurs in the most recent
> versions of XeTeX and fontspec.
>
> At this stage I've got absolutely no idea why the error is occurring
> (i.e., why fontspec would affect something like this), but I'm afraid
> I don't have time to look into termcal at this stage.

I am thinking that fontspec has nothing to do with this but rather the  
calc package as termcal uses \relax quite a bit to terminate numbers.

And I also think that I fixed that infelicity in calc some time ago - it  
just hasn't been released yet.

Here are some excerpts from the new documentation:

% When \TeX\ is scanning for a \<number> etc.\ it is
% common to terminate the scanning with a space token or by inserting
% \cs{relax}. As of version~4.3 \textsf{calc} allows \cs{relax} tokens
% to appear in places where they would usually be used for terminating
% \TeX's scanning. In short this is just before any of \texttt{+-*/)}
% or at the end of the expression being evaluated.

% \changes{v4.3}{2007/08/22}{Discard terminating \cs{relax} tokens and
%   avoid extra error message from \cs{calc at next}}


And the changed code is just this single macro:

\def\@calc at post@scan#1{%
   \ifx#1!\let\calc at next\endgroup \else
     \ifx#1+\let\calc at next\calc at add \else
       \ifx#1-\let\calc at next\calc at subtract \else
         \ifx#1*\let\calc at next\calc at multiplyx \else
           \ifx#1/\let\calc at next\calc at dividex \else
             \ifx#1)\let\calc at next\calc at close \else
               \ifx#1\relax\let\calc at next\calc at post@scan \else
                 \def\calc at next{\calc at error#1}%
               \fi
             \fi
           \fi
         \fi
       \fi
     \fi
   \fi
   \calc at next}


Try adding this to your preamble after loading fontspec (and wrapping it  
in \makeatletter and \makeatother of course)
-- 
Morten


More information about the XeTeX mailing list