[XeTeX] XeLaTeX and SIunitx

Ross Moore ross.moore at mq.edu.au
Mon May 14 01:19:18 CEST 2012


Hi Ulrike, and Bruno,

On 13/05/2012, at 11:05 PM, Ulrike Fischer wrote:

> Am Fri, 11 May 2012 19:44:00 +0200 schrieb Bruno Le Floch:
> 
>> I'm really no expert, but the siunitx package could include, e.g., µ
>> as ^^^^00b5.  This  would not make pdftex choke when appearing in the
>> false branch of an engine-dependent conditional.
> 
> Using ^^..-notation is certainly a good idea in styles - regardless
> of the engine - as it avoids encoding confusing.

If by styles, you mean in a macro definition made within 
a separate style file, then I agree with you 100%.

But ...

> But it doesn't
> solve the problem here as pdftex chokes if it sees more than two ^^: 
> 

  ... this is not a good example to support this view.

> \documentclass{article}
> \begin{document}
> ^^^^00b5
> \end{document}

The body of your document source should be engine independent,
so this should look more like:


\documentclass{article}
\usepackage{ifxetex}

\ifxetex
 \newcommand{\micronChar}{^^^^00b5}
  % handle other characters
  ...
\else
 \if ... 
  % handle other possibilities
  %  e.g.  ^^c2^^b5
  ...
 \fi
\fi

\begin{document}
\micronChar
\end{document}


Better still, of course is to have the conditional
definitions made in a separate file, so that similar things
can all be handled together and used in multiple documents.

You want to avoid having to find and replace multiple instances
of the special characters, when you share you work with colleagues
or need to reuse your own work in other contexts.
Instead you should simply need to adjust the macro expansions,
and all that previous work will adapt automatically.

> 
> 
> ! Text line contains an invalid character.
> l.9  ^^^
>        ^00b5
> ? x
> 
> 
> For pdftex you would have to code it as two 8bit-octect:  ^^c2^^b5
> But this naturally will assume that pdftex is expecting utf8-input.
> 
> -- 
> Ulrike Fischer 

Hope this helps,

	Ross

------------------------------------------------------------------------
Ross Moore                                       ross.moore at mq.edu.au 
Mathematics Department                           office: E7A-419      
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114
------------------------------------------------------------------------






More information about the XeTeX mailing list