On 5/14/12, Ross Moore <ross.mo...@mq.edu.au> wrote: > 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.
You cannot do " \ifxetex ^^^^00b5 \else ^^c2^^b5 \fi " because the character ^^^ is invalid in pdfTeX (catcode 15), hence pdfTeX chokes whenever it sees that character in a line, with the exception of \^^^, the command symbol (otherwise it would be difficult to change the catcode of ^^^). On the other hand, you can do \ifxetex \expandafter \@gobble \string \^^^^00b5 \else ... \fi Regards, Bruno -------------------------------------------------- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex