3

How can I do the macro which will automatilcally choose font if compiles on Win (TNR font) or on Linux (Liberation for example). Using XeTex (TeXLive).

\documentclass[12pt]{article}
\usepackage{polyglossia}
\setdefaultlanguage[spelling=modern]{russian}
\setotherlanguage{english}
\setmainfont{Liberation Serif} %want to choose Liberation on Linux, TNR in Win
\newfontfamily\cyrillicfonttt[Script=Cyrillic, Scale=0.8]{Ubuntu-Light}

1 Answers1

6

As already stated in a comment there is a package called ifplatform which can solve this problem. It should work also for LuaLaTeX and pdfLaTeX, not just XeTeX.

Attention: Keep the warning from the documentation in mind, that all macros except \ifwindows do not work as expected unless --shell-escape is enabled.

For your example the solution would be best written as:

\usepackage{ifplatform}
\ifwindows
% Load Windows font here
\else
% Load Non-Windows font here
\fi
Artemis
  • 526