[XeTeX] dealing with $ character

Steffen Prohaska prohaska at zib.de
Fri Jul 9 08:29:32 CEST 2004


Hi,

On Jul 8, 2004, at 9:30 AM, Bruno Voisin wrote:

> Le 8 juil. 04, à 09:00, Jonathan Kew a écrit :
>
>> It's not quite the same issue as the accent commands; at least the  
>> legacy TeX fonts support the standard character code for dollar, so a  
>> definition such as \char"24 (or changing the \catcode so that $  
>> simply prints as itself) should access the right glyph in anything  
>> except special legacy symbol fonts. The trouble with the accent  
>> commands is that the CM fonts have accents at non-standard code  
>> positions and so the macro definitions are inherently font-specific.
>
> Well, it looks like what would be needed is a motivated individual  
> writing a .tex file redefining all such predefined plain TeX control  
> sequences (\$ \' etc.) in terms of the corresponding Unicode code  
> points, and similarly for LaTeX (chasing beforehand all such control  
> sequences inside the various LaTeX files where they reside, i.e. .ltx,  
> .enc, textcomp.sty files etc.). (I can't be this individual, sorry.)
>

Here's a file which I tried to get completely working for me. I also  
attached it in an archive to protect the unicode encoding. You might  
want to use the attached version. I basically tried to get ö and --  
working together with bibtex in the 'usual' (pdftex) way. But I'm  
stuck. I can't figure out how to deal with --. I followed the  
description of 'hanging punctation' from the TeXbook as pointet out  
suggested by Jonathan Kew recently.

I'm not sure if all this will work for me. The basic question arose: Is  
it possible to 'undefine' all the unwanted stuff from the plain/latex  
format afterwards and clean them up for 'utf-8' font encoding. This  
would mean to remove all the \".. \' macros and replace them with  
unicode safe ones. The next problem is to 'simulate' the right font  
encoding '' -> ", -- -> – and so on. I don't know if this is really  
possible without breaking other stuff.

Any suggestions?

	Steffen

--- SNIP ---
\documentclass{article}

\DeclareFontFamily{U}{hoefl}{}
\DeclareFontShape{U}{hoefl}{m}{n}%
      {<-> "Hoefler\space Text"}{}
\DeclareFontShape{U}{hoefl}{m}{it}%
      {<-> "Hoefler\space Text\space Italic"}{}
\DeclareFontShape{U}{hoefl}{bx}{n}%
      {<-> "Hoefler\space Text\space Black"}{}
\DeclareFontShape{U}{hoefl}{b}{n}%
      {<-> ssub * hoefl/bx/n}{}
\DeclareFontShape{U}{hoefl}{bx}{it}%
      {<-> "Hoefler\space Text\space Black\space Italic"}{}
\DeclareFontShape{U}{hoefl}{b}{it}%
      {<-> ssub * hoefl/bx/it}{}
\DeclareFontShape{U}{hoefl}{m}{sc}%
      {<-> "Hoefler\space Text:Letter\space Case=Small\space Caps"}{}

\renewcommand{\encodingdefault}{U}
\renewcommand{\rmdefault}{hoefl}

% this is super weired.
% As I understand it now:
%   - first set " to be a letter (catcode 11) to do some magic which
%   deactivates already defined macros starting with \" ?
%   - next define macros which map \"o to the unicode representation
% Seems to be fine for ' and ` but I have no idea how to get it working  
for --
\catcode`"=11
\def\"o{ö}
\def\"u{ü}
\def\"a{ä}
\def\"O{Ö}
\def\"U{Ü}
\def\"A{Ä}
\def\urapostrophe{'}
\def\urquote{’}
\catcode`'=\active \def'{\futurelet\next\urquotetest}
\def\urquotetest{\ifx\next'\let\next=\urquotes\else\if\next\space\let\ne 
xt=\urquote\else\let\next=\urapostrophe\fi\fi\next}
\def\urquotes'{”}

% this will break the cite stuff
%\def\uhyphen{-}
%\catcode`-=\active \def-{\futurelet\next\udashtest}
%\def\udashtest{\ifx\next- 
\let\next=\udash\else\let\next=\uhyphen\fi\next}
%\def\udash-{–}

% What to do here. If I make ` active it's really hard to do use tex  
aftewards.
% E.g. you can't continue using \catcode`...
\def\ulquote{‘}
\catcode``=\active \def`{\futurelet\next\ulquotetest}
\def\ulquotetest{\ifx\next`\let\next=\ulquotes\else\let\next=\ulquote\fi 
\next}
\def\ulquotes`{“}


\begin{document}
As was earlier noted in \cite{Bergeron:Vis-93} and \cite{Tory:SFU-02}  
...

\begin{thebibliography}{2}
\expandafter\ifx\csname natexlab\endcsname\relax\def\natexlab#1{#1}\fi
\expandafter\ifx\csname url\endcsname\relax
   \def\url#1{{\tt #1}}\fi

\bibitem[Bergeron(1993)]{Bergeron:Vis-93}
D.~Bergeron.
\newblock Visualization reference model (panel session position  
statement).
\newblock In {\em Proceedings of IEEE Visualization 1993}, pages  
337--342,
   1993.

\bibitem[Tory and M{\"o}ller(2002)]{Tory:SFU-02}
M.~Tory and T.~M{\"o}ller.
\newblock A model-based visualization taxonomy.
\newblock Technical Report SFU-CMPT-TR2002-06, Computing Science Dept.,  
Simon
   Fraser University, 2002.

\end{thebibliography}

\end{document}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xetexspecialchars.tar
Type: application/x-tar
Size: 10240 bytes
Desc: not available
Url : http://tug.org/pipermail/xetex/attachments/20040709/134cba28/xetexspecialchars-0001.tar
-------------- next part --------------

--
Zuse Institute Berlin, Takustrasse 7
D-14195 Berlin-Dahlem, Germany
phone: +49 (30) 841 85-337, fax: +49 (30) 841 85-107
email: prohaska at zib.de, web: http://www.zib.de/prohaska/

PGP Public Key: http://www.zib.de/prohaska/prohaska.pgp
Key id: 0xDA749299
Key fingerprint: 8B59 83A8 A43D E0E2 DEDB  D479 3157 2FEA DA74 9299



More information about the XeTeX mailing list