5

Let me state my "problem" first. When using PdfLateX my .tex file compiles rather swiftly and all is fine. I use TeXStudio and make use of the PDF preview feature. Since my LaTeX fu isn't the strongest, I compile quite often (to see if I broke something recently; and yes I make use of a version control system as well).

Now using PdfLaTeX we're talking about 3 to 3.5 seconds for it to compile.

Recently I added \usepackage{fontawesome} which apparently requires XeLaTex or LuaLaTex. Trying out the two options only LuaLaTeX was left, as the other one errored out.

I use the fontawesome package to get a symbol for external links onto each \href for which I define my own command, though (see below).

Now what I noticed once I switched to LuaLaTeX was that it takes considerably longer to compile the document: 10 seconds.

So my thought process was the following: if I could detect the presence of LuaLaTeX, I could conditionally include the parts that are "offending" to PdfLaTeX.

Is it possible to do that, i.e. distinguish between PdfLaTeX and LuaLaTeX?

Without fontawesome

\documentclass[12pt,a4paper,oneside]{book}
% ... a bunch of packages, including hyperref
% define \linkclr
\newcommand{\extlink}[2]{\href{#1}{\linkclr{#2}}}
% ... actual document

With fontawesome

\documentclass[12pt,a4paper,oneside]{book}
% ... a bunch of packages
\usepackage{fontawesome}
% ... more packages, including hyperref
% define \linkclr
\newcommand{\extlink}[2]{\href{#1}{\linkclr{#2}\,{\small\faExternalLink}}}
% ... actual document

Yes, I realize that this "complaint" about speed is laughable with respect to the speeds from some years ago. But if not for the speed, please consider answering it to satisfy my curiosity.

4
  • 1
    Independently of your question, you’re not necessarily doing yourself a favour by switching engines for the sake of a single symbol. Commented May 27, 2015 at 10:31
  • @ArthurReutenauer: care to explain? I guess I don't know enough to even appreciate your comment. Any pointers to documentation? I always thought of LuaTeX as more or less a preprocessor. Commented May 27, 2015 at 10:33
  • It’s not. It’s a completely different TeX engine (incidently based, amongst others, on pdfTeX). It’s not meant to be fully compatible and if you have longish documents, you should probably check carefully that the output of LuaTeX is satisfactory to you before switching. Commented May 27, 2015 at 10:36
  • @ArthurReutenauer: thanks for the clarification. Then I guess I need to read a little more about how they all differ. Commented May 27, 2015 at 10:39

2 Answers 2

11

Use the ifluatex package.

\documentclass{article}
\usepackage{ifluatex}
\begin{document}
\ifluatex
hello
\else
goodbye
\fi
\end{document}
3
  • wow, that's a swift response. Thanks. So that package also works without LuaTeX then? Let me just try and get back here :) Commented May 27, 2015 at 10:29
  • 1
    Well, obviously it works with all engines. What would be the point of a package to detect engines if it only worked with some of them? Commented May 27, 2015 at 10:30
  • 2
    @ArthurReutenauer: yeah, in my life I have learned that common sense isn't so common after all, so I decided to ask. Tested it also and it works. Commented May 27, 2015 at 10:32
3

If you want to differentiate between PDF-, Xe- and Lua(La)TeX, you might want consider the iftex package which provides the commands \ifPDFTeX, \ifXeTeX and \ifLuaTeX.

You must log in to answer this question.

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