Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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!)

share|improve this question
add comment

1 Answer

up vote 11 down vote accepted

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.

share|improve this answer
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
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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