[OS X TeX] Math mode in TikZ question

Dietrich, Daniel L Daniel.L.Dietrich at nasa.gov
Tue Jan 22 09:14:25 EST 2008


Morten,

Thanks very much.  I understand and will get a more recent version.   
I appreciate the detailed description.  I certainly would have never  
looked that deeply to find the issue.

Cheers,

Dan

On Jan 19, 2008, at 4:47 PM, Morten Høgholm wrote:

> On Fri, 18 Jan 2008 22:03:00 +0100, Dietrich, Daniel L wrote:
>
>
>> I can work around it using the other two, but I
>> don't know why '\:' gives an error.  I'm not that proficient in LaTeX
>> and tikz, so I'm probably missing something simple.
>
> The solution is to grab a more recent version.
>
> But I will shed some light on it (if you want, else just stop  
> reading :-). Modelled on the LaTeX kernel definition of  
> \@ifnextchar, the version you have includes the following piece of  
> code:
>
> \long\def\pgf at ifnextchar#1#2#3{%	
>   \let\reserved at d=#1%	
>   \def\reserved at a{#2}%	
>   \def\reserved at b{#3}%	
>   \futurelet\pgf at let@token\pgf at ifnch}	
> \def\pgf at ifnch{%	
>   \ifx\pgf at let@token\pgf at sptoken	
>     \let\reserved at c\pgf at xifnch	
>   \else	
>     \ifx\pgf at let@token\reserved at d	
>       \let\reserved at c\reserved at a	
>     \else	
>       \let\reserved at c\reserved at b	
>     \fi	
>   \fi	
>   \reserved at c}	
> \def\:{\global\let\pgf at sptoken= } \:	
> \def\:{\pgf at xifnch} \expandafter\def\: {\futurelet\pgf at let@token 
> \pgf at ifnch}
>
> The purpose of the last two lines is to make the control sequence  
> \pgf at xifnch also remove a space token so that the \futurelet  
> doesn't see the same space token over and over again.
>   \def\pgf at xifnch {\futurelet\pgf at let@token\pgf at ifnch}
> doesn't work, therefore \: is used because a space after it is not  
> ignored. This works in the LaTeX kernel because \: is given a new  
> definition afterwards but is is rather bad coding style: If you  
> want to use temporary variables also used elsewhere ensure a) it  
> all happens in a group, b) they are erased immediately or c) the  
> user can't use the temporary variable.
>
> A better method IMNSHO is something such as
>   \@firstofone{\global\let\pgf at sptoken= } % space, not EOL
>   \@firstofone{\def\pgf at xifnch} {\futurelet\pgf at let@token\pgf at ifnch}
>
> A more generic method allowing to gobble any kind of token is found  
> in the l3token module in the expl3 code from the LaTeX Project web  
> site.
>
> Cheers,
> -- 
> Morten
>
> -------------------------- Helpful Info --------------------------
> TeX FAQ: http://www.tex.ac.uk/faq
> List Reminders and Etiquette: http://www.esm.psu.edu/mac-tex/list/
> List Info: http://email.esm.psu.edu/mailman/listinfo/macosx-tex
> List Archive: http://tug.org/pipermail/macostex-archives/
> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
>




More information about the MacOSX-TeX mailing list