Tx · LaTeX & TikZ

How to Fix Warnings with LuaLaTeX, enumitem, and Large Fonts

Published By the 9to5Science editorial team

At a glance

  1. 1. Read the warning

    Use the exact warning text to distinguish a list-layout issue from a font or class warning.

  2. 2. Check label dimensions

    Large labels may need a wider label box and a matching left margin.

  3. 3. Set the widest label

    Tell enumitem the largest label to measure, then let it calculate the margin.

  4. 4. Test a minimal example

    Compile a small KOMA-Script document with LuaLaTeX before changing other settings.

A warning that appears when a custom list uses very large text often points to a mismatch between the label’s width and the space reserved for it. The larger font can make labels such as “100.” much wider than enumitem expected when it measured the list.

The exact warning matters: without its wording, you cannot identify the cause with certainty. The example below addresses the common label-width problem and shows how to test it in a small KOMA-Script document.

A minimal LuaLaTeX example

This example defines a custom numbered list. Both the item text and labels are set in a large font, and enumitem is told to size the label area for labels up to two digits long.

\documentclass{scrartcl}
\usepackage{enumitem}

\newlist{bigitems}{enumerate}{1}
\setlist[bigitems,1]{
  label=\arabic*.,
  widest=99,
  leftmargin=*,
  labelsep=.6em,
  font=\bfseries,
  itemsep=.4\baselineskip
}

\begin{document}

{\Huge
\begin{bigitems}
  \item First large item.
  \item Second large item.
  \setcounter{bigitemsi}{98}
  \item A two-digit label.
\end{bigitems}
}

\end{document}

Compile it with LuaLaTeX. The \Huge declaration is scoped by braces, so it changes the list text and labels without changing the rest of the document. The font key makes the labels bold; it is not needed to set their size here because the entire list is already inside the \Huge group.

Why label width matters

A list label sits in a box to the left of the item text. If that box is too narrow, a long or oversized label can overlap the text or produce a layout warning. The relevant enumitem settings work together:

  • label=\arabic*. defines the label pattern.
  • widest=99 tells enumitem to allow for a two-digit label. Choose a value that represents the longest label you expect.
  • leftmargin=* asks enumitem to calculate the left margin from the label dimensions and labelsep.
  • labelsep=.6em sets the gap between the label and the item text.

The width needed for 9. is not necessarily enough for 10.—and changing the font size changes both widths. If your list can reach three digits, use widest=999. For labels with different formats, choose a widest value that represents the longest actual label.

If the warning remains

Read the full message in the .log file, including the package or class name that issued it. A warning mentioning enumitem or a negative or insufficient label width points toward list dimensions. A message about a missing font shape, unavailable font, or font-size substitution instead points toward font selection or font availability. A KOMA-Script warning should be addressed according to the class feature named in that warning; it is not automatically a LuaLaTeX error.

Try these checks in order:

  1. Compile the minimal example above with the same engine and class.
  2. Restore your custom list options one at a time until the warning returns.
  3. Check that widest covers the longest label and that no manual labelwidth conflicts with leftmargin=*.
  4. If you set the item font inside the list, make sure the label is measured in the same font and size as the one actually used.
  5. Look up the exact warning text in the documentation for the package or class that printed it.

KOMA-Script and enumitem both provide ways to configure lists. Using enumitem means its list settings control the custom list, so avoid mixing them with separate manual spacing or margin adjustments unless you have checked how those settings interact.

Common mistakes

  • Setting leftmargin too small by hand. A fixed margin that worked with a normal font may not fit a \Huge label. Try leftmargin=* or calculate a suitable value for the actual font and label.
  • Choosing a widest value that is too short. If the counter reaches 100, widest=99 no longer describes the longest label.
  • Changing only the item text size. Labels and item text may be styled separately. Check which font settings affect each part of your list.
  • Treating every warning as an engine problem. LuaLaTeX can run into font-related issues, but a warning about list dimensions is a layout issue. The warning’s wording identifies which to investigate.
  • Editing several settings at once. A small test document makes it easier to find whether the class, font, label definition, or margin setting is responsible.

If the list uses Roman numerals, symbols, or a custom label, test the actual longest label rather than assuming a digit-based widest value will fit it.

References

  1. enumitem package documentation
  2. KOMA-Script: A bundle of versatile classes and packages

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.