1

I have a TeXlive 2019 installation with an unsolved problem that so far prevents me from compiling on this computer with LuaLaTeX, so I thought I could add to the preamble of the document that I'm working some code that allows me to choose to compile with LuaLaTeX and otherwise do it with pdfLaTeX.

I'm pretty sure I saw something like that years ago but I've been unable to find the solution I'm looking for.

Do any of you remember the solution I'm looking for? At the moment my MWE would be as follows:

\documentclass[fontsize=10pt,headings=big,headsepline=on,paper=7in:8.5in,DIV=calc,BCOR=5mm]{scrbook}
\usepackage[english]{babel}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX, Scale=MatchLowercase}
\usepackage{xunicode}
\usepackage{luatextra}
\setmainfont[
ItalicFont = SourceSerifPro,
ItalicFeatures={FakeSlant=0.2}
]{SourceSerifPro}
\setsansfont{SourceSansPro} 
\setmonofont{SourceCodePro}
\usepackage{blindtext}

\begin{document}
\Blindtext[3][2]
\end{document}
4
  • 1
    Depending on the used method to invoke compilation, you can place magic comments at the top of your file which would say the script which engine to use (this is possible with TeXstudio or Texmaker for example, but also if you compile on the terminal using arara). The correct format of said comment depends on the used script. But you can't change the engine from within a TeX-run with TeX code.
    – Skillmon
    Commented Dec 5, 2019 at 21:58
  • @Fran both those packages are obsolete, use iftex Commented Dec 5, 2019 at 22:39
  • 2
    are you sure you need the xunicode or luatextra packages? They are both early luatex support packages not really needed in most cases now other than compatibility reasons Commented Dec 5, 2019 at 22:41
  • @DavidCarlisle To be honest, no, it was 2 lines of legacy code I forgot to erase from the MWE.
    – Aradnix
    Commented Dec 6, 2019 at 5:35

1 Answer 1

3

This version of the document works in lualatex, xelatex and pdflatex (and latex and with some warnings platex as well)

\documentclass[fontsize=10pt,headings=big,headsepline=on,paper=7in:8.5in,DIV=calc,BCOR=5mm]{scrbook}
\usepackage[english]{babel}
\usepackage{iftex}

\iftutex
% luatex or xetex
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX, Scale=MatchLowercase}
%\usepackage{xunicode}
%\usepackage{luatextra}
\setmainfont[
ItalicFont = SourceSerifPro,
ItalicFeatures={FakeSlant=0.2}
]{SourceSerifPro}
\setsansfont{SourceSansPro} 
\setmonofont{SourceCodePro}
\else
% pdftex
\fi
\usepackage{blindtext}

\begin{document}
\Blindtext[3][2]
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .