20

I'm trying out pgfplots with gnuplot to generate the data. This works by having pgfplots write some stuff to an external file, run gnuplot on the file, and then use the generated data to plot the graph.

The problem I'm having is that I get different behaviour under xelatex as pdflatex or lualatex. In xelatex, the data file is littered with ^^I whereas in the other two formats these are tabs. It appears that the code ^^I is getting stored as a macro which then gets written out to the file, so possibly there's something funny going on with the ^^I syntax: xelatex is reading it literally. Indeed, when I do \show\pgfplots@TAB (the macro in question) then for pdflatex and lualatex then I get a literal tab whereas for xelatex I get ^^I.

So how do I get a tab in xelatex? And why isn't \gdef\pgfplots@TAB{^^I} working?

(The previous line in the code, by the way, is \catcode`\^^I=12 - I don't know if that has anything to do with it.)

1 Answer 1

23

In TeX Live, the formats for pdf(la)tex and lua(la)tex are built loading the tcx translation file cp227.tcx that makes ^^I "printable". This means that a category code 12 ^^I is written out as a real tab character.

On the other hand, xetex ignores tcx translation requests and behaves, in this respect, like Knuth's TeX (but it writes UTF-8, of course).

The same problem arises with \begin{frame}[fragile] with beamer, because the contents of the environment is written to a temporary file, or with \verbatimwrite and similar commands; also the filecontents environment is probably affected.

A solution may be to call xetex with the command line option -8bit, but I don't know if this has other side effects.

13
  • 1
    Miktex uses cp227.tcx too. And while the --8bit-option is actually not mentioned in the documentation it nevertheless works with xe(la)tex. As far as I can see the chars > ASCII 32 are printable anyway in xetex, so it will affect only (some or all) ASCII 0-32. Apr 2, 2011 at 11:36
  • The -8bit option certainly makes it work. I'll keep an eye out for side effects. Thanks! Apr 2, 2011 at 17:41
  • 1
    Is there a way to ensure a correct behavior directly in the source code? I could patch pgfplots to do the right thing... Apr 18, 2011 at 20:40
  • 3
    @ChristianFeuersänger How about a "Known limitations" section in the manual? Also you could test for xelatex and print a warning "You're using xelatex. If things don't appear how you expect, try running with the -8bit option." Apr 17, 2012 at 19:33
  • 2
    me I do: sed -i -e "s/pdflatex/xelatex/g" -e "s/\^\^I/\t/g" \jobname.makefile Feb 7, 2013 at 12:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .