Module texrocks

library for luatex, lualatex, luatexinfo and texlua

Info:

  • Copyright: 2025

Functions

name (path) base name without extension name
get_begin_index (args) get the first non-nil element's index
shift (argv, offset) texlua has a behaviour about command line arguments.
setenv (key, value) call os.setenv() when environment variable doesn't exist
getpaths (path, suffix) get paths from package.path/package.cpath.
getenv (path, suffix) concatenate getpaths()
main (args) entry for texlua
setfontenv (key, value) wrap os.setenv() for font files due to OSFONTDIR
setenvs () set environment variables for kpathsea
setotherenv (progname) set environment variables for kpsewhich --show-path 'other text files'
get_offset (args) get offset from one script to another script such as texlua --option main.lua --option -> main.lua --option offset should be 2
preparse (args, extra_offset) refer parse
run (argv) entry for luatex
get_program_name (args) see https://texdoc.org/serve/luatex/0's command line options
walk (dir, callback) walk all directories except
sync (short) update font map file: .lux/luatex.map
exec (args) texlua's os.exec() will not exec when meet error we wrap it to add os.exit()
get_cmd (args) escape and concatenate command line arguments for printing


Functions

name (path)
base name without extension name

Parameters:

  • path string

Returns:

    string path
get_begin_index (args)
get the first non-nil element's index

Parameters:

  • args string[] index can be negative

Returns:

    integer begin begin index
shift (argv, offset)
texlua has a behaviour about command line arguments. arg starts from index 0: arg = {[0] = "ls", "-al"} os.exec() starts from index 1: os.exec{"ls", "-al"} we need to shift it

Parameters:

  • argv string[] command line arguments
  • offset integer e.g., -1 means args[i + 1] = args[i]

Returns:

    string[] args
setenv (key, value)
call os.setenv() when environment variable doesn't exist

Parameters:

  • key string
  • value string
getpaths (path, suffix)
get paths from package.path/package.cpath. see tests.

Parameters:

  • path string paths concatenated by ;
  • suffix string | nil add ../${suffix}// to paths when it is not nil

Returns:

    string[] paths
getenv (path, suffix)
concatenate getpaths()

Parameters:

  • path string same as getpaths()
  • suffix string | nil same as getpaths()

Returns:

    string path concatenated by ;

See also:

main (args)
entry for texlua

Parameters:

  • args string[] arg
setfontenv (key, value)
wrap os.setenv() for font files due to OSFONTDIR

Parameters:

  • key string
  • value string
setenvs ()
set environment variables for kpathsea
setotherenv (progname)
set environment variables for kpsewhich --show-path 'other text files'

Parameters:

get_offset (args)
get offset from one script to another script such as texlua --option main.lua --option -> main.lua --option offset should be 2

Parameters:

  • args string[] command line arguments

Returns:

    integer offset
preparse (args, extra_offset)
refer parse

Parameters:

  • args string[] command line arguments
  • extra_offset integer | nil extra offset

Returns:

    string[] args parsed result

See also:

run (argv)
entry for luatex

Parameters:

  • argv string[] arg
get_program_name (args)
see https://texdoc.org/serve/luatex/0's command line options

Parameters:

  • args string[] command line arguments not arg

Returns:

    string progname
walk (dir, callback)
walk all directories except

Parameters:

  • dir string
  • callback function
sync (short)
update font map file: .lux/luatex.map

Parameters:

  • short boolean use relative (short)/absolute (long) path for font files
exec (args)
texlua's os.exec() will not exec when meet error we wrap it to add os.exit()

Parameters:

  • args string[] command line arguments
get_cmd (args)
escape and concatenate command line arguments for printing

Parameters:

  • args string[] command line arguments

Returns:

    string cmd command line
generated by LDoc 1.5.0 Last updated 2025-08-16 20:10:55