TeX Live on Windows

As I posted earlier, the upcoming releases of both MiKTeX and TeX Live have very similar sets of features on Windows. I’ve just stumbled upon something that points up the slight differences that exist, even though this one is a bit complicated.

To detect what system is being used, for things like shell escape tricks, there is a LaTeX package called ifplatform. However, this only works on Windows if MiKTeX is being used. The reason is that while TeX Live aims to be as similar as possible across platforms, MiKTeX can adopt a different approach and stick to Windows conventions. Most of the time, this is transparent but it shows up if you use the -shell-escape option for either system and try to do some testing. Inside ifplatform, you’ll find the lines:

\edef\ip@sig{write18-test-\the\year\the\month\the\day\the\time}
\edef\ip@win{'\ip@sig'}
\immediate\write18{echo \ip@win >"\ip@file"}

The idea is that the text written to the temporary file will be different on Windows to on a Unix-like system. MiKTeX will retain the single quotes around the test data:

'write18-test-20098231074'

whereas Unix-like systems will not:

write18-test-20098231074

But try using ifplatform with TeX Live on Windows and the test fails. First, no test file gets written at all: a bit of hacking leads to the change of the write line to

\immediate\write18{echo \ip@win > \ip@file}

and then at least the first step works. However, the test file now looks like a Unix one (with no quote marks), and ifplatform gets things wrong. So for the moment the only thing to do is create a stub package file and use it, something like:

\ProvidesPackage{ifplatform}[2007/11/18 v0.2  Testing for the operating system]
\newif\ifshellescape\shellescapetrue
\newif\ifwindows\windowstrue
\newif\ifmacosx
\newif\iflinux

I’ve reported the problem to Will Robertson, and hopefully a solution which really tests the OS rather than the TeX system can be found. However, it is a reminder that even with very general feature sets, the two major TeX distributions still act differently in some respects when used on Windows.

5 thoughts on “TeX Live on Windows

  1. Pingback: Jürgen Fenn (juergenfenn) 's status on Sunday, 23-Aug-09 20:49:48 UTC - Identi.ca
  2. Thanks for tracking this down, Joseph. You didn’t mention it, but I assume that writing this doesn’t work either?

    immediatewrite18{echo ip@win > “ip@file”}

    Unfortunately I don’t have of an opportunity to test with a Windows TeX Live installation. I wonder if LuaTeX would provide a more robust solution to this problem (i.e., calling LuaTeX through shell escape, not requiring LuaTeX for the ifplatform package).

  3. Oops, sorry; too early in the morning; those quote marks obviously have nothing at all to do with the quoting test!

  4. Luatex does provides a clean solution. The manual says:

    The os library has a few extra functions and variables:

    * os.type This is a string that gives a global indication of the class of operating system. The possible values are currently windows, unix, and msdos (you are unlikely to find this value ‘in the wild’).

    * os.name This is a string that gives a more precise indication of the operating system. These possible values are not yet fixed, and for os.type values windows and msdos, the os.name values are simply windows and msdos

    The list for the type unix is more precise: linux, freebsd, openbsd, solaris, sunos (pre-solaris), hpux, irix, macosx, bsd (unknown, but bsd-like), sysv (unknown, but sysv-like), generic (unknown).

    (os.version is planned as a future extension)

    So, if you want to call luatex through shell escape, you can create a tex that writes os.name to a text file, process it through luatex, and read the result.

  5. Aditya,

    The key point, at least for me, is that ifplatform has to work with older distributions. At least for MiKTeX users there is no sign of LuaTeX at the moment, so it will be some time before “just use Lua” is a general option.

    Joseph

Leave a Reply