How can I determine the TeX distribution or OS a tex file is being built in?

I have this problem where a bibliography .sty file is possibly named differently between Windows (Miktex) and MacOS (Mactex). (Edit: I mean .bst file) I can't verify this is the root of the issue since I don't have Windows available currently to inspect the .sty file name, but on Windows, the following builds correctly

\bibliographystyle{IEEETran}


While on MacOS, the the same line must be changed to the following for the file to build (note the capitalization)

\bibliographystyle{IEEEtran}


I'd like something like a C/C++ #ifdef directive that let's me detect the system or distribution that is building the file and conditionally use the appropriate line, so that the same file builds on both setups. Of course, I haven't tried the MacOS compatible line on Windows; it may be that the lower-case "t" works on Windows as well. However, my question remains: is it possible to detect what system or distribution the file is being built in and condition some markup on the result?

• I can verify that this is not the case for the particular example, but the question stands. I will note that Windows is weird when it comes to folder/file name casing May 20 '14 at 2:32
• It isn't a .sty file, it is a .bst file you are looking for. OS X does or used to have a case-insensitive filesystem, at least in theory, but it didn't always work that way in practice. I'd guess Windows is being less fussy than OS X here but I know zilch about Windows so my guess is worth little. Certainly the .cls and .sty files mention only IEEEtran.bst. Unless MiKTeX changes them but that seems unlikely. EDIT: Sean Allred is definitely right about the weirdness but OS X had/has its share. (Apple thought case-sensitivity user-unfriendly and so invented a can of worms instead.)
– cfr
May 20 '14 at 2:37
• The NTFS file system on Windows is not case-sensitive. So whatever you make work on OS X or another Unix-like system should work fine on Windows. May 20 '14 at 3:46

Always use the correct file name, even if the OS/file system is case-insensitive. There is no point in adding complicate heuristic code to detect an OS or file system capabilities to support wrong file names, if the correct file name could be given in the first place.

Also LaTeX is case-sensitive!

Example, loading package MnSymbol as mnsymbol:

\usepackage{mnsymbol}

• If it is found on case-insensitive file systems, then LaTeX complains:

LaTeX Warning: You have requested package mnsymbol',
but the package provides MnSymbol'.


And if the package is loaded again as MnSymbol again, then LaTeX does not know, that this is a package it has already loaded and loads it again. This will usually cause many errors, e.g., if the package uses \newcommand as in the case of MnSymbl:

! LaTeX Error: Command \Mn@Fake@Missing already defined.
Or name \end... illegal, see p.192 of the manual.


In case of IEEEtran, the correct spelling is: IEEEtran with lowercase t for all files in the distribution package IEEEtran both in MiKTeX and TeX Live.

• I've found your answer and the various comments informative in describing issues related to case-sensitivity and TeX and OS choice. Thank you very much. Irrespective of my motivating example for why I wanted OS-dependent TeX code, is such a thing possible? May 20 '14 at 22:29
• @rajb245: See package ifplatform. May 20 '14 at 22:34
• Wonderful, package ifplatform precisely answers my original question, and your other comments illuminate the issue of case-sensitivity. Thank you. May 21 '14 at 16:04