# Is there a macro telling which OS we're using?

I got some LaTeX documents that I have to compile them under different TeX Live, such as MacTeX or TeX Live. But in different OS, the font seems different too, for example, while in Windows, I prefer to use `Cambria`, but in Mac, I like `Lucida Grande` more.

Is there was a macro to differentiate between OS?

As the accepted answer, We need to add more comments on this question, As I read the package manual, we need more settings to use these macros:

``````% packages we need
\usepackage{pdftexcmds}
\usepackage{catchfile}
\usepackage{ifluatex}
\usepackage{ifplatform}
``````

Then we use these macros like that

``````\ifwindows
\fi
\iflinux
\fi
\ifmacosx
\fi % This needs to be \fi, not \if
``````

now, it works well, the point is you need more packages not only `ifplatform`.

one more thing, compile your tex file with option `-shell-escape` is required:

``````xelatex -shell-escape file.tex
``````

the `ifplatform` package provides `\ifwindows`, `\iflinux`, `\ifmacosx` and `\ifcygwin` conditionals. i would think that would be enough; the package requires shell escape to be enabled.
• Note that for `\ifwindows` shell escape is not needed, only for the other OSes. So without shell escape you can detect Windows vs. non-Windows (but not which kind of non-Windows). Mar 19 at 21:14