diff --git a/latex.lua b/latex.lua index 4e1521f..b432ad4 100644 --- a/latex.lua +++ b/latex.lua @@ -47,6 +47,18 @@ function latex.describe_color(cstr) end end +--- Describe a coupler in LaTeX. +-- @tparam string coupler The name of the coupler. +-- @treturn string The string describing the coupler. +function latex.describe_coupler(coupler) + local name = utils.get_coupler_name(coupler) + if name then + return ([[%s (\texttt{%s})]]):format(SL(name), SL(coupler)) + else + return ([[\texttt{%s}]]):format(SL(coupler)) + end +end + --- Describe a wagon prototype in LaTeX. -- @tparam string itemname The item name of the wagon prototype. -- @treturn string The description of the prototype. @@ -151,7 +163,7 @@ function latex.describe_wagon_prototype(itemname) ccouplers[k] = true end for k in pairs(ccouplers) do - local desc = SL(utils.get_coupler_name(k)) + local desc = latex.describe_coupler(k) table.insert(lcouplers, desc) couplerid[desc] = k end