Is it possible to test within the document what commandline arguments were passed to tex? The particular case that prompts this is the question Tabs in output file written by xelatex and pdflatex are different where it would be useful to know if the -8bit argument has been passed to tex and issue a warning if not. That is, if pgfplots could contain the code:

  \pkgwarning{You're using xe(la)tex without the -8bit argument.  Some external files might go wrong.  If things don't work as you expect, try using the -8bit argument.}

then it might make it easier to spot when the situation of the linked question occurs.

(A year after asking the above question, it happened to me again and it took me some time to realise what the problem was and find the solution, even though it had been me who found it last time!)


I'm afraid the answer is "not directly".

One can define such a test:

\input catchfile.sty
  \CatchFileDef\atab{tab.tst}{\catcode`\^=12 \catcode`I=12 }
  \edef\btab{\string^\string^\string I }

With xetex test (test.tex is the file name) we'll get \iffalse while with xetex -8bit test we'll get \iftrue.

It seems to be impossible to do this without writing a file, because \scantokens avoids the "translation" via the xchr tables. So while we can catch the three distinct characters when reading back the file, if written without the -8bit option, we can't do it with \scantokens.

  • I'm guessing from this that the answer to the general question is "No". – Andrew Stacey Apr 17 '12 at 20:20
  • You're guessing right. :) – egreg Apr 17 '12 at 20:21
  • Fancy adding that to your answer? It was the actual question, after all! – Andrew Stacey Apr 17 '12 at 20:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.