TransWikia.com

Error message from including luacode package in Overleaf

TeX - LaTeX Asked on September 19, 2020

I am including the LuaTeX into an Overleaf LaTeX document by

usepackage{arxiv}
usepackage[T1]{fontenc}    % use 8-bit T1 fonts
usepackage{hyperref}       % hyperlinks
hypersetup{
    colorlinks=true,
    linkcolor=blue,
    filecolor=magenta,      
    urlcolor=cyan,
    pdftitle={Sharelatex Example},
    pdfpagemode=FullScreen,
}
usepackage{url}            % simple URL typesetting
usepackage{booktabs}       % professional-quality tables
usepackage{amsfonts}       % blackboard math symbols
usepackage{nicefrac}       % compact symbols for 1/2, etc.
usepackage{microtype}      % microtypography

usepackage[english]{babel}
usepackage[utf8]{inputenc}
usepackage{amsmath}
usepackage{amsthm}
usepackage{multirow,tabularx}
usepackage{luacode}
usepackage{graphicx}
usepackage[colorinlistoftodos]{todonotes}

but encountered the following error message:

Package luacode Error:
/usr/local/texlive/2017/texmf-dist/tex/lualatex/luacode/luacode.sty,
line 51 LuaTeX is required for this package. Aborting..

See the luacode package documentation for explanation. Type H
for immediate help. …

l.51 to prevent additional errors.}
This package can only be used with the LuaTeX engine (command `lualatex’). Package loading has been
stopped to prevent additional errors.

What is the remedy?

One Answer

If you want to use luacode you need to compile your document with LuaLaTeX (and not with pdfLaTeX, which is probably the standard in most editors, or XeLaTeX).

See https://www.overleaf.com/learn/how-to/Changing_compiler for how to do that on Overleaf.


Note that pdf(La)TeX and Lua(La)TeX handle fonts very differently, that means that you may have to change a few things in your preamble when you switch to LuaLaTeX. (Cf. also Frequently loaded packages: Differences between pdfLaTeX and LuaLaTeX)

In particular

usepackage[T1]{fontenc}

and

usepackage[utf8]{inputenc}

should not be loaded with LuaLaTeX. Instead most people will load

usepackage{fontspec}

See Switching to lualatex: How to translate font setups? and Are there cases where fontenc + luatex (or xetex) cause problems? for details and background.

Correct answer by moewe on September 19, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP