Skip to content

Always explicitly load the kpse module #3

Open
@Witiko

Description

@Witiko

The lua-uni-algos library uses the kpse global in two files: lua-uni-normalize.lua and lua-uni-parse.lua. This works out in a format such as LaTeX, where kpse has already been loaded. However, in ConTeXt MkIV and LMTX, kpse is a library stub that causes a fatal error when find_file and other methods are called.

Consider the following document example.tex with an MWE for ConTeXt MkIV:

\starttext
\directlua{
  local uni_case = require'lua-uni-case'
  tex.print(uni_case.casefold('Straße', true, false))
}
\stoptext

Typesetting the MWE with the context example command produces the following error:

fatal error: kpse library is accessed (key: find_file)

We can replace the stub library by explicitly loading the external kpse library:

\starttext
\directlua{
  kpse = require'kpse'
  kpse.set_program_name'kpsewhich'
  local uni_case = require'lua-uni-case'
  tex.print(uni_case.casefold('Straße', true, false))
}
\stoptext

Running context example again will produce a PDF document example.pdf with the expected output:

strasse

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions