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.
argstarts from index 0:arg = {[0] = "ls", "-al"}os.exec()starts from index 1:os.exec{"ls", "-al"}we need to shift itParameters:
- argv string[] command line arguments
- offset
integer e.g.,
-1meansargs[i + 1] = args[i]
Returns:
-
string[] args
- setenv (key, value)
-
call
os.setenv()when environment variable doesn't existParameters:
- 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
- path
string paths concatenated by
- getenv (path, suffix)
-
concatenate
getpaths()Parameters:
- path
string same as
getpaths() - suffix
string | nil same as
getpaths()
Returns:
-
string path concatenated by
;See also:
- path
string same as
- main (args)
-
entry for texlua
Parameters:
- args
string[]
arg
- args
string[]
- setfontenv (key, value)
-
wrap
os.setenv()for font files due toOSFONTDIRParameters:
- key string
- value string
- setenvs ()
- set environment variables for kpathsea
- setotherenv (progname)
-
set environment variables for
kpsewhich --show-path 'other text files'Parameters:
- progname string read https://texdoc.org/serve/kpathsea/0
- get_offset (args)
-
get offset from one script to another script
such as
texlua --option main.lua --option->main.lua --optionoffset should be 2Parameters:
- args string[] command line arguments
Returns:
-
integer offset
- preparse (args, extra_offset)
-
refer
parseParameters:
- 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
- argv
string[]
- 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
- args
string[] command line arguments not
- walk (dir, callback)
-
walk all directories except
Parameters:
- dir string
- callback function
- sync (short)
-
update font map file:
.lux/luatex.mapParameters:
- 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 addos.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