I'd like to create my first LaTeX document to make an article for my science teacher.

I've decided to do it using LuaLaTeX, the opentype font newpx and with microtype. I'd like to use both Spanish and English.

I have preselected several libraries I think are useful and modern.

I'd like to know your opinion,
Is there any incompatibility between my packages or something unnecessary?
Do you suggest to add any other?
Would you change any option?
I'm mostly concerned about fontspec, fontenc, luainputenc y luatextra. Some posts say some are not needed anymore, some say the opposite or are too old.

\documentclass[11pt,a4paper]{article}
\usepackage[margin=1in]{geometry} 
\usepackage[backend=bibtex]{biblatex}
\usepackage{fontspec}
\usepackage[utf8]{luainputenc}
\usepackage{luatextra}
\usepackage{newpxtext}
\usepackage{mathtools}
\usepackage{amsmath, amsfonts, amssymb}
\usepackage{graphicx}
\usepackage{float}
\usepackage[section]{placeins}
\usepackage[section]{chngcntr}
\counterwithin{figure}{chapter}
\usepackage[section]{cleveref}
\usepackage{longtable}
\usepackage{polyglossia}    
\setotherlanguage{english}
\setmainlanguage{spanish}
\usepackage[xindy={language=spanish, codepage=utf8}, style=altlist]{glossaries}   
\usepackage[xindy, splitindex]{imakeidx}
\usepackage[backend=biber]{biblatex} 
\usepackage{microtype}

New version with your suggestions:

\documentclass[11pt,a4paper]{article}
\usepackage[margin=1in]{geometry} 
\usepackage{mathtools, amsfonts, amssymb}
\usepackage[no-math]{fontspec}
\usepackage{newpxtext}
\usepackage{graphicx}
\usepackage{float}
\usepackage[section]{placeins}
\usepackage[section]{chngcntr}
\counterwithin{figure}{chapter}
\usepackage[section]{cleveref}
\usepackage{longtable}
\usepackage{polyglossia}    
\setmainlanguage{spanish}
\setotherlanguage{english}
\usepackage[xindy={language=spanish, codepage=utf8}, style=altlist]{glossaries}   
\usepackage[xindy, splitindex]{imakeidx}
\usepackage[backend=biber]{biblatex} 
\usepackage{microtype}
  • polyglossia loads fontspec. You do not need luainputenc -- it is made for compatibility with old documents. luatextra just load some other packages -- see the documentation. Newpxtext is not needed, since you use fontspec. Other packages don't seem to have anything about luatex, though microtype may have some compatibility issues. – Michael Fraiman Nov 2 '17 at 19:44
  • The mathtools package loads the amsmath package automatically -- no need to load amsmath separately. Don't load any packages more than once (cf biblatex). – Mico Nov 2 '17 at 19:49
  • @Mico didn't know it. Does it apply for other languages, or English only? – Michael Fraiman Nov 2 '17 at 19:49
  • Are you sure you will have a glossary and an index shipped with your article ? – sztruks Nov 2 '17 at 20:00
  • @michael & Mico but I want to use the font newpx. What should I load then? – skan Nov 2 '17 at 20:01

Some comments and suggestions:

  • Load amsmath (or mathtools) before fontspec (and unicode-math).

  • Don't load the fontenc, inputenc (or luainputenc) and textcomp packages.

  • The luatextra package appears to have been updated last in 2010. It simply loads the following 6 packages: fontspec, luatexbase, luacode, lualibs, metalogo, and fixltx2e.

    • With a LaTeX format more recent that 2015/01/01, fixltx2e does nothing at all, as all of the package's various fixes have been incorporated into the LaTeX kernel code.

    • The luatexbase package is, these days, also loaded automatically if you run LuaLaTeX. No need to load it again.

    • In short, don't load the luatextra package. Load the luacode, lualibs, and/or metalogo packages only if you really need them.

  • The newtxtext, newtxmath, newpxtext and newpxmath packages all interact very well with fontspec. If you load these packages, there's probably no need to load unicode-math.

  • Don't load any packages more than once. (I believe this is sound advice for pdfLaTeX and XeLaTeX users as well...)

  • With Spanish and English, both babel and polyglossia work very well under LuaLaTeX. Just use the package whose syntax and options you find more straightforward to master.

  • Do you sugggest to use \usepackage{newpx} to load all newpxtext and newpxmath or Tex Gyre instead? @Michael says I don't need to load fontspec if I use polyglossia. – skan Nov 2 '17 at 20:22
  • @skan - I don't think there's a LaTeX package called newpx; that's why I suggested loading both newpxtext and newpxmath. (There is a much older package called pxfonts; its the precursor, so to say, of the newpxtext/math packages.) I think it's a good idea to load fontspec before loading newpxtext and newpxmath. It's up to you to decide if you want to load fontspec indirectly, by loading the polyglossia package. – Mico Nov 2 '17 at 20:27
  • 1
    If you use the geometry package you should probably load the luatex85 package using \RequirePackage{luatex85} BEFORE the \documentclass line. – Herb Schulz Nov 2 '17 at 21:51
  • @HerbSchulz why? – skan Nov 3 '17 at 11:58
  • @skan : Sorry for taking so long to answer. Recent versions of luatex have changed the variable names for many pdf page properties from that used in pdftex, e.g., \pdfpagewidth became \pagewidth. But many packages, AFAIK including the geometry package, don't yet check for this change so can't set the pdf parameters in luatex. Similarly, if you need to use --shell-escape (or write18) you need to do a similar thing with the shellesc package. – Herb Schulz Nov 4 '17 at 16:02

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.