From 0507e64a7b96d7a42d72e964c2fd6a351e35ac9c Mon Sep 17 00:00:00 2001 From: "Y. Wang" Date: Mon, 29 Jan 2024 23:19:52 +0100 Subject: [PATCH] Fix LaTeX output error for empty advtrains_livery_tools templates --- latex.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/latex.lua b/latex.lua index b432ad4..d329c2b 100644 --- a/latex.lua +++ b/latex.lua @@ -291,12 +291,16 @@ This wagon can be customized with DlxTrains' livery system. table.insert(st, string.format([[\subsection*{Template: %s}]], SL(tname))) table.insert(st, SL(tdef.notes)) table.insert(st, "") - table.insert(st, "This template contains the following components:") - table.insert(st, [[\begin{itemize}]]) - for _, overlay in ipairs(tdef.overlays) do - table.insert(st, string.format([[\item %s]], SL(overlay.name))) + if #tdef.overlays > 0 then + table.insert(st, "This template contains the following components:") + table.insert(st, [[\begin{itemize}]]) + for _, overlay in ipairs(tdef.overlays) do + table.insert(st, string.format([[\item %s]], SL(overlay.name))) + end + table.insert(st, [[\end{itemize}]]) + else + table.insert(st, "This template does not appear to contain any (customizable) component.") end - table.insert(st, [[\end{itemize}]]) end for _, lname in ipairs(atlivdef.livery_names) do local ldef = atlivdef.liveries[lname]