This might seem like a stupid train of thought. It's certainly very pedantic. I've spent most of my afternoon trying to figure this out.


TeX Live

All of the engines I've looked at today list single dash flags in their -help and man pages. For example, pdftex -help says -shell-escape is the way to unfetter \write18. However, double dash flags also work, e.g. --shell-escape also frees \write18.

I've skimmed a few of the source repos to look at where the flags are being parsed, but I haven't been able to make heads or tails of any of them. A great example is the Web2c changelog. It looks like -shell-escape was added in 1997.

7.0 (6 February 1997)

if -shell-escape or shell_escape in texmf.cnf is enabled, \write18{str} passes str to system(3) for processing by sh.

Tenish years later, --shell-escape seems to have existed for some time.

2009 (for TeX Live 2009, 13 October 2009)

--enable-write18 and --disable-write18 accepted as synonyms for --shell-escape and --no-shell-escape, for compatibility with MiKTeX.


MacTeX seems to use double dash flags. However, that same press release mentions that TeX Live was using double dash flags in 2010.


MiKTeX seems to have used a double dash for some time. However, looking at the older code requires more sleuthing than I'm up for.


I've got a few, but they're all tightly related.

  • Why are both used? Is it for compatibility (seems like the most obvious reason)?
  • Why were both used to begin with? Was it a stylistic difference, or were there technical reasons (e.g. getopts can't handle long options)?
  • When did things change?

If you know where in the source repos I can go to learn about any of this, I'd love to hear about it. I'm not trying to say one or the other is better; they both work so they're both right. I'm just curious about the history behind it all.

  • MacTeX is a built upon sources of TeXLive, there can be theoretically differences in whether dynamic libraries are used, compared to builds for Linux distros (staying with Mac OS, MacPorts distributed binaries are not like MacTeX's) but it would have been surprising if changes would go up to handling of options compared to other Unixen. Side note: I proposed TeXLive to link executables with readline library for better command line experience, but it was rejected.
    – user4686
    Mar 26, 2018 at 11:00
  • I had been left under impression MikTeX requires two dashes. Am I wrong (I can't test)?
    – user4686
    Mar 26, 2018 at 11:04
  • @jfbu I tried MikTeX (on macOS though), and both single and two dashes work. (BTW, won't help other users, but I use rlwrap when a commandline application doesn't use readline and I want it.) Mar 26, 2018 at 23:05
  • @ShreevatsaR thanks, yes I always use rlwrap too, very very convenient when using etex interactively.
    – user4686
    Mar 27, 2018 at 7:25

2 Answers 2


I couldn't chase down all the history this morning but my recollection is that originally tex had no options. When options were added, eg tex -ini replacing the old separate program initex they were added with one dash.

posix and linux recommend two dashes for multi-letter options and in particular that --help should work with all applications


so as there were no conflicts, the web2c option handling was changed and now accepts one or two dashes in all cases.


LuaTeX in TeX live parses the command line options in luainit.w using getopt_long_only and in its documentation we find

getopt_long_only() is like getopt_long(), but '-' as well as "--" can indicate a long option.

XeTeX and pdfTeX do the same in texmfmp.c I believe.

  • 1
    Another documentation for getopt_long_only (GNU C library) says something similar: The getopt_long_only function […] allows the user […] to pass long options with only ‘-’ instead of ‘--’. The ‘--’ prefix is still recognized but […] if a ‘-’ is seen it is first tried whether this parameter names a long option. If not, it is parsed as a short option. And the version control history there shows it's been like that since the file was first committed in Jan 2006 (the start of history in that repo). Mar 26, 2018 at 5:14

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.