global tex
😱 Types incomplete or incorrect? 🙏 Please contribute!
methods
tex.set
@param
global
- It is possible to use global
as the first argument to tex.set
; this makes the assignment global instead of local.
@param parameter
- The name of the TeX parameter.
Set the given TeX parameter globally.
Reference:
- Corresponding C source code: ltexlib.c#L1714-1813
tex.set
@param
parameter
- The name of the TeX parameter.
Set the given TeX parameter.
When you set a glue quantity you can either pass a glue_spec
or upto five numbers.
Reference:
- Corresponding C source code: ltexlib.c#L1714-1813
tex.set
function tex.set(
global: "global",
parameter: GlueParameter,
width: integer,
stretch: integer?,
stretch_order: integer?,
shrink: integer?,
shrink_order: integer?
)
global
- It is possible to use global
as the first argument to tex.set
; this makes the assignment global instead of local.
@param parameter
- The name of the glue parameter.
@param width
- The horizontal or vertical displacement.
@param stretch
- An extra (positive) displacement or stretch amount.
@param stretch_order
- Factor applied to stretch amount.
@param shrink
- An extra (negative) displacement or shrink amount.
@param shrink_order
- Factor applied to shrink amount.
Set the given glue parameter globally by specifying the width
, stretch
,
stretch_order
, shrink
and shrink_order
of the glue.
Reference:
- Corresponding C source code: ltexlib.c#L1714-1813
tex.set
function tex.set(
parameter: GlueParameter,
width: integer,
stretch: integer?,
stretch_order: integer?,
shrink: integer?,
shrink_order: integer?
)
parameter
- The name of the glue parameter.
@param width
- The horizontal or vertical displacement.
@param stretch
- An extra (positive) displacement or stretch amount.
@param stretch_order
- Factor applied to stretch amount.
@param shrink
- An extra (negative) displacement or shrink amount.
@param shrink_order
- Factor applied to shrink amount.
Set the given glue parameter by specifying the width
, stretch
,
stretch_order
, shrink
and shrink_order
of the glue.
Reference:
- Corresponding C source code: ltexlib.c#L1714-1813
tex.set
function tex.set(
global: "global",
parameter: GlueParameter,
glue_spec: GlueSpecNode {
width = integer,
stretch = integer,
stretch_order = integer,
shrink = integer,
shrink_order = integer,
}
)
global
- It is possible to use global
as the first argument to tex.set
; this makes the assignment global instead of local.
@param parameter
- The name of the glue parameter.
@param glue_spec
- A glue spec node.
Set the given glue parameter globally using a glue_spec
node.
Reference:
- Corresponding C source code: ltexlib.c#L1714-1813
tex.set
function tex.set(
parameter: GlueParameter,
glue_spec: GlueSpecNode {
width = integer,
stretch = integer,
stretch_order = integer,
shrink = integer,
shrink_order = integer,
}
)
parameter
- The name of the glue parameter.
@param glue_spec
- A glue spec node.
Set the given glue parameter using a glue_spec
node.
Reference:
- Corresponding C source code: ltexlib.c#L1714-1813
tex.get
Query the given TeX parameter.
The exact return values differ depending on the actual parameter.
Reference:
- Corresponding C source code: ltexlib.c#L2120-L2200
tex.get
function tex.get(parameter: GlueParameter) -> GlueSpecNode {
width = integer,
stretch = integer,
stretch_order = integer,
shrink = integer,
shrink_order = integer,
}
tex.get
function tex.get(
parameter: GlueParameter,
all: true
)
-> width integer
-> stretch integer
-> stretch_order integer
-> shrink integer
-> shrink_order integer
@return width
- The horizontal or vertical displacement.
@return stretch
- An extra (positive) displacement or stretch amount.
@return stretch_order
- Factor applied to stretch amount.
@return shrink
- An extra (negative) displacement or shrink amount.
@return shrink_order
- Factor applied to shrink amount.
Query the given glue parameter.
The exact return values differ depending on the actual parameter.
Glue is kind of special:
The return value
is a glue_spec
node but when you pass false
as last argument to
tex.get
you get the width of the glue and when you pass true
you
get all five values. Otherwise you get a node which is a copy of the internal
value so you are responsible for its freeing at the Lua end.
If
you pass true
to get
you get 5 values returned for a glue and
when you pass false
you only get the width returned.
Reference:
- Corresponding C source code: ltexlib.c#L2120-L2200
tex.get
@return width
- The horizontal or vertical displacement.
Query the given glue parameter.
The exact return values differ depending on the actual parameter.
Glue is kind of special:
The return value
is a glue_spec
node but when you pass false
as last argument to
tex.get
you get the width of the glue and when you pass true
you
get all five values. Otherwise you get a node which is a copy of the internal
value so you are responsible for its freeing at the Lua end.
If
you pass true
to get
you get 5 values returned for a glue and
when you pass false
you only get the width returned.
Reference:
- Corresponding C source code: ltexlib.c#L2120-L2200
tex.setattribute
@param
global
- It is possible to define values globally by using the string global
as the first function argument.
@param register
- A register number or a predefined csname string from \attributedef
.
- Corresponding C source code: ltexlib.c#L1087-L1102
tex.setattribute
@param
register
- A register number or a predefined csname string from \attributedef
.
- Corresponding C source code: ltexlib.c#L1087-L1102
tex.getattribute
@param
register
- A register number or a predefined csname string from \attributedef
.
- Corresponding C source code: ltexlib.c#L1104-L1114
tex.isattribute
@param
register
- A register number or a predefined csname string from \attributedef
.
- Corresponding C source code: ltexlib.c#L1080-L1083
- Corresponding C source code: ltexlib.c#L350-L358
tex.setcount
@param
global
- It is possible to define values globally by using the string global
as the first function argument.
@param register
- A register number or a predefined csname string from \countdef
.
- Corresponding C source code: ltexlib.c#L1051-L1066
tex.setcount
@param
register
- A register number or a predefined csname string from \countdef
.
- Corresponding C source code: ltexlib.c#L1051-L1066
tex.getcount
@param
register
- A register number or a predefined csname string from \countdef
.
- Corresponding C source code: ltexlib.c#L1068-L1078
tex.iscount
@param
register
- A register number or a predefined csname string from \countdef
.
- Corresponding C source code: ltexlib.c#L1046-L1049
- Corresponding C source code: ltexlib.c#L350-L358
tex.setdimen
@param
global
- It is possible to define values globally by using the string global
as the first function argument.
@param register
- A register number or a predefined csname string from \dimendef
.
- Corresponding C source code: ltexlib.c#L818-L834
tex.getdimen
@param
register
- A register number or a predefined csname string from \dimendef
.
- Corresponding C source code: ltexlib.c#L836-L846
tex.isdimen
@param
register
- A register number or a predefined csname string from \dimendef
.
- Corresponding C source code: ltexlib.c#L813-L816
- Corresponding C source code: ltexlib.c#L350-L358
tex.setglue
function tex.setglue(
global: "global",
register: (string|integer),
width: number?,
stretch: number?,
shrink: number?,
stretch_order: integer?,
shrink_order: integer?
)
global
- It is possible to define values globally by using the string global
as the first function argument.
@param register
- A register number or a predefined csname string from \skipdef
.
- Corresponding C source code: ltexlib.c#L884-L903
tex.setglue
function tex.setglue(
register: (string|integer),
width: number?,
stretch: number?,
shrink: number?,
stretch_order: integer?,
shrink_order: integer?
)
register
- A register number or a predefined csname string from \skipdef
.
- Corresponding C source code: ltexlib.c#L884-L903
tex.getglue
function tex.getglue(register: (string|integer))
-> width integer
-> stretch integer
-> shrink integer
-> stretch_order integer
-> shrink_order integer
register
- A register number or a predefined csname string from \skipdef
.
- Corresponding C source code: ltexlib.c#L905-L949
tex.isglue
@param
register
- A register number or a predefined csname string from \skipdef
.
Alias of tex.isskip()
-
Corresponding C source code: ltexlib.c#L848-L851
-
Corresponding C source code: ltexlib.c#L350-L358
tex.setmuglue
function tex.setmuglue(
global: "global",
register: (string|integer),
width: number?,
stretch: number?,
shrink: number?,
stretch_order: integer?,
shrink_order: integer?
)
global
- It is possible to define values globally by using the string global
as the first function argument.
@param register
- A register number or a predefined csname string from \muskipdef
.
- Corresponding C source code: ltexlib.c#L979-L998
tex.setmuglue
function tex.setmuglue(
register: (string|integer),
width: number?,
stretch: number?,
shrink: number?,
stretch_order: integer?,
shrink_order: integer?
)
register
- A register number or a predefined csname string from \muskipdef
.
- Corresponding C source code: ltexlib.c#L979-L998
tex.getmuglue
function tex.getmuglue(register: (string|integer))
-> width integer
-> stretch integer
-> shrink integer
-> stretch_order integer
-> shrink_order integer
register
- A register number or a predefined csname string from \muskipdef
.
- Corresponding C source code: ltexlib.c#L1000-L1044
tex.ismuglue
@param
register
- A register number or a predefined csname string from \muskipdef
.
Alias of tex.ismuskip()
- Corresponding C source code: ltexlib.c#L951-L954
- Corresponding C source code: ltexlib.c#L350-L358
tex.setmuskip
function tex.setmuskip(
global: "global",
register: (string|integer),
value: Node {
next = Node?,
prev = Node?,
id = integer,
subtype = integer,
head = Node?,
attr = Node,
}
)
global
- It is possible to define values globally by using the string global
as the first function argument.
@param register
- A register number or a predefined csname string from \muskipdef
.
- Corresponding C source code: ltexlib.c#L956-L965
tex.setmuskip
function tex.setmuskip(
register: (string|integer),
value: Node {
next = Node?,
prev = Node?,
id = integer,
subtype = integer,
head = Node?,
attr = Node,
}
)
register
- A register number or a predefined csname string from \muskipdef
.
- Corresponding C source code: ltexlib.c#L956-L965
tex.getmuskip
function tex.getmuskip(register: (string|integer)) -> value Node {
next = Node?,
prev = Node?,
id = integer,
subtype = integer,
head = Node?,
attr = Node,
}
register
- A register number or a predefined csname string from \muskipdef
.
- Corresponding C source code: ltexlib.c#L967-L977
tex.ismuskip
@param
register
- A register number or a predefined csname string from \muskipdef
.
- Corresponding C source code: ltexlib.c#L951-L954
- Corresponding C source code: ltexlib.c#L350-L358
tex.setskip
function tex.setskip(
global: "global",
register: (string|integer),
skip: GlueSpecNode {
width = integer,
stretch = integer,
stretch_order = integer,
shrink = integer,
shrink_order = integer,
}
)
global
- It is possible to define values globally by using the string global
as the first function argument.
@param register
- A register number or a predefined csname string from \skipdef
.
- Corresponding C source code: ltexlib.c#L853-L866
tex.setskip
function tex.setskip(
register: (string|integer),
skip: GlueSpecNode {
width = integer,
stretch = integer,
stretch_order = integer,
shrink = integer,
shrink_order = integer,
}
)
register
- A register number or a predefined csname string from \skipdef
.
- Corresponding C source code: ltexlib.c#L853-L866
tex.getskip
function tex.getskip(register: (string|integer)) -> GlueSpecNode {
width = integer,
stretch = integer,
stretch_order = integer,
shrink = integer,
shrink_order = integer,
}
register
- A register number or a predefined csname string from \skipdef
.
- Corresponding C source code: ltexlib.c#L868-L882
tex.isskip
@param
register
- A register number or a predefined csname string from \skipdef
.
- Corresponding C source code: ltexlib.c#L848-L851
- Corresponding C source code: ltexlib.c#L350-L358
tex.settoks
@param
global
- It is possible to define values globally by using the string global
as the first function argument.
@param register
- A register number or a predefined csname string from \toksdef
.
Set a toks register. Also accepts a predefined csname string.
- Corresponding C source code: ltexlib.c#L1125-L1158
tex.gettoks
@param
register
- A register number or a predefined csname string from \toksdef
.
Get a toks register. Also accepts a predefined csname string.
- Corresponding C source code: ltexlib.c#L1197-L1209
tex.istoks
@param
register
- A register number or a predefined csname string from \toksdef
.
- Corresponding C source code: ltexlib.c#L1120-L1123
- Corresponding C source code: ltexlib.c#L350-L358
tex.scantoks
For tokens registers we have an alternative where a catcode table is specified:
- Corresponding C source code: ltexlib.c#L1160-L1195
tex.getmark
function tex.getmark(
position: ("top"|"bottom"|"first"|"splitbottom"|"splitfirst")?,
class: integer?
) -> (integer|string)
position
- one of top, bottom, first, splitbottom or splitfirst
@param class
- marks class number.
When no arguments are given the current maximum number of classes is returned.
- Corresponding C source code: ltexlib.c#L1211-L1242
tex.setlccode
function tex.setlccode(
global: "global",
char_code: integer,
lower_case: integer,
upper_case: integer?
)
global
- It is possible to define values globally by using the string global
as the first function argument.
@param char_code
- A Unicode code point for which a lowercase variant of the character is to be set, for example 65
stands for an uppercase A
and 97
for a lowercase a
.
@param lower_case
- The Unicode code point for the lowercase variant of the character.
@param upper_case
- The Unicode code point for the uppercase variant of the character.
😱 Types incomplete or incorrect? 🙏 Please contribute!
Set the lccode
(lower case code) and additionally
the associated sibling for a character code at the same time.
Reference:
- Corresponding C source code: ltexlib.c#L1369-L1397
- Corresponding plain TeX control sequence: \lccode
tex.setlccode
@param
char_code
- A Unicode code point for which a lowercase variant of the character is to be set, for example 65
stands for an uppercase A
and 97
for a lowercase a
.
@param lower_case
- The Unicode code point for the lowercase variant of the character.
@param upper_case
- The Unicode code point for the uppercase variant of the character.
😱 Types incomplete or incorrect? 🙏 Please contribute!
Set the lccode
(lower case code) and additionally
the associated sibling for a character code at the same time.
Reference:
- Corresponding C source code: ltexlib.c#L1369-L1397
- Corresponding plain TeX control sequence: \lccode
tex.getlccode
@param
char_code
- A Unicode code point for which a lowercase variant of the character should be returned, for example 65
stands for an uppercase A
and 97
for a lowercase a
.
@return lower_case
- The Unicode code point for the lowercase variant of the character.
😱 Types incomplete or incorrect? 🙏 Please contribute!
Reference:
- Corresponding C source code: ltexlib.c#L1404-L1410
- Corresponding plain TeX control sequence: \lccode
tex.setuccode
function tex.setuccode(
global: "global",
char_code: integer,
upper_case: integer,
lower_case: integer?
)
global
- It is possible to define values globally by using the string global
as the first function argument.
@param char_code
- A Unicode code point for which a uppercase variant of the character is to be set, for example 65
stands for an uppercase A
and 97
for a lowercase a
.
@param upper_case
- The Unicode code point for the uppercase variant of the character.
@param lower_case
- The Unicode code point for the lowercase variant of the character.
😱 Types incomplete or incorrect? 🙏 Please contribute!
The function call interface for uccode
(upper case code) additionally
allows you to set the associated sibling at the same time.
Reference:
- Corresponding C source code: ltexlib.c#L1369-L1397
- Corresponding plain TeX control sequence: \uccode
tex.setuccode
@param
char_code
- A Unicode code point for which a uppercase variant of the character is to be set, for example 65
stands for an uppercase A
and 97
for a lowercase a
.
@param upper_case
- The Unicode code point for the uppercase variant of the character.
@param lower_case
- The Unicode code point for the lowercase variant of the character.
The function call interface for uccode
(upper case code) additionally
allows you to set the associated sibling at the same time.
Reference:
- Corresponding C source code: ltexlib.c#L1369-L1397
- Corresponding plain TeX control sequence: \uccode
@see tex.getuccode tex.setlccode
tex.getuccode
@param
char_code
- A Unicode code point for which a uppercase variant of the character should be returned, for example 65
stands for an uppercase A
and 97
for a lowercase a
.
@return upper_case
- The Unicode code point for the uppercase variant of the character.
😱 Types incomplete or incorrect? 🙏 Please contribute!
Corresponding plain TeX control sequence: \uccode
Reference:
- Corresponding C source code: ltexlib.c#L1417-L1423
- Corresponding plain TeX control sequence: \uccode
tex.setsfcode
@param
global
- It is possible to define values globally by using the string global
as the first function argument.
@param char_code
- A Unicode code point, for example 65
stands for an uppercase A
and 97
for a lowercase a
.
@param space_factor
- The code (between 0
and 32767
) to adjust the space factor in a horizontal list. The uppercase letters A-Z
have space factor code 999
. Most other characters have code 1000
.
😱 Types incomplete or incorrect? 🙏 Please contribute!
Set the space factor code for a character globally.
Reference:
- Corresponding C source code: ltexlib.c#L1425-L1428
- Corresponding plain TeX control sequence: \sfcode
tex.setsfcode
@param
char_code
- A Unicode code point, for example 65
stands for an uppercase A
and 97
for a lowercase a
.
@param space_factor
- The code (between 0
and 32767
) to adjust the space factor in a horizontal list. The uppercase letters A-Z
have space factor code 999
. Most other characters have code 1000
.
😱 Types incomplete or incorrect? 🙏 Please contribute!
Set the space factor code for a character.
Reference:
- Corresponding C source code: ltexlib.c#L1425-L1428
- Corresponding plain TeX control sequence: \sfcode
tex.getsfcode
@param
char_code
- A Unicode code point, for example 65
stands for an uppercase A
and 97
for a lowercase a
.
@return space_factor
- The code (between 0
and 32767
) to adjust the space factor in a horizontal list. The uppercase letters A-Z
have space factor code 999
. Most other characters have code 1000
.
😱 Types incomplete or incorrect? 🙏 Please contribute!
Get the space factor code of a character.
Reference:
- Corresponding C source code: ltexlib.c#L1430-L1436
- Corresponding plain TeX control sequence: \sfcode
tex.setcatcode
@param
global
- It is possible to define values globally by using the string global
as the first function argument.
@param char_code
- The character code, for example ASCII or UNICODE character code.
@param cat_code
- The category code (0
stands for the escape character, normally \
, 1
stands for begin grouping, normally {
and so on).
😱 Types incomplete or incorrect? 🙏 Please contribute!
Specify a category table to use on assignment or on query (default in both cases is the current one).
- Corresponding C source code: ltexlib.c#L1438-L1464
tex.setcatcode
@param
char_code
- The character code, for example ASCII or UNICODE character code.
@param cat_code
- The category code (0
stands for the escape character, normally \
, 1
stands for begin grouping, normally {
and so on).
😱 Types incomplete or incorrect? 🙏 Please contribute!
Specify a category table to use on assignment or on query (default in both cases is the current one).
Category codes:
0
: Escape character, normally\
1
: Begin grouping, normally{
2
: End grouping, normally}
3
: Math shift, normally$
4
: Alignment tab, normally&
5
: End of line, normally<return>
6
: Parameter, normally#
7
: Superscript, normally^
8
: Subscript, normally_
9
: Ignored character, normally<null>
10
: Space, normally<space>
and<tab>
11
: Letter, normally only contains the lettersa,...,z
andA,...,Z
. These characters can be used in command names12
: Other, normally everything else not listed in the other categories13
: Active character, for example~
14
: Comment character, normally%
15
: Invalid character, normally<delete>
Reference:
- Corresponding C source code: ltexlib.c#L1438-L1464
tex.setcatcode
function tex.setcatcode(
global: "global",
cat_table: integer,
char_code: integer,
cat_code: integer
)
global
- It is possible to define values globally by using the string global
as the first function argument.
@param char_code
- The character code, for example ASCII or UNICODE character code.
@param cat_code
- The category code (0
stands for the escape character, normally \
, 1
stands for begin grouping, normally {
and so on).
😱 Types incomplete or incorrect? 🙏 Please contribute!
Specify a category table to use on assignment or on query (default in both cases is the current one).
Category codes:
0
: Escape character, normally\
1
: Begin grouping, normally{
2
: End grouping, normally}
3
: Math shift, normally$
4
: Alignment tab, normally&
5
: End of line, normally<return>
6
: Parameter, normally#
7
: Superscript, normally^
8
: Subscript, normally_
9
: Ignored character, normally<null>
10
: Space, normally<space>
and<tab>
11
: Letter, normally only contains the lettersa,...,z
andA,...,Z
. These characters can be used in command names12
: Other, normally everything else not listed in the other categories13
: Active character, for example~
14
: Comment character, normally%
15
: Invalid character, normally<delete>
Reference:
- Corresponding C source code: ltexlib.c#L1438-L1464
tex.setcatcode
@param
char_code
- The character code, for example ASCII or UNICODE character code.
@param cat_code
- The category code (0
stands for the escape character, normally \
, 1
stands for begin grouping, normally {
and so on).
😱 Types incomplete or incorrect? 🙏 Please contribute!
Specify a category table to use on assignment or on query (default in both cases is the current one).
Category codes:
0
: Escape character, normally\
1
: Begin grouping, normally{
2
: End grouping, normally}
3
: Math shift, normally$
4
: Alignment tab, normally&
5
: End of line, normally<return>
6
: Parameter, normally#
7
: Superscript, normally^
8
: Subscript, normally_
9
: Ignored character, normally<null>
10
: Space, normally<space>
and<tab>
11
: Letter, normally only contains the lettersa,...,z
andA,...,Z
. These characters can be used in command names12
: Other, normally everything else not listed in the other categories13
: Active character, for example~
14
: Comment character, normally%
15
: Invalid character, normally<delete>
Reference:
- Corresponding C source code: ltexlib.c#L1438-L1464
tex.getcatcode
@param
char_code
- The character code, for example ASCII or UNICODE character code.
@return cat_code
- The category code (0
stands for the escape character, normally \
, 1
stands for begin grouping, normally {
and so on).
😱 Types incomplete or incorrect? 🙏 Please contribute!
The function call interface for catcode
(category code) also allows you to specify a
category table to use on assignment or on query (default in both cases is the
current one):
Category codes:
0
: Escape character, normally\
1
: Begin grouping, normally{
2
: End grouping, normally}
3
: Math shift, normally$
4
: Alignment tab, normally&
5
: End of line, normally<return>
6
: Parameter, normally#
7
: Superscript, normally^
8
: Subscript, normally_
9
: Ignored character, normally<null>
10
: Space, normally<space>
and<tab>
11
: Letter, normally only contains the lettersa,...,z
andA,...,Z
. These characters can be used in command names12
: Other, normally everything else not listed in the other categories13
: Active character, for example~
14
: Comment character, normally%
15
: Invalid character, normally<delete>
tex.setmathcode
function tex.setmathcode(
global: "global",
char_code: integer,
class: integer,
family: integer,
character: integer
)
global
- It is possible to define values globally by using the string global
as the first function argument.
@param char_code
- The ASCII or UNICODE charcater code point.
@param class
- The class to which a math character belongs (0
: Ordinary, 1
: Large operator, 2
: Binary operation, 3
: Relation, 4
: Opening, 5
: Closing, 6
: Punctuation, 7
: Variable family).
@param family
- TeX uses fonts from one or more of the sixteen font families to typeset mathematical characters. Each font family consists of three fonts — textfont, scriptfont, and scriptscriptfont. (0
: Roman, 1
: Math italic, 2
: Math symbol, 3
: Math extension, 4
: Italic text, 5
: Slanted text, 6
: Bold text, 7
: Typewriter)
@param character
- The character position
😱 Types incomplete or incorrect? 🙏 Please contribute!
class:
Class | Meaning | Example |
---|---|---|
0 | Ordinary | / |
1 | Large operator | \sum |
2 | Binary operation | + |
3 | Relation | = |
4 | Opening | ( |
5 | Closing | ) |
6 | Punctuation | , |
7 | Variable family | x |
family:
% Family 0 (Roman)
\font\tenrm=mdbchr7t at10pt
\font\sevenrm=mdbchr7t at7pt
\font\fiverm=mdbchr7t at5pt
\textfont0=\tenrm
\scriptfont0=\sevenrm
27
\scriptscriptfont0=\fiverm
\def\rm{\fam=0 \tenrm}
%
% Family 1 (Math italic)
\font\teni=mdbchri7m at10pt
\font\seveni=mdbchri7m at7pt
\font\fivei=mdbchri7m at5pt
\textfont1=\teni
\scriptfont1=\seveni
\scriptscriptfont1=\fivei
\def\mit{\fam=1}
%
% Family 2 (Math symbols)
\font\tensy=md-chr7y at10pt
\font\sevensy=md-chr7y at7pt
\font\fivesy=md-chr7y at5pt
\textfont2=\tensy
\scriptfont2=\
% Family 3 (Math extension)
\font\tenex=mdbchr7v at10pt
\font\sevenex=mdbchr7v at7pt
\font\fiveex=mdbchr7v at5pt
\textfont3=\tenex
\scriptfont3=\sevenex
\scriptscriptfont3=\fiveex
%
% Family 4 (Italic text)
\font\tenit=mdbchri7t at10pt
\font\sevenit=mdbchri7t at7pt
\font\fiveit=mdbchri7t at5pt
\textfont\itfam=\tenit
\scriptfont\itfam=\sevenit
\scriptscriptfont\itfam=\fiveit
\def\it{\fam=\itfam \tenit}
%
% Family 5 (Slanted text)
\font\tensl=mdbchro7t at10pt
\font\sevensl=mdbchro7t at7pt
\font\fivesl=mdbchro7t at5pt
\textfont\slfam=\tensl
\scriptfont\slfam=\sevensl
\scriptscriptfont\slfam=\fivesl
\def\sl{\fam=\slfam \tensl}
%
% Family 6 (Bold text)
\font\tenbf=mdbchb7t at10pt
\font\sevenbf=mdbchb7t at7pt
\font\fivebf=mdbchb7t at5pt
\textfont\bffam=\tenbf
\scriptfont\bffam=\sevenbf
\scriptscriptfont\bffam=\fivebf
\def\bf{\fam=\bffam \tenbf}
%
% Family 7 (Typewriter)
\font\tentt=cmtt10---%
\rm
% Sets normal roman font
\font\seventt=cmtt10 at7pt
\font\fivett=cmtt10 at5pt
\textfont\ttfam=\tentt
\scriptfont\ttfam=\seventt
\scriptscriptfont\ttfam=\fivett
\def\tt{\fam=\ttfam \tentt}
```sevensy
\scriptscriptfont2=\fivesy
\def\cal{\fam=2}
%
% Family 3 (Math extension)
\font\tenex=mdbchr7v at10pt
\font\sevenex=mdbchr7v at7pt
\font\fiveex=mdbchr7v at5pt
\textfont3=\tenex
\scriptfont3=\sevenex
\scriptscriptfont3=\fiveex
%
% Family 4 (Italic text)
\font\tenit=mdbchri7t at10pt
\font\sevenit=mdbchri7t at7pt
\font\fiveit=mdbchri7t at5pt
\textfont\itfam=\tenit
\scriptfont\itfam=\sevenit
\scriptscriptfont\itfam=\fiveit
\def\it{\fam=\itfam \tenit}
%
% Family 5 (Slanted text)
\font\tensl=mdbchro7t at10pt
\font\sevensl=mdbchro7t at7pt
\font\fivesl=mdbchro7t at5pt
\textfont\slfam=\tensl
\scriptfont\slfam=\sevensl
\scriptscriptfont\slfam=\fivesl
\def\sl{\fam=\slfam \tensl}
%
% Family 6 (Bold text)
\font\tenbf=mdbchb7t at10pt
\font\sevenbf=mdbchb7t at7pt
\font\fivebf=mdbchb7t at5pt
\textfont\bffam=\tenbf
\scriptfont\bffam=\sevenbf
\scriptscriptfont\bffam=\fivebf
\def\bf{\fam=\bffam \tenbf}
%
% Family 7 (Typewriter)
\font\tentt=cmtt10---%
\rm
% Sets normal roman font
\font\seventt=cmtt10 at7pt
\font\fivett=cmtt10 at5pt
\textfont\ttfam=\tentt
\scriptfont\ttfam=\seventt
\scriptscriptfont\ttfam=\fivett
\def\tt{\fam=\ttfam \tentt}
Reference:
- Corresponding C source code: ltexlib.c#L1524-1561
- Corresponding plain TeX control sequence: \mathcode
- Donald E. Knuth: The TeXbook, Page 154
- TUGboat, Volume 31 (2010), No. 1, Mathematical typefaces in TEX documents, Amit Raj Dhawan
tex.setmathcode
function tex.setmathcode(
global: "global",
char_code: integer,
class: integer,
family: integer,
character: integer
)
global
- It is possible to define values globally by using the string global
as the first function argument.
@param char_code
- The ASCII or UNICODE charcater code point.
@param class
- The class to which a math character belongs (0
: Ordinary, 1
: Large operator, 2
: Binary operation, 3
: Relation, 4
: Opening, 5
: Closing, 6
: Punctuation, 7
: Variable family).
@param family
- TeX uses fonts from one or more of the sixteen font families to typeset mathematical characters. Each font family consists of three fonts — textfont, scriptfont, and scriptscriptfont. (0
: Roman, 1
: Math italic, 2
: Math symbol, 3
: Math extension, 4
: Italic text, 5
: Slanted text, 6
: Bold text, 7
: Typewriter)
@param character
- The character position
😱 Types incomplete or incorrect? 🙏 Please contribute!
class:
Class | Meaning | Example |
---|---|---|
0 | Ordinary | / |
1 | Large operator | \sum |
2 | Binary operation | + |
3 | Relation | = |
4 | Opening | ( |
5 | Closing | ) |
6 | Punctuation | , |
7 | Variable family | x |
family:
% Family 0 (Roman)
\font\tenrm=mdbchr7t at10pt
\font\sevenrm=mdbchr7t at7pt
\font\fiverm=mdbchr7t at5pt
\textfont0=\tenrm
\scriptfont0=\sevenrm
27
\scriptscriptfont0=\fiverm
\def\rm{\fam=0 \tenrm}
%
% Family 1 (Math italic)
\font\teni=mdbchri7m at10pt
\font\seveni=mdbchri7m at7pt
\font\fivei=mdbchri7m at5pt
\textfont1=\teni
\scriptfont1=\seveni
\scriptscriptfont1=\fivei
\def\mit{\fam=1}
%
% Family 2 (Math symbols)
\font\tensy=md-chr7y at10pt
\font\sevensy=md-chr7y at7pt
\font\fivesy=md-chr7y at5pt
\textfont2=\tensy
\scriptfont2=\
% Family 3 (Math extension)
\font\tenex=mdbchr7v at10pt
\font\sevenex=mdbchr7v at7pt
\font\fiveex=mdbchr7v at5pt
\textfont3=\tenex
\scriptfont3=\sevenex
\scriptscriptfont3=\fiveex
%
% Family 4 (Italic text)
\font\tenit=mdbchri7t at10pt
\font\sevenit=mdbchri7t at7pt
\font\fiveit=mdbchri7t at5pt
\textfont\itfam=\tenit
\scriptfont\itfam=\sevenit
\scriptscriptfont\itfam=\fiveit
\def\it{\fam=\itfam \tenit}
%
% Family 5 (Slanted text)
\font\tensl=mdbchro7t at10pt
\font\sevensl=mdbchro7t at7pt
\font\fivesl=mdbchro7t at5pt
\textfont\slfam=\tensl
\scriptfont\slfam=\sevensl
\scriptscriptfont\slfam=\fivesl
\def\sl{\fam=\slfam \tensl}
%
% Family 6 (Bold text)
\font\tenbf=mdbchb7t at10pt
\font\sevenbf=mdbchb7t at7pt
\font\fivebf=mdbchb7t at5pt
\textfont\bffam=\tenbf
\scriptfont\bffam=\sevenbf
\scriptscriptfont\bffam=\fivebf
\def\bf{\fam=\bffam \tenbf}
%
% Family 7 (Typewriter)
\font\tentt=cmtt10---%
\rm
% Sets normal roman font
\font\seventt=cmtt10 at7pt
\font\fivett=cmtt10 at5pt
\textfont\ttfam=\tentt
\scriptfont\ttfam=\seventt
\scriptscriptfont\ttfam=\fivett
\def\tt{\fam=\ttfam \tentt}
```sevensy
\scriptscriptfont2=\fivesy
\def\cal{\fam=2}
%
% Family 3 (Math extension)
\font\tenex=mdbchr7v at10pt
\font\sevenex=mdbchr7v at7pt
\font\fiveex=mdbchr7v at5pt
\textfont3=\tenex
\scriptfont3=\sevenex
\scriptscriptfont3=\fiveex
%
% Family 4 (Italic text)
\font\tenit=mdbchri7t at10pt
\font\sevenit=mdbchri7t at7pt
\font\fiveit=mdbchri7t at5pt
\textfont\itfam=\tenit
\scriptfont\itfam=\sevenit
\scriptscriptfont\itfam=\fiveit
\def\it{\fam=\itfam \tenit}
%
% Family 5 (Slanted text)
\font\tensl=mdbchro7t at10pt
\font\sevensl=mdbchro7t at7pt
\font\fivesl=mdbchro7t at5pt
\textfont\slfam=\tensl
\scriptfont\slfam=\sevensl
\scriptscriptfont\slfam=\fivesl
\def\sl{\fam=\slfam \tensl}
%
% Family 6 (Bold text)
\font\tenbf=mdbchb7t at10pt
\font\sevenbf=mdbchb7t at7pt
\font\fivebf=mdbchb7t at5pt
\textfont\bffam=\tenbf
\scriptfont\bffam=\sevenbf
\scriptscriptfont\bffam=\fivebf
\def\bf{\fam=\bffam \tenbf}
%
% Family 7 (Typewriter)
\font\tentt=cmtt10---%
\rm
% Sets normal roman font
\font\seventt=cmtt10 at7pt
\font\fivett=cmtt10 at5pt
\textfont\ttfam=\tentt
\scriptfont\ttfam=\seventt
\scriptscriptfont\ttfam=\fivett
\def\tt{\fam=\ttfam \tentt}
Reference:
- Corresponding C source code: ltexlib.c#L1524-L1561
- Corresponding plain TeX control sequence: \mathcode
- Donald E. Knuth: The TeXbook, Page 154
- TUGboat, Volume 31 (2010), No. 1, Mathematical typefaces in TEX documents, Amit Raj Dhawan
tex.setmathcode
@param
global
- It is possible to define values globally by using the string global
as the first function argument.
@param char_code
- The ASCII or UNICODE charcater code point.
@param math_code
- A table with three integers (class, family, character).
😱 Types incomplete or incorrect? 🙏 Please contribute!
Reference:
- Corresponding C source code: ltexlib.c#L1524-L1561
- Corresponding plain TeX control sequence: \mathcode
tex.setmathcode
@param
char_code
- The ASCII or UNICODE charcater code point.
@param math_code
- A table with three integers (class, family, character).
😱 Types incomplete or incorrect? 🙏 Please contribute!
Reference:
- Corresponding C source code: ltexlib.c#L1524-L1561
- Corresponding plain TeX control sequence: \mathcode
tex.getmathcode
@return math_code
- A table with three integers (class, family, character).
😱 Types incomplete or incorrect? 🙏 Please contribute!
Retrieve the math code of a character as a table with three integers (class, family, character).
Examples from The TeXBook, page 154:
\mathcode‘<="313C
- ASCII
<
: 60 (decimal) 3C (hexadecimal) - class: 3
- family: 1
- character: 60
\mathcode‘*="2203
- ASCII
*
: 42 (decimal) 2A (hexadecimal) - class: 2
- family: 2
- character: 3
Reference:
- Corresponding C source code: ltexlib.c#L1563-L1577
- Corresponding plain TeX control sequence: \mathcode
tex.getmathcodes
function tex.getmathcodes(char_code: integer)
-> class integer
-> family integer
-> character integer
@return class
- The class to which a math character belongs (0
: Ordinary, 1
: Large operator, 2
: Binary operation, 3
: Relation, 4
: Opening, 5
: Closing, 6
: Punctuation, 7
: Variable family).
@return family
- TeX uses fonts from one or more of the sixteen font families to typeset mathematical characters. Each font family consists of three fonts — textfont, scriptfont, and scriptscriptfont. (0
: Roman, 1
: Math italic, 2
: Math symbol, 3
: Math extension, 4
: Italic text, 5
: Slanted text, 6
: Bold text, 7
: Typewriter)
@return character
- The character position
😱 Types incomplete or incorrect? 🙏 Please contribute!
Retrieve the math code of a character as three integers (class, family, character).
Examples from The TeXBook, page 154:
\mathcode‘<="313C
- ASCII
<
: 60 (decimal) 3C (hexadecimal) - class: 3
- family: 1
- character: 60
\mathcode‘*="2203
- ASCII
*
: 42 (decimal) 2A (hexadecimal) - class: 2
- family: 2
- character: 3
class:
Class | Meaning | Example |
---|---|---|
0 | Ordinary | / |
1 | Large operator | \sum |
2 | Binary operation | + |
3 | Relation | = |
4 | Opening | ( |
5 | Closing | ) |
6 | Punctuation | , |
7 | Variable family | x |
family:
% Family 0 (Roman)
\font\tenrm=mdbchr7t at10pt
\font\sevenrm=mdbchr7t at7pt
\font\fiverm=mdbchr7t at5pt
\textfont0=\tenrm
\scriptfont0=\sevenrm
27
\scriptscriptfont0=\fiverm
\def\rm{\fam=0 \tenrm}
%
% Family 1 (Math italic)
\font\teni=mdbchri7m at10pt
\font\seveni=mdbchri7m at7pt
\font\fivei=mdbchri7m at5pt
\textfont1=\teni
\scriptfont1=\seveni
\scriptscriptfont1=\fivei
\def\mit{\fam=1}
%
% Family 2 (Math symbols)
\font\tensy=md-chr7y at10pt
\font\sevensy=md-chr7y at7pt
\font\fivesy=md-chr7y at5pt
\textfont2=\tensy
\scriptfont2=\
% Family 3 (Math extension)
\font\tenex=mdbchr7v at10pt
\font\sevenex=mdbchr7v at7pt
\font\fiveex=mdbchr7v at5pt
\textfont3=\tenex
\scriptfont3=\sevenex
\scriptscriptfont3=\fiveex
%
% Family 4 (Italic text)
\font\tenit=mdbchri7t at10pt
\font\sevenit=mdbchri7t at7pt
\font\fiveit=mdbchri7t at5pt
\textfont\itfam=\tenit
\scriptfont\itfam=\sevenit
\scriptscriptfont\itfam=\fiveit
\def\it{\fam=\itfam \tenit}
%
% Family 5 (Slanted text)
\font\tensl=mdbchro7t at10pt
\font\sevensl=mdbchro7t at7pt
\font\fivesl=mdbchro7t at5pt
\textfont\slfam=\tensl
\scriptfont\slfam=\sevensl
\scriptscriptfont\slfam=\fivesl
\def\sl{\fam=\slfam \tensl}
%
% Family 6 (Bold text)
\font\tenbf=mdbchb7t at10pt
\font\sevenbf=mdbchb7t at7pt
\font\fivebf=mdbchb7t at5pt
\textfont\bffam=\tenbf
\scriptfont\bffam=\sevenbf
\scriptscriptfont\bffam=\fivebf
\def\bf{\fam=\bffam \tenbf}
%
% Family 7 (Typewriter)
\font\tentt=cmtt10---%
\rm
% Sets normal roman font
\font\seventt=cmtt10 at7pt
\font\fivett=cmtt10 at5pt
\textfont\ttfam=\tentt
\scriptfont\ttfam=\seventt
\scriptscriptfont\ttfam=\fivett
\def\tt{\fam=\ttfam \tentt}
```sevensy
\scriptscriptfont2=\fivesy
\def\cal{\fam=2}
%
% Family 3 (Math extension)
\font\tenex=mdbchr7v at10pt
\font\sevenex=mdbchr7v at7pt
\font\fiveex=mdbchr7v at5pt
\textfont3=\tenex
\scriptfont3=\sevenex
\scriptscriptfont3=\fiveex
%
% Family 4 (Italic text)
\font\tenit=mdbchri7t at10pt
\font\sevenit=mdbchri7t at7pt
\font\fiveit=mdbchri7t at5pt
\textfont\itfam=\tenit
\scriptfont\itfam=\sevenit
\scriptscriptfont\itfam=\fiveit
\def\it{\fam=\itfam \tenit}
%
% Family 5 (Slanted text)
\font\tensl=mdbchro7t at10pt
\font\sevensl=mdbchro7t at7pt
\font\fivesl=mdbchro7t at5pt
\textfont\slfam=\tensl
\scriptfont\slfam=\sevensl
\scriptscriptfont\slfam=\fivesl
\def\sl{\fam=\slfam \tensl}
%
% Family 6 (Bold text)
\font\tenbf=mdbchb7t at10pt
\font\sevenbf=mdbchb7t at7pt
\font\fivebf=mdbchb7t at5pt
\textfont\bffam=\tenbf
\scriptfont\bffam=\sevenbf
\scriptscriptfont\bffam=\fivebf
\def\bf{\fam=\bffam \tenbf}
%
% Family 7 (Typewriter)
\font\tentt=cmtt10---%
\rm
% Sets normal roman font
\font\seventt=cmtt10 at7pt
\font\fivett=cmtt10 at5pt
\textfont\ttfam=\tentt
\scriptfont\ttfam=\seventt
\scriptscriptfont\ttfam=\fivett
\def\tt{\fam=\ttfam \tentt}
Reference:
- Corresponding C source code: ltexlib.c#L1579-L1589
- Corresponding plain TeX control sequence: \mathcode
- Donald E. Knuth: The TeXbook, Page 154
- TUGboat, Volume 31 (2010), No. 1, Mathematical typefaces in TEX documents, Amit Raj Dhawan
tex.setdelcode
function tex.setdelcode(
global: "global",
char_code: integer,
small_family: integer,
small_character: integer,
large_family: integer,
large_character: integer
)
global
- It is possible to define values globally by using the string global
as the first function argument.
-Reference:
- Corresponding C source code: ltexlib.c#L1640-L1681
- Corresponding plain TeX control sequence: \delcode
tex.setdelcode
function tex.setdelcode(
char_code: integer,
small_family: integer,
small_character: integer,
large_family: integer,
large_character: integer
)
-Reference:
- Corresponding C source code: ltexlib.c#L1640-L1681
- Corresponding plain TeX control sequence: \delcode
tex.setdelcode
@param
global
- It is possible to define values globally by using the string global
as the first function argument.
- Corresponding C source code: ltexlib.c#L1640-L1681
- Corresponding plain TeX control sequence: \delcode
tex.setdelcode
-Reference:
- Corresponding C source code: ltexlib.c#L1640-L1681
- Corresponding plain TeX control sequence: \delcode
tex.getdelcodes
function tex.getdelcodes(char_code: integer)
-> small_family integer
-> small_character integer
-> large_family integer
-> large_character integer
- Corresponding C source code: ltexlib.c#L1701-L1712
- Corresponding plain TeX control sequence: \delcode
tex.getdelcode
-Reference:
- Corresponding C source code: ltexlib.c#L1683-L1699
- Corresponding plain TeX control sequence: \delcode
tex.setbox
function tex.setbox(
global: "global",
register: integer,
head: Node {
next = Node?,
prev = Node?,
id = integer,
subtype = integer,
head = Node?,
attr = Node,
}
)
global
- It is possible to define values globally by using the string global
as the first function argument.
@param register
- A box register number (0 to 65535).
@param head
- A hlist
or vlist
node.
😱 Types incomplete or incorrect? 🙏 Please contribute!
Set a box, coming for instance from hbox
, vbox
or vtop
.
Reference:
- Corresponding C source code: ltexlib.c#L1352-L1362
- Corresponding plain TeX control sequence: \setbox
tex.setbox
function tex.setbox(
register: integer,
head: Node {
next = Node?,
prev = Node?,
id = integer,
subtype = integer,
head = Node?,
attr = Node,
}
)
register
- A box register number (0 to 65535).
@param head
- A hlist
or vlist
node.
😱 Types incomplete or incorrect? 🙏 Please contribute!
Set a box, coming for instance from hbox
, vbox
or vtop
.
Reference:
- Corresponding C source code: ltexlib.c#L1352-L1362
- Corresponding plain TeX control sequence: \setbox
tex.getbox
@param
register
- A box register number (0 to 65535) or a cs name (for example \newbox\MyBox
: MyBox
)
Query an actual box, coming for instance from hbox
, vbox
or vtop
.
Reference:
- Corresponding C source code: ltexlib.c#L1272-L1280
- Corresponding plain TeX control sequence: \box
tex.isbox
@param
register
- A box register number (0 to 65535) or a cs name (for example \newbox\MyBox
: MyBox
)
Check if the given integer is a valid box register number.
Example:
Reference:
- Corresponding C source code: ltexlib.c#L1310-L1315
tex.saveboxresource
function tex.saveboxresource(
n: (Node|integer),
attributes: string,
resources: string,
immediate: boolean,
type: integer,
margin: integer
) -> index integer
n
- Instead of a box number one can also pass a [h|v]list
node.
@param type
- When set to non-zero the /Type
entry is omitted. A value of 1 or 3 still writes a /BBox
, while 2 or 3 will write a /Matrix
.
@param margin
- The (virtual) margin that extends beyond the effective boundingbox as seen by TeX.
Register a box for reuse (this is modelled after so
called xforms in PDF). You can (re)use the box with useboxresource
or
by creating a rule node with subtype 2.
- Corresponding C source code: ltexlib.c#L3217-L3278
@see tex.useboxresource
tex.getboxresourcebox
function tex.getboxresourcebox(n: integer) -> Node {
next = Node?,
prev = Node?,
id = integer,
subtype = integer,
head = Node?,
attr = Node,
}
- Corresponding Lua source code: ltexlib.c#L3346-L3355
tex.useboxresource
function tex.useboxresource(
n: integer,
width: integer?,
height: integer?,
depth: integer?
)
-> margin Node?
-> width integer?
-> height integer?
-> depth integer?
Generate the reference (a rule type).
The dimensions are optional and the final ones are returned as extra values.
- Corresponding C source code: ltexlib.c#L3280-L3325
@see tex.saveboxresource
tex.getboxresourcedimensions
function tex.getboxresourcedimensions(n: Node {
next = Node?,
prev = Node?,
id = integer,
subtype = integer,
head = Node?,
attr = Node,
})
-> width integer?
-> height integer?
-> depth integer?
-> margin integer?
Return the width, height, depth and margin of the resource.
No dimensions returned means that the resource is unknown.
- Corresponding C source code: ltexlib.c#L3327-L3344
tex.triggerbuildpage
Call the internal function that build a page, given that there is something to build.
You should not expect to much from the triggerbuildpage
helpers because
often TeX doesn't do much if it thinks nothing has to be done, but it might be
useful for some applications.
- Corresponding C source code: ltexlib.c#L3357-L3361
😱 Types incomplete or incorrect? 🙏 Please contribute!
tex.splitbox
function tex.splitbox(
n: Node {
next = Node?,
prev = Node?,
id = integer,
subtype = integer,
head = Node?,
attr = Node,
},
height: integer,
mode: ("additional"|"exactly")
) -> vlist Node?
Split a box.
The remainder is kept in the original box and a packaged vlist is returned. This
operation is comparable to the vsplit
operation. The mode can be additional
or exactly
and concerns the split off box.
- Corresponding C source code: ltexlib.c#L1282-L1308
tex.setmath
function tex.setmath(
math_param_name: MathParamName,
math_style_name: MathStyleName,
value: integer
)
Set the internal math parameters.
- Corresponding C source code: ltexlib.c#L1986-L2015
tex.setmath
function tex.setmath(
global: "global",
math_param_name: MathParamName,
math_style_name: MathStyleName,
value: (integer|Node)
)
global
- Indicate a global assignment.
@param value
- The value is either a number (representing a dimension or number) or a glue spec node representing a muskip for ordordspacing
and similar spacing parameters.
😱 Types incomplete or incorrect? 🙏 Please contribute!
Set the internal math parameters.
- Corresponding C source code: ltexlib.c#L1986-L2015
tex.getmath
function tex.getmath(
math_param_name: MathParamName,
math_style_name: MathStyleName
) -> value (integer|Node)
@return value
- The value is either a number (representing a dimension or number) or a glue spec node representing a muskip for ordordspacing
and similar spacing parameters.
😱 Types incomplete or incorrect? 🙏 Please contribute!
Query the internal math parameters.
- Corresponding C source code: ltexlib.c#L2017-L2039
tex.setlist
You have to be careful with what you set as TeX can have expectations with regards to how a list is constructed or in what state it is.
- Corresponding C source code: ltexlib.c#L2266-L2321
😱 Types incomplete or incorrect? 🙏 Please contribute!
tex.getlist
- Corresponding C source code: ltexlib.c#L2202-L2264
😱 Types incomplete or incorrect? 🙏 Please contribute!
tex.getnest
function tex.getnest() -> Nest {
mode = number,
modeline = integer,
head = Node,
tail = Node,
prevgraf = integer,
prevdepth = integer,
spacefactor = integer,
dirs = Node,
noad = Node,
delimptr = Node,
mathdir = boolean,
mathstyle = integer,
...(+0)
}
The getter function is getnest
. You
can pass a number (which gives you a list), nothing or top
, which returns
the topmost list, or the string ptr
which gives you the index of the
topmost list.
- Corresponding C source code: ltexlib.c#L2422-L2455
tex.setnest
- Corresponding C source code: ltexlib.c#L2457-L2461
😱 Types incomplete or incorrect? 🙏 Please contribute!
tex.getmodevalues
tex.getmodevalues()
to get the mapping: positive values signal vertical, horizontal and math mode, while negative values indicate inner and inline variants (all modes).
- Corresponding C source code: ltexlib.c#L3549-L3565
😱 Types incomplete or incorrect? 🙏 Please contribute!
tex.print
@param
input_line
- Each string argument is treated by TeX as a separate input line.
@param ...
- The very last string of the very last tex.print
command in a directlua
will not have the endlinechar
appended, all others do.
Reference:
- Source file of the
LuaTeX
manual: luatex-tex.tex#L1222-L1224 - Corresponding C source code: ltexlib.c#L161-164
@see tex.sprint tex.tprint tex.cprint tex.write
tex.print
@param
catcodetable_no
- The parameter can be used to print the strings using the catcode regime defined by \catcodetable
catcodetable_no
. If catcodetable_no
is -1
, the currently active catcode regime is used. If catcodetable_no
is -2
, the resulting catcodes are the result of \the
\toks
: all category codes are 12
(other
) except for the space character, that has category code 10
(space
). Otherwise, if catcodetable_no
is not a valid catcode table, then it is ignored, and the currently active catcode regime is used instead.
@param input_line
- Each string argument is treated by TeX as a separate input line.
@param ...
- The very last string of the very last tex.print
command in a directlua
will not have the endlinechar
appended, all others do.
Reference:
- Source file of the
LuaTeX
manual: luatex-tex.tex#L1222-L1224 - Corresponding C source code: ltexlib.c#L161-164
@see tex.print tex.sprint tex.tprint tex.cprint tex.write
tex.print
@param
input_lines
- Each string (or number) element of the input table is treated by TeX as a separate input line.
If there is a table argument instead of a list of strings, this has to be a consecutive array of strings to print (the first non-string value will stop the printing process).
see LuaTeX
manual: 10.3.14.1 print
Reference:
- Source file of the
LuaTeX
manual: luatex-tex.tex#L1222-L1224 - Corresponding C source code: ltexlib.c#L161-164
@see tex.sprint tex.tprint tex.cprint tex.write
tex.print
@param
catcodetable_no
- The parameter can be used to print the strings using the catcode regime defined by \catcodetable
catcodetable_no
. If catcodetable_no
is -1
, the currently active catcode regime is used. If catcodetable_no
is -2
, the resulting catcodes are the result of \the
\toks
: all category codes are 12
(other
) except for the space character, that has category code 10
(space
). Otherwise, if catcodetable_no
is not a valid catcode table, then it is ignored, and the currently active catcode regime is used instead.
@param input_lines
- Each string element of the input table is treated by TeX as a separate input line.
see LuaTeX
manual: 10.3.14.1 print
Reference:
- Source file of the
LuaTeX
manual: luatex-tex.tex#L1222-L1224 - Corresponding C source code: ltexlib.c#L161-164
@see tex.sprint tex.tprint tex.cprint tex.write
tex.sprint
combines all of its arguments (or the elements of array argument) into a single input line for TeX. So any leading spaces will be treated as if they were typed, etc. (s(ingle-input-line)print
).
Each string argument is treated by TeX as a special kind of input line that makes it suitable for use as a partial line input mechanism:
- TeX does not switch to the “new line” state, so that leading spaces are not ignored.
- No
endlinechar
is inserted. - Trailing spaces are not removed. Note that this does not prevent TeX itself from eating spaces as result of interpreting the line. For example, in
the space before in between
will be gobbled as a result of the
“normal” scanning of \relax
.
If there is a table argument instead of a list of strings, this has to be a consecutive array of strings to print (the first non-string value will stop the printing process).
The optional argument sets the catcode regime, as with tex.print
. This
influences the string arguments (or numbers turned into strings).
Although this needs to be used with care, you can also pass token or node userdata objects. These get injected into the stream. Tokens had best be valid tokens, while nodes need to be around when they get injected. Therefore it is important to realize the following:
- When you inject a token, you need to pass a valid token userdata object. This object will be collected by Lua when it no longer is referenced. When it gets printed to TeX the token itself gets copied so there is no interference with the Lua garbage collection. You manage the object yourself. Because tokens are actually just numbers, there is no real extra overhead at the TeX end.
- When you inject a node, you need to pass a valid node userdata object. The node related to the object will not be collected by Lua when it no longer is referenced. It lives on at the TeX end in its own memory space. When it gets printed to TeX the node reference is used assuming that node stays around. There is no Lua garbage collection involved. Again, you manage the object yourself. The node itself is freed when TeX is done with it.
If you consider the last remark you might realize that we have a problem when a
printed mix of strings, tokens and nodes is reused. Inside TeX the sequence
becomes a linked list of input buffers. So, "123"
or "\foo{123
"}
gets read and parsed on the fly, while <token userdata>
already is
tokenized and effectively is a token list now. A <node userdata>
is also
tokenized into a token list but it has a reference to a real node. Normally this
goes fine. But now assume that you store the whole lot in a macro: in that case
the tokenized node can be flushed many times. But, after the first such flush the
node is used and its memory freed. You can prevent this by using copies which is
controlled by setting luacopyinputnodes
to a non-zero value. This is one
of these fuzzy areas you have to live with if you really mess with these low
level issues.
Reference:
- Corresponding C source code: ltexlib.c#L168-171
@see tex.print tex.tprint tex.cprint tex.write
tex.sprint
@param
catcodetable_no
- The parameter can be used to print the strings using the catcode regime defined by \catcodetable
catcodetable_no
. If catcodetable_no
is -1
, the currently active catcode regime is used. If catcodetable_no
is -2
, the resulting catcodes are the result of \the
\toks
: all category codes are 12
(other
) except for the space character, that has category code 10
(space
). Otherwise, if catcodetable_no
is not a valid catcode table, then it is ignored, and the currently active catcode regime is used instead.
Reference:
- Corresponding C source code: ltexlib.c#L168-171
@see tex.print tex.tprint tex.cprint tex.write
tex.sprint
@param
input
- Each string element of the input table is treated by TeX as a separate input argument.
(s(ingle-input-line)print
).
Reference:
- Corresponding C source code: ltexlib.c#L168-171
@see tex.print tex.tprint tex.cprint tex.write
tex.sprint
@param
catcodetable_no
- The parameter can be used to print the strings using the catcode regime defined by \catcodetable
catcodetable_no
. If catcodetable_no
is -1
, the currently active catcode regime is used. If catcodetable_no
is -2
, the resulting catcodes are the result of \the
\toks
: all category codes are 12
(other
) except for the space character, that has category code 10
(space
). Otherwise, if catcodetable_no
is not a valid catcode table, then it is ignored, and the currently active catcode regime is used instead.---@param t table
@param input
- Each string element of the input table is treated by TeX as a separate input argument.
Reference:
- Corresponding C source code: ltexlib.c#L168-171
@see tex.print tex.tprint tex.cprint tex.write
tex.tprint
@param
input
- Each string element of the input table is treated by TeX as a separate input argument.
Print tables of strings to the input stream (t(able)print
).
This function is basically a shortcut for repeated calls to
tex.sprint(catcodetable_no, input, ...)
, once for each of the
supplied argument tables.
Reference:
- Corresponding C source code: ltexlib.c#L207-242
@see tex.print tex.sprint tex.cprint tex.write
tex.cprint
@param
catcode
- The category code (0
stands for the escape character, normally \
, 1
stands for begin grouping, normally {
and so on).
Print to the input stream and specify a catcode (c(atcode)print
).
tex.cprint( 1, " 1: `&{\\foo}") tex.print("\\par") -- a lot of \bgroup s
tex.cprint( 2, " 2: `&{\\foo}") tex.print("\\par") -- matching \egroup s
tex.cprint( 9, " 9: `&{\\foo}") tex.print("\\par") -- all get ignored
tex.cprint(10, "10: `&{\\foo}") tex.print("\\par") -- all become spaces
tex.cprint(11, "11: `&{\\foo}") tex.print("\\par") -- letters
tex.cprint(12, "12: `&{\\foo}") tex.print("\\par") -- other characters
tex.cprint(14, "12: $&{\\foo}") tex.print("\\par") -- comment triggers
Reference:
- Corresponding C source code: ltexlib.c#L175-203
@see tex.print tex.sprint tex.tprint tex.write
tex.cprint
@param
catcode
- The category code (0
stands for the escape character, normally \
, 1
stands for begin grouping, normally {
and so on).
@param input
- Each string element of the input table is treated by TeX as a separate input argument.
Print to the input stream and specify a catcode (c(atcode)print
).
Reference:
- Corresponding C source code: ltexlib.c#L175-203
@see tex.print tex.sprint tex.tprint tex.write
tex.write
Print to the input stream using category code 12
(other
) except
for the space character, that has category code 10
(space
).
Each string argument is treated by TeX as a special kind of input line that makes it suitable for use as a quick way to dump information:
- All catcodes on that line are either “space” (for
) or “character” (for all others).
- There is no
endlinechar
appended.
Reference:
- Corresponding C source code: ltexlib.c#L175-203
@see tex.print tex.sprint tex.tprint tex.cprint
tex.write
@param
input
- Each string element of the input table is treated by TeX as a separate input argument.
Print to the input stream using category code 12
(other
) except
for the space character, that has category code 10
(space
).
Each string argument is treated by TeX as a special kind of input line that makes it suitable for use as a quick way to dump information:
- All catcodes on that line are either “space” (for
) or “character” (for all others).
- There is no
endlinechar
appended.
Reference:
- Corresponding C source code: ltexlib.c#L175-203
@see tex.print tex.sprint tex.tprint tex.cprint
tex.round
Rounds Lua number o
, and returns a number that is in the range of a
valid TeX register value. If the number starts out of range, it generates a
“number too big” error as well.
Reference:
- Corresponding C source code: ltexlib.c#L2474-2482
tex.scale
Multiplies the Lua numbers o
and delta
, and returns a rounded
number that is in the range of a valid TeX register value. In the table
version, it creates a copy of the table with all numeric top-level values scaled
in that manner. If the multiplied number(s) are of range, it generates
“number too big” error(s) as well.
Note: the precision of the output of this function will depend on your computer's architecture and operating system, so use with care! An interface to LuaTeX's internal, 100% portable scale function will be added at a later date.
Reference:
- Corresponding C source code: ltexlib.c#L2484-2513
tex.scale
tex.number
Companion to the primitive \number
.
Reference:
- Corresponding C source code: ltexlib.c#L2484-2513
- https://www.tug.org/utilities/plain/cseq.html#number-rp
tex.romannumeral
@param
n
- for example 2025
@return - for example mmxxv
😱 Types incomplete or incorrect? 🙏 Please contribute!
Companion to the primitive \romannumeral
.
Reference:
- Corresponding C source code: ltexlib.c#L2061-2064
tex.fontidentifier
@return - for example \tenrm
.
😱 Types incomplete or incorrect? 🙏 Please contribute!
returns the csname
string that matches a
font id number (if there is one).
Reference:
- Corresponding C source code: L2047-L2050
tex.fontname
@return - for example cmr10
.
😱 Types incomplete or incorrect? 🙏 Please contribute!
The first one returns the name only, the second one reports the size too.
Reference:
- Corresponding C source code: L2042-L2045
tex.sp
Converts the number o
that represents an explicit
dimension into an integer number of scaled points.
see LuaTeX
manual: 10.3.15.5 sp
Reference:
- Source file of the
LuaTeX
manual: luatex-tex.tex#L1395-L1396
tex.sp
@param
s
- A string to convert into scaled points.
@return - The dimension in the scaled points format.
😱 Types incomplete or incorrect? 🙏 Please contribute!
Convert a string s
that represents an explicit
dimension into an integer number of scaled points.
For parsing the string, the same scanning and conversion rules are used that LuaTeX would use if it was scanning a dimension specifier in its TeX-like input language (this includes generating errors for bad values), expect for the following:
- only explicit values are allowed, control sequences are not handled
- infinite dimension units (
fil...
) are forbidden mu
units do not generate an error (but may not be useful either)
Example:
Reference:
LuaTeX
manual: 10.3.15.5sp
page 204- Source file of the
LuaTeX
manual: luatex-tex.tex#L1386-L1413
tex.error
@param
message
- An error message like \errmessage
.
@param help
- The array part of the help
table has to contain strings, one for each line of error help.
😱 Types incomplete or incorrect? 🙏 Please contribute!
Create an error like the combination of \errhelp
and
\errmessage
.
During this error, deletions are disabled.
see LuaTeX
manual: 10.3.15.5 sp
Reference:
- Source file of the
LuaTeX
manual: luatex-tex.tex#L1438-L1457 - Corresponding C source code: ltexlib.c#L654-692
tex.show_context
Show the current (expansion) context in case of an error.
-Reference:
- Corresponding C source code: ltexlib.c#L3210-L3215
😱 Types incomplete or incorrect? 🙏 Please contribute!
tex.run
Start the interpretation.
A run normally boils down to TeX entering the so called main loop. A token is fetched and depending on it current meaning some actions takes place. Sometimes that actions comes immediately, sometimes more scanning is needed. Quite often tokens get pushed back into the input. This all means that the TeX scanner is constantly pushing and popping input states, but in the end after all the action is done returns to the main loop.
Reference:
- Source file of the
LuaTeX
manual: luatex-tex.tex#L1459-L1470
😱 Types incomplete or incorrect? 🙏 Please contribute!
tex.finish
Force the end of an interpretation.
Reference:
- Source file of the
LuaTeX
manual: luatex-tex.tex#L1464
😱 Types incomplete or incorrect? 🙏 Please contribute!
tex.runtoks
@param
force
- force the local main loop
@param grouped
- adds a level of grouping.
😱 Types incomplete or incorrect? 🙏 Please contribute!
Because of the fact that TeX is in a complex dance of expanding, dealing with
fonts, typesetting paragraphs, messing around with boxes, building pages, and so
on, you cannot easily run a nested TeX run (read nested main loop). However,
there is an option to force a local run with runtoks
. The content of the
given token list register gets expanded locally after which we return to where we
triggered this expansion, at the Lua end. Instead a function can get passed
that does some work. You have to make sure that at the end TeX is in a sane
state and this is not always trivial. A more complex mechanism would complicate
TeX itself (and probably also harm performance) so this simple local expansion
loop has to do.
When the tracingnesting
parameter is set to a value larger than 2 some
information is reported about the state of the local loop.
Inside for instance an \edef
the runtoks
function behaves (at
least tries to) like it were an \the
. This prevents unwanted side
effects: normally in such an definition tokens remain tokens and (for instance)
characters don't become nodes.
Example:
\toks0{\setbox0\hbox{one}}
\toks1{\setbox0\hbox{first}}
\directlua {
tex.forcehmode(true)
tex.runtoks(0)
print(tex.getbox(0).width)
tex.runtoks(1)
print(tex.getbox(0).width)
}
Reference:
- Source file of the
LuaTeX
manual: luatex-tex.tex#L1472-L1508 - Corresponding C source code: ltexlib.c#L3464-L3536
tex.runtoks
tex.quittoks
You can quit the local loop with \endlocalcontrol
or from the Lua end
with tex.quittoks
. In that case you end one level up! Of course in the
end that can mean that you arrive at the main level in which case an extra end
will trigger a redundancy warning (not an abort!).
😱 Types incomplete or incorrect? 🙏 Please contribute!
tex.forcehmode
An example of a (possible error triggering) complication is that TeX expects to
be in some state, say horizontal mode, and you have to make sure it is when you
start feeding back something from Lua into TeX. Normally a user will not run
into issues but when you start writing tokens or nodes or have a nested run there
can be situations that you need to run forcehmode
. There is no recipe for
this and intercepting possible cases would weaken LuaTeX's flexibility.
tex.hashtokens
Return a list of names.
This can be useful for debugging, but note that this
also reports control sequences that may be unreachable at this moment due to
local redefinitions: it is strictly a dump of the hash table. You can use token.create
to inspect properties, for instance when the command
key
in a created table equals 123
, you have the cmdname
value undefined_cs
.
Reference:
- Corresponding C source code: ltexlib.c#L2662-L2690
😱 Types incomplete or incorrect? 🙏 Please contribute!
tex.definefont
Associates csname
with the internal font number fontid
. The
definition is global if (and only if) global
is specified and true (the
setting of globaldefs
is not taken into account).
tex.definefont
Associates csname
with the internal font number fontid
. The
definition is global if (and only if) global
is specified and true (the
setting of globaldefs
is not taken into account).
tex.enableprimitives
This function accepts a prefix string and an array of primitive names. For each
combination of “prefix” and “name”, the tex.enableprimitives
first verifies that “name” is an actual primitive
(it must be returned by one of the tex.extraprimitives
calls explained
below, or part of TeX82, or directlua
). If it is not, tex.enableprimitives
does nothing and skips to the next pair.
But if it is, then it will construct a csname variable by concatenating the “prefix” and “name”, unless the “prefix” is already the actual prefix of “name”. In the latter case, it will discard the “prefix”, and just use “name”.
Then it will check for the existence of the constructed csname. If the csname is
currently undefined (note: that is not the same as relax
), it will
globally define the csname to have the meaning: run code belonging to the
primitive “name”. If for some reason the csname is already defined, it
does nothing and tries the next pair.
An example:
will define \LuaTeXformatname
with the same intrinsic meaning as the
documented primitive formatname
, provided that the control sequences \LuaTeXformatname
is currently undefined.
When LuaTeX is run with --ini
only the TeX82 primitives and directlua
are available, so no extra primitives {\bf at all}.
If you want to have all the new functionality available using their default names, as it is now, you will have to add
near the beginning of your format generation file. Or you can choose different prefixes for different subsets, as you see fit.
Calling some form of tex.enableprimitives
is highly important though,
because if you do not, you will end up with a TeX82-lookalike that can run Lua
code but not do much else. The defined csnames are (of course) saved in the
format and will be available at runtime.
*
- Corresponding C source code: ltexlib.c#L2752-L2809
tex.extraprimitives
Return a list of the primitives that originate from the engine(s) given by the requested string value(s).
The possible values and their (current)
return values are given in the following table. In addition the somewhat special
primitives “\tex{ ”}, “\tex {/”} and “-
” are defined.
Note that luatex
does not contain directlua
, as that is
considered to be a core primitive, along with all the TeX82 primitives, so it is
part of the list that is returned from core
.
Running tex.extraprimitives()
will give you the complete list of
primitives -ini
startup. It is exactly equivalent to tex.extraprimitives("etex","luatex")
.
- Corresponding C source code: ltexlib.c#L2710-L2750
tex.primitives
Return a list of all primitives that LuaTeX knows about.
- Corresponding C source code: ltexlib.c#L2691-L2708
tex.badness
@param
total
- scaled values
@param sum
- scaled values
Calculate the badness.
This helper function is useful during linebreak calculations. The function returns the badness for when total total
is supposed to be made from amounts that sum to sum
. The returned number is
a reasonable approximation of 100(total/sum)^3
.
- Corresponding C source code: ltexlib.c#L3069-L3075
- Corresponding C source code: arithmetic.c#L275-L300
tex.resetparagraph
Reset the parameters that TeX normally resets when a new paragraph is seen.
- Corresponding C source code: ltexlib.c#L3054-L3059
😱 Types incomplete or incorrect? 🙏 Please contribute!
tex.linebreak
function tex.linebreak(
listhead: Node {
next = Node?,
prev = Node?,
id = integer,
subtype = integer,
head = Node?,
attr = Node,
},
parameters: LinebreakParameters {
pardir = string,
pretolerance = integer,
tracingparagraphs = integer,
tolerance = integer,
looseness = integer,
hyphenpenalty = integer,
exhyphenpenalty = integer,
pdfadjustspacing = integer,
adjdemerits = integer,
pdfprotrudechars = integer,
linepenalty = integer,
lastlinefit = integer,
...(+13)
}
)
-> Node {
next = Node?,
prev = Node?,
id = integer,
subtype = integer,
head = Node?,
attr = Node,
}
-> table
Note that there is no interface for displaywidowpenalties
, you have to
pass the right choice for widowpenalties
yourself.
It is your own job to make sure that listhead
is a proper paragraph list:
this function does not add any nodes to it. To be exact, if you want to replace
the core line breaking, you may have to do the following (when you are not
actually working in the pre_linebreak_filter
or linebreak_filter
callbacks, or when the original list starting at listhead was generated in
horizontal mode):
-
add an “indent box” and perhaps a
local_par
node at the start (only if you need them) -
replace any found final glue by an infinite penalty (or add such a penalty, if the last node is not a glue)
-
add a glue node for the
parfillskip
after that penalty node -
make sure all the
prev
pointers are OK
The result is a node list, it still needs to be vpacked if you want to assign it
to a vbox
. The returned info
table contains four values that are
all numbers:
name explanation
prevdepth depth of the last line in the broken paragraph prevgraf number of lines in the broken paragraph looseness the actual looseness value in the broken paragraph demerits the total demerits of the chosen solution
Note there are a few things you cannot interface using this function: You cannot
influence font expansion other than via pdfadjustspacing
, because the
settings for that take place elsewhere. The same is true for hbadness and hfuzz
etc. All these are in the hpack
routine, and that fetches its own
variables via globals.
tex.shipout
Ships out box number n
to the output file, and clears the box register.
😱 Types incomplete or incorrect? 🙏 Please contribute!
tex.getpagestate
This helper reports the current page state: empty
, box_there
or
inserts_only
as integer value.
😱 Types incomplete or incorrect? 🙏 Please contribute!
tex.getlocallevel
This integer reports the current level of the local loop. It's only useful for debugging and the (relative state) numbers can change with the implementation.
😱 Types incomplete or incorrect? 🙏 Please contribute!
tex.init_rand
Initialize a new seed.
lua_math_randomseed
is
equivalent to this function.
- Corresponding C source code: ltexlib.c#L3132-L3142
@see tex.lua_math_randomseed
tex.lua_math_randomseed
Initialize a new seed.
init_rand
is
equivalent to this function.
- Corresponding C source code: ltexlib.c#L3132-L3142
@see tex.init_rand
tex.lua_math_random
For practical reasons LuaTeX has its own random number generator. This is the original Lua random function.
- Corresponding C source code: ltexlib.c#L3164-L3192
tex.lua_math_random
For practical reasons LuaTeX has its own random number generator. This is the original Lua random function.
- Corresponding C source code: ltexlib.c#L3164-L3192
tex.normal_rand
no argument is used
- Corresponding C source code: ltexlib.c#L3156-L3160
😱 Types incomplete or incorrect? 🙏 Please contribute!
tex.uniform_rand
takes a number that will get rounded before being used
- Corresponding C source code: ltexlib.c#L3144-L3154
😱 Types incomplete or incorrect? 🙏 Please contribute!
tex.uniformdeviate
@param
n
- a scaled integer
😱 Types incomplete or incorrect? 🙏 Please contribute!
which behaves like the primitive and expects a scaled integer, so
will give a random number between zero and one.
- Corresponding C source code: ltexlib.c#L2051-L2054
tex.set_synctex_mode
- Corresponding C source code: ltexlib.c#L3377-L3382
tex.get_synctex_mode
Return the current mode.
- Corresponding C source code: ltexlib.c#L3383-L3387
tex.set_synctex_tag
Set the current tag (file) value (obeys save stack).
- Corresponding C source code: ltexlib.c#L3389-L3394
tex.get_synctex_tag
Get the currently set value of a tag (file).
- Corresponding C source code: ltexlib.c#L3396-L3400
tex.force_synctex_tag
Overload the tag (file) value (0
resets).
- Corresponding C source code: ltexlib.c#L3402-L3407
tex.set_synctex_line
Set the current line value (obeys save stack).
- Corresponding C source code: ltexlib.c#L3416-L3421
tex.get_synctex_line
Get the currently set value of a line.
- Corresponding C source code: ltexlib.c#L3423-L3427
tex.force_synctex_line
Overload the line value (0
resets)
- Corresponding C source code: L3409-L3414
tex.set_synctex_no_files
Disable synctex file logging.
- Corresponding C source code: ltexlib.c#L3429-L3434
fields
tex.adjdemerits
\adjdemerits
: Penalty for adjacent visually incompatible lines.
Default: 10000
.
Reference:
tex.binoppenalty
\binoppenalty
: Penalty for breaking after a binary operator not
enclosed in a subformula. Default: 700
Reference:
tex.brokenpenalty
\brokenpenalty
: Additional penalty for breaking a page after a
hyphenated line. Default: 100
.
Reference:
tex.catcodetable
Catcode tables are a new feature that allows you to switch to a predefined catcode regime in a single statement.
tex.clubpenalty
\clubpenalty
: Extra penalty for breaking a page after the first
line of a paragraph. In Plain TeX this is 150
. This amount, and the
following penalties, are added to the \interlinepenalty
, and a
penalty of the resulting size is inserted after the \hbox
containing the first line of a paragraph instead of the
\interlinepenalty
.
Reference:
tex.day
\day
: The day of the current job.
Reference:
tex.defaulthyphenchar
\defaulthyphenchar
: Value of \hyphenchar
when a font is loaded.
Default: ‘\-
.
Reference:
tex.defaultskewchar
\defaultskewchar
: Value of \skewchar
when a font is loaded.
Reference:
tex.delimiterfactor
\delimiterfactor
: 1000
times the fraction of a delimited formula
that should be covered by a delimiter. Default: 901
.
Reference:
tex.displaywidowpenalty
\displaywidowpenalty
: Extra penalty for breaking a page before the
last line above a display formula. The default value in Plain TeX
is 50
.
Reference:
tex.doublehyphendemerits
\doublehyphendemerits
: Penalty for consecutive lines ending with a
hyphen. Default: 10000
.
Reference:
tex.endlinechar
\endlinechar
: The character code of the end-of-line character
appended to input lines. IniTEX default: 13
.
tex.errorcontextlines
\errorcontextlines
: (TeX3 only) Number of additional context lines
shown in error messages.
Reference:
tex.escapechar
\escapechar
: Number of the character that is to be used for the
escape character when control sequences are being converted into
character tokens. IniTEX default: 92
(\
).
Reference:
tex.exhyphenpenalty
\exhyphenpenalty
: Penalty for breaking a horizontal line at a
discretionary item in the special case where the prebreak text is
empty. Default: 50
.
Reference:
tex.fam
\fam
: The number of the current font family.
Reference:
tex.finalhyphendemerits
\finalhyphendemerits
: Penalty added when the penultimate line of a
paragraph ends with a hyphen. Default: 5000
.
Reference:
tex.floatingpenalty
\floatingpenalty
: Penalty added when an insertion is split.
Reference:
tex.globaldefs
\globaldefs
: Parameter for overriding \global prefixes.
IniTEX default: 0
.
\globaldefs
is a TeX internal parameter. Normally set to 0
. If
set equal to a positive number, all following definitions and
assignments are treated as if preceded by \global
. If set equal to
a negative number, none of the following definitions or assignments
are global, meaning that an explicit \global
is ignored. This
remains in effect until \globaldefs
is explicitly set to 0
again, or the group containing the \globaldefs
reassignment ends
(assuming it was not made global as well).
Reference:
tex.hangafter
\hangafter
: If positive, this denotes the number of lines before
indenting starts; if negative, the absolute value of this is the
number of indented lines starting with the first line of the
paragraph. Default: 1
.
Reference:
tex.hbadness
\hbadness
: Amount of tolerance before TEX reports an underfull or
overfull horizontal box.
Reference:
tex.holdinginserts
\holdinginserts
(TeX3 only) If this is positive, insertions are
not placed in their boxes at output time.
Reference:
tex.hyphenpenalty
\hyphenpenalty
: Penalty associated with break at a discretionary
item in the general case. Default: 50
.
Reference:
tex.interlinepenalty
\interlinepenalty
: Penalty for breaking a page between lines of a
paragraph. Default: 0
.
Reference:
tex.language
\language
: Choose a set of hyphenation patterns and exceptions.
Reference:
tex.lastlinefit
tex.lefthyphenmin
\lefthyphenmin
(TeX3 only) Minimal number of characters before a
hyphenation. Default: 2
.
Reference:
tex.linepenalty
\linepenalty
: Penalty value associated with each line break.
Default: 10
.
Reference:
tex.localbrokenpenalty
Local broken penalty (from \localbrokenpenalty
)
---@type integer # A readable and writable integer parameter that accepts and returns Lua numbers.
😱 Types incomplete or incorrect? 🙏 Please contribute!
tex.localinterlinepenalty
Local interline penalty (from \localinterlinepenalty
)
tex.looseness
\looseness
: Number of lines by which this paragraph has to be made
longer than it would be ideally.
Reference:
tex.mag
\mag
: 1000
times the magnification of the document.
Reference:
tex.maxdeadcycles
\maxdeadcycles
: The maximum number of times that the output
routine is allowed to be called without a \shipout
occurring.
IniTEX default: 25
.
Reference:
tex.month
\month
: The month of the current job.
Reference:
tex.newlinechar
\newlinechar
: Number of the character that triggers a new line
in \write
statements.
Reference:
tex.outputpenalty
\outputpenalty
: Value of the penalty at the current page break,
or 10000
if the break was not at a penalty.
Reference:
tex.pausing
\pausing
: Specify that TEX should pause after each line that is
read from a file.
Reference:
tex.postdisplaypenalty
\postdisplaypenalty
: Penalty placed in the vertical list below a
display. Default: 0
Reference:
tex.predisplaydirection
😱 Types incomplete or incorrect? 🙏 Please contribute!
tex.predisplaypenalty
\predisplaypenalty
: Penalty placed in the vertical list above a
display. Default: 10000
.
Reference:
tex.pretolerance
\pretolerance
: Tolerance value for a paragraph without
hyphenation. Default: 100
.
Reference:
tex.relpenalty
\relpenalty
: Penalty for breaking after a binary relation not
enclosed in a subformula. Default: 500
Reference:
tex.righthyphenmin
\righthyphenmin
: (TeX3 only) Minimum number of characters after a
hyphenation. Default: 3
.
Reference:
tex.savinghyphcodes
When a \patterns
command is executed and \savinghyphcodes has a
positive value, the current \lccode
values are saved as
hyphenation codes for the current language.
Reference:
- The ε-TEX manual Version 2, February 1998 (updated March 2024), page 11
tex.savingvdiscards
When ε-TEX’s parameter \savingvdiscards
has been assigned a
positive value, these ‘discarded items’ are saved in two lists and
can be recovered by the commands \pagediscards
and \splitdiscards
that act like ‘unvboxing’ hypothetical box registers containing a
vbox with the discarded items.
Reference:
- The ε-TEX manual Version 2, February 1998 (updated March 2024), page 12
tex.showboxbreadth
\showboxbreadth
: Number of successive elements on each level that
are shown when boxes are displayed.
Reference:
tex.showboxdepth
\showboxdepth
: The number of levels of box dump that are shown when
boxes are displayed.
Reference:
tex.time
\time
: Number of minutes after midnight that the current job
started.
Reference:
tex.tolerance
\tolerance
: Tolerance value for lines in a paragraph with
hyphenation. Default: 200
.
Reference:
tex.tracingassigns
When the program is compiled with the code for collecting statistics and \tracingassigns
has a value of 1
or more, all assignments subject to TeX’s grouping mechanism are traced.
Reference:
- The ε-TEX manual Version 2, February 1998 (updated March 2024), page 4
tex.tracingcommands
\tracingcommands
: If this is 1
TEX displays primitive commands
executed; if this is 2
or more the outcome of conditionals is also
recorded.
Reference:
tex.tracinggroups
When \tracinggroups
has a value of 1
or more, the start and end
of each save group is traced, together with the starting line and
grouping level.
Reference:
- The ε-TEX manual Version 2, February 1998 (updated March 2024), page 4
tex.tracingifs
When \tracingifs
has a value of 1
or more, all conditionals
(including \unless
, \or
, \else
, and \fi
) are traced,
together with the starting line and nesting level.
Reference:
- The ε-TEX manual Version 2, February 1998 (updated March 2024), page 4
tex.tracinglostchars
\tracinglostchars
: If this parameter is positive, TeX gives
diagnostic messages whenever a character is accessed that is not
present in a font. Plain default: 1
.
Reference:
tex.tracingmacros
\tracingmacros
: If this is 1
, the log file shows expansion of
macros that are performed and the actual values of the arguments;
if this is 2
or more token parameters such as \output
and
\everypar
are also traced.
Reference:
tex.tracingnesting
When \tracingnesting
has a value of 1
or more, these anomalies
are shown; when \tracingnesting
has a value of 2
or more, the
current context (traceback) is shown as well.
Reference:
- The ε-TEX manual Version 2, February 1998 (updated March 2024), page 5
tex.tracingonline
\tracingonline
: If this parameter is positive, TeX will write
trace information to the terminal in addition to the log file.
Reference:
tex.tracingoutput
\tracingoutput
: If this is positive, the log file shows a dump of
boxes that are shipped to the dvi file.
Reference:
tex.tracingpages
\tracingpages
: If this parameter is positive, TeX generates a
trace of the page breaking algorithm.
Reference:
tex.tracingparagraphs
\tracingparagraphs
: If this parameter is positive, TeX
generates a trace of the line breaking algorithm.
Reference:
tex.tracingrestores
\tracingrestores
: If this parameter is positive, TeX will report
all values that are restored when a group ends.
Reference:
tex.tracingscantokens
When \tracingscantokens
has a value of 1
or more, the opening
and closing of pseudo-files (generated by \scantokens
) is recorded
as for any other file, with ‘␣’ as filename.
Reference:
- The ε-TEX manual Version 2, February 1998 (updated March 2024), page 5
tex.tracingstats
\tracingstats
: If this parameter is 1
, TeX reports at the end
of the job the usage of various internal arrays; if it is 2
, the
memory demands are given whenever a page is shipped out.
Reference:
tex.uchyph
\uchyph
: Positive to allow hyphenation of words starting with a
capital letter. Default: 1
.
Reference:
tex.vbadness
\vbadness
: Amount of tolerance before TeX reports an underfull or
overfull vertical box.
Reference:
tex.widowpenalty
\widowpenalty
: Additional penalty for breaking a page before the
last line of a paragraph. Default: 150
Reference:
tex.year
\year
: The year of the current job.
Reference:
tex.deadcycles
\deadcycles
: Counter that keeps track of how many times the output
routine has been called without a \shipout
taking place.
Reference:
tex.insertpenalties
\insertpenalties
: Total of penalties for split insertions.
Inside the output routine, the number of held-over insertions.
Reference:
tex.parshape
\parshape
: Command for general paragraph shapes.
Reference:
tex.interlinepenalties
An extension to \interlinepenalty
that allows different penalties
to be added after each line. It takes a space separated list of
numbers as value. If n
is positive interlinepenalties
n i_1 ... i_n
specifies the penalty to be used after each of the
lines in a paragraph, with the last value being repeated as often as
needed if the paragraph has more then n
lines.
Reference:
- Stackoverflow: What are penalties and which ones are defined?
- The ε-TEX manual Version 2, February 1998 (updated March 2024), page 10
tex.clubpenalties
An extension to \clubpenalty
that allows different penalties to be
added after each line. It takes a space separated list of numbers as
value. If n
is positive clubpenalties n i_1 ... i_n
specifies the
penalty to be used after each of the lines in a paragraph, with the
last value being repeated as often as needed if the paragraph has
more then n
lines.
Reference:
- Stackoverflow: What are penalties and which ones are defined?
- The ε-TEX manual Version 2, February 1998 (updated March 2024), page 10
tex.widowpenalties
An extension to \widowpenalty
that allows different penalties to be
added after each line. It takes a space separated list of numbers as
value. If n
is positive widowpenalties n i_1 ... i_n
specifies
the penalty to be used after each of the lines in a paragraph, with
the last value being repeated as often as needed if the paragraph
has more then n
lines. Lines are counted backwards from the last
line in this case.
Reference:
- Stackoverflow: What are penalties and which ones are defined?
- The ε-TEX manual Version 2, February 1998 (updated March 2024), page 10
tex.displaywidowpenalties
An extension to \widowpenalty
that allows different penalties to be
added after each line. It takes a space separated list of numbers as
value. If n
is positive displaywidowpenalties n i_1 ... i_n
specifies the penalty to be used after each of the lines in a
paragraph, with the last value being repeated as often as needed if
the paragraph has more then n
lines. Lines counted backwards from
each display math within a paragraph.
Reference:
- Stackoverflow: What are penalties and which ones are defined?
- The ε-TEX manual Version 2, February 1998 (updated March 2024), page 10
tex.prevgraf
\prevgraf
: The number of lines in the paragraph last added to the
vertical list.
Reference:
tex.spacefactor
\spacefactor
: 1000
times the ratio by which the stretch (shrink)
component of the interword glue should be multiplied (divided).
Reference:
tex.boxmaxdepth
\boxmaxdepth
: Maximum allowed depth of boxes. Default: \maxdimen
.
Reference:
tex.delimitershortfall
\delimitershortfall
: Size of the part of a delimited formula that
is allowed to go uncovered by a delimiter. Default: 5pt
.
Reference:
tex.displayindent
\displayindent
: Distance by which the box, in which the display is
centred, is indented owing to hanging indentation.
Reference:
tex.displaywidth
\displaywidth
: Width of the box in which the display is centred.
Reference:
tex.emergencystretch
\emergencystretch
(TeX3 only) Assumed extra stretchability in
lines of a paragraph.
Reference:
tex.hangindent
\hangindent
: If positive, this indicates indentation from the
left margin; if negative, this is the negative of the indentation
from the right margin.
Reference:
tex.hfuzz
\hfuzz
: Excess size that TeX tolerates before it considers a
horizontal box overfull.
Reference:
tex.hoffset
\hoffset
: Distance by which the page is shifted right with respect
to the reference point.
Reference:
tex.hsize
\hsize
: Line width used for typesetting a paragraph.
Default: 6.5in
.
Reference:
tex.lineskiplimit
\lineskiplimit
: Distance to be maintained between the bottom and
top of neighbouring boxes on a vertical list. Default: 0pt
.
Reference:
tex.mathsurround
\mathsurround
: Kern amount placed before and after in-line
formulas.
Reference:
tex.maxdepth
\maxdepth
: Maximum depth of the page box. Default: 4pt
.
Reference:
tex.nulldelimiterspace
\nulldelimiterspace
: Width taken for empty delimiters.
Default: 1.2pt
.
Reference:
tex.overfullrule
\overfullrule
: Width of the rule that is printed to indicate
overfull horizontal boxes.
Reference:
tex.pagebottomoffset
\pagebottomoffset
: To set the bottom margin in non-TLT text.
Reference:
- https://mirrors.aliyun.com/CTAN/systems/doc/aleph/News
tex.pageheight
\pageheight
: The page height of the PDF output (the screen, the
paper, etc.).
Reference:
- pdfTeX-Manual, page 25
tex.pageleftoffset
\pageleftoffset
: To set the left margin in non-TLT text.
Reference:
- https://mirrors.aliyun.com/CTAN/systems/doc/aleph/News
tex.pagerightoffset
\pagerightoffset
: To set the right margin in non-TLT text.
Reference:
- https://mirrors.aliyun.com/CTAN/systems/doc/aleph/News
tex.pagetopoffset
\pagetopoffset
: To set the top margin in non-TLT text.
Reference:
- https://mirrors.aliyun.com/CTAN/systems/doc/aleph/News
tex.pagewidth
\pagewidth
: The page width of the PDF output (the screen,
the paper, etc.).
Reference:
- pdfTeX-Manual, page 25
tex.parindent
\parindent
: Width of the indentation box added in front of a
paragraph. Default: 20pt
.
Reference:
tex.predisplaysize
\predisplaysize
: Effective width of the line preceding the display.
Reference:
tex.scriptspace
\scriptspace
: Extra space after subscripts and superscripts.
Default: 0.5pt
.
Reference:
tex.splitmaxdepth
\splitmaxdepth
: Maximum depth of a box split off by a \vsplit
operation. Default: \maxdimen
.
Reference:
tex.vfuzz
\vfuzz
: Excess size that TeX tolerates before it considers a
vertical box overfull.
Reference:
tex.voffset
\voffset
: Distance by which the page is shifted right/down with
respect to the reference point.
Reference:
tex.vsize
\vsize
: Height of the page box. Default: 8.9in
.
Reference:
tex.prevdepth
\prevdepth
: Depth of the last box added to a vertical list as
it is perceived by TeX.
Reference:
tex.prevgraf
\prevgraf
: The number of lines in the paragraph last added to the
vertical list.
Reference:
tex.spacefactor
\spacefactor
: 1000
times the ratio by which the stretch (shrink)
component of the interword glue should be multiplied (divided).
Reference:
tex.pagedepth
\pagedepth
: Depth of the current page.
Reference:
A read only dimension parameter. The result is always a number in scaled points.
tex.pagefilllstretch
\pagefilllstretch
: Accumulated third-order stretch of the current
page.
Reference:
A read only dimension parameter. The result is always a number in scaled points.
tex.pagefillstretch
\pagefillstretch
: Accumulated second-order stretch of the current
page.
Reference:
A read only dimension parameter. The result is always a number in scaled points.
tex.pagefilstretch
\pagefilstretch
: Accumulated first-order stretch of the current
page.
Reference:
A read only dimension parameter. The result is always a number in scaled points.
tex.pagegoal
\pagegoal
: Goal height of the page box. This starts at \vsize
,
and is diminished by heights of insertion items.
Reference:
A read only dimension parameter. The result is always a number in scaled points.
tex.pageshrink
\pageshrink
: Accumulated shrink of the current page.
Reference:
* TeX by Topic, page 226
A read only dimension parameter. The result is always a number in scaled points.
tex.pagestretch
\pagestretch
: Accumulated zeroth-order stretch of the current page.
Reference:
A read only dimension parameter. The result is always a number in scaled points.
tex.pagetotal
\pagetotal
: Accumulated natural height of the current page.
Reference:
A read only dimension parameter. The result is always a number in scaled points.
tex.bodydir
The direction for vboxes, including the main body of text.
Default: TLT
.
Reference:
tex.mathdir
The direction for mathematics. Default: TLT
.
Reference:
tex.pagedir
The direction for pages (\shipout
). Default: TLT
.
Reference:
tex.pardir
The direction for paragraphs. Default: TLT
.
Reference:
tex.textdir
The direction for text and hboxes. Default: TLT
.
Reference:
tex.abovedisplayshortskip
tex.abovedisplayshortskip : GlueSpecNode {
width: integer,
stretch: integer,
stretch_order: integer,
shrink: integer,
shrink_order: integer,
}
\abovedisplayshortskip
: Glue above a display if the line preceding
the display was short. Default: 0pt plus 3pt
.
Reference:
tex.abovedisplayskip
tex.abovedisplayskip : GlueSpecNode {
width: integer,
stretch: integer,
stretch_order: integer,
shrink: integer,
shrink_order: integer,
}
\abovedisplayskip
: Glue above a display.
Default: 12pt plus 3pt minus 9pt
.
Reference:
tex.baselineskip
tex.baselineskip : GlueSpecNode {
width: integer,
stretch: integer,
stretch_order: integer,
shrink: integer,
shrink_order: integer,
}
\baselineskip
: The ‘ideal’ baseline distance between neighbouring
boxes on a vertical list. Default: 12pt
.
Reference:
tex.belowdisplayshortskip
tex.belowdisplayshortskip : GlueSpecNode {
width: integer,
stretch: integer,
stretch_order: integer,
shrink: integer,
shrink_order: integer,
}
\belowdisplayshortskip
: Glue above/below a display if the line
preceding the display was short. Default: 0pt plus 3pt
and
7pt plus 3pt minus 4pt
respectively.
Reference:
tex.belowdisplayskip
tex.belowdisplayskip : GlueSpecNode {
width: integer,
stretch: integer,
stretch_order: integer,
shrink: integer,
shrink_order: integer,
}
\belowdisplayskip
: Glue below a display.
Default: 12pt plus 3pt minus 9pt
.
Reference:
tex.leftskip
tex.leftskip : GlueSpecNode {
width: integer,
stretch: integer,
stretch_order: integer,
shrink: integer,
shrink_order: integer,
}
\leftskip
: Glue that is placed to the left of all lines of a
paragraph.
Reference:
tex.lineskip
tex.lineskip : GlueSpecNode {
width: integer,
stretch: integer,
stretch_order: integer,
shrink: integer,
shrink_order: integer,
}
\lineskip
: Glue added if the distance between bottom and top of
neighbouring boxes is less than \lineskiplimit
. Default: 1pt
.
Reference:
tex.parfillskip
tex.parfillskip : GlueSpecNode {
width: integer,
stretch: integer,
stretch_order: integer,
shrink: integer,
shrink_order: integer,
}
\parfillskip
: Glue that is placed between the last element of the
paragraph and the line end. Default: 0pt plus 1fil
.
Reference:
tex.parskip
tex.parskip : GlueSpecNode {
width: integer,
stretch: integer,
stretch_order: integer,
shrink: integer,
shrink_order: integer,
}
\parskip
: Amount of glue added to the surrounding vertical list
when a paragraph starts. Default: 0pt plus 1pt
.
Reference:
tex.rightskip
tex.rightskip : GlueSpecNode {
width: integer,
stretch: integer,
stretch_order: integer,
shrink: integer,
shrink_order: integer,
}
\rightskip
: Glue that is placed to the right of all lines of a
paragraph.
Reference:
tex.spaceskip
tex.spaceskip : GlueSpecNode {
width: integer,
stretch: integer,
stretch_order: integer,
shrink: integer,
shrink_order: integer,
}
\spaceskip
: Interword glue if non-zero.
Reference:
tex.splittopskip
tex.splittopskip : GlueSpecNode {
width: integer,
stretch: integer,
stretch_order: integer,
shrink: integer,
shrink_order: integer,
}
\splittopskip
: Minimum distance between the top of what remains
after a \vsplit
operation, and the first item in that box.
Default: 10pt
.
Reference:
tex.tabskip
tex.tabskip : GlueSpecNode {
width: integer,
stretch: integer,
stretch_order: integer,
shrink: integer,
shrink_order: integer,
}
\tabskip
: Amount of glue in between columns (rows) of an
\halign
(\valign
).
Reference:
tex.topskip
tex.topskip : GlueSpecNode {
width: integer,
stretch: integer,
stretch_order: integer,
shrink: integer,
shrink_order: integer,
}
\topskip
: Minimum distance between the top of the page box and the
baseline of the first box on the page. Default: 10pt
.
Reference:
tex.xspaceskip
tex.xspaceskip : GlueSpecNode {
width: integer,
stretch: integer,
stretch_order: integer,
shrink: integer,
shrink_order: integer,
}
\xspaceskip
: Interword glue if non-zero and \spacefactor
≥ 2000.
Reference:
tex.medmuskip
\medmuskip
: Medium amount of mu (math units) glue.
Reference:
tex.thickmuskip
\thickmuskip
: Large amount of mu (math units) glue.
Reference:
tex.thinmuskip
\thinmuskip
: Small amount of mu (math units) glue.
Reference:
tex.errhelp
\errhelp
: Tokens that will be displayed if the user asks further
help after an \errmessage
.
A tokenlist
parameters that accepts and returns a Lua string.
The Lua string is
converted to and from a token list using \the
\toks
style expansion:
all category codes are either space (10) or other (12).
Reference:
tex.everycr
\everycr
: Token list inserted after every \cr
or
non-redundant \crcr
.
A tokenlist
parameters that accepts and returns a Lua string.
The Lua string is
converted to and from a token list using \the
\toks
style expansion:
all category codes are either space (10) or other (12).
Reference:
* TeX by Topic, page 215
tex.everydisplay
\everydisplay
: Token list inserted at the start of a display.
A tokenlist
parameters that accepts and returns a Lua string.
The Lua string is
converted to and from a token list using \the
\toks
style expansion:
all category codes are either space (10) or other (12).
Reference:
* TeX by Topic, page 210
tex.everyeof
\everyeof
: The content of this token list is injected when a
file ends.
A tokenlist
parameters that accepts and returns a Lua string.
The Lua string is
converted to and from a token list using \the
\toks
style expansion:
all category codes are either space (10) or other (12).
Reference:
- LuaMetaTeX-Manual, page 115
tex.everyhbox
\everyhbox
: Token list inserted at the start of a horizontal box.
A tokenlist
parameters that accepts and returns a Lua string.
The Lua string is
converted to and from a token list using \the
\toks
style expansion:
all category codes are either space (10) or other (12).
Reference:
tex.everyjob
\everyjob
: Token list that is inserted at the start of each new
job.
A tokenlist
parameters that accepts and returns a Lua string.
The Lua string is
converted to and from a token list using \the
\toks
style expansion:
all category codes are either space (10) or other (12).
Reference:
tex.everymath
\everymath
: Token list inserted at the start of non-display math.
A tokenlist
parameters that accepts and returns a Lua string.
The Lua string is
converted to and from a token list using \the
\toks
style expansion:
all category codes are either space (10) or other (12).
Reference:
tex.everypar
\everypar
: Token list inserted in front of paragraph text.
A tokenlist
parameters that accepts and returns a Lua string.
The Lua string is
converted to and from a token list using \the
\toks
style expansion:
all category codes are either space (10) or other (12).
Reference:
tex.everyvbox
\everyvbox
: Token list inserted at the start of a vertical box.
A tokenlist
parameters that accepts and returns a Lua string.
The Lua string is
converted to and from a token list using \the
\toks
style expansion:
all category codes are either space (10) or other (12).
Reference:
tex.output
\output
: Token list with instructions for shipping out pages.
A tokenlist
parameters that accepts and returns a Lua string.
The Lua string is
converted to and from a token list using \the
\toks
style expansion:
all category codes are either space (10) or other (12).
Reference:
tex.eTeXVersion
tex.eTeXrevision
tex.formatname
tex.jobname
tex.luatexbanner
tex.luatexrevision
tex.lastpenalty
All “last item” commands are read-only and return a number.
tex.lastkern
All “last item” commands are read-only and return a number.
tex.lastskip
All “last item” commands are read-only and return a number.
tex.lastnodetype
All “last item” commands are read-only and return a number.
tex.inputlineno
All “last item” commands are read-only and return a number.
tex.lastxpos
All “last item” commands are read-only and return a number.
tex.lastypos
All “last item” commands are read-only and return a number.
tex.randomseed
All “last item” commands are read-only and return a number.
tex.luatexversion
All “last item” commands are read-only and return a number.
tex.eTeXminorversion
All “last item” commands are read-only and return a number.
tex.eTeXversion
All “last item” commands are read-only and return a number.
tex.currentgrouplevel
All “last item” commands are read-only and return a number.
tex.currentgrouptype
All “last item” commands are read-only and return a number.
tex.currentiflevel
All “last item” commands are read-only and return a number.
tex.currentiftype
All “last item” commands are read-only and return a number.
tex.currentifbranch
All “last item” commands are read-only and return a number.
tex.attribute
The attribute registers accept and return Lua numbers.
see LuaTeX
manual: 10.3.5 Accessing registers: set*
, get*
and is*
Reference:
- Corresponding C source code: ltexlib.c#L3698
tex.count
The count registers accept and return Lua numbers.
see LuaTeX
manual: 10.3.5 Accessing registers: set*
, get*
and is*
Reference:
- Corresponding C source code: ltexlib.c#L3704
tex.dimen
The dimension registers accept Lua numbers (in scaled points) or
strings (with an included absolute dimension; em
and ex
and px
are forbidden). The result is always a number in scaled
points.
see LuaTeX
manual: 10.3.5 Accessing registers: set*
, get*
and is*
Reference:
- Corresponding C source code: ltexlib.c#L3703
tex.glue
The glue registers are just skip registers but instead of userdata are verbose.
see LuaTeX
manual: 10.3.5 Accessing registers: set*
, get*
and is*
Reference:
- Corresponding C source code: ltexlib.c#L3700
tex.muglue
see LuaTeX
manual: 10.3.5 Accessing registers: set*
, get*
and is*
Reference:
- Corresponding C source code: ltexlib.c#L3702
tex.muskip
see LuaTeX
manual: 10.3.5 Accessing registers: set*
, get*
and is*
Reference:
- Corresponding C source code: ltexlib.c#L3701
tex.skip
The skip registers accept and return glue_spec
userdata node
objects.
see LuaTeX
manual: 10.3.5 Accessing registers: set*
, get*
and is*
Reference:
- Corresponding C source code: ltexlib.c#L3699
tex.toks
The token registers accept and return Lua strings. Lua strings are
converted to and from token lists using \the
\toks
style
expansion: all category codes are either space (10) or other (12).
see LuaTeX
manual: 10.3.5 Accessing registers: set*
, get*
and is*
Reference:
- Corresponding C source code: ltexlib.c#L3705
tex.lccode
The TeX's character code table lccode
(lower case code) can be accessed and written to using
a virtual subtable of the tex
table.
for i = 0, 1024 do
-- Exclude C0 and C1 control codes
if i > 31 and not (i >= 127 and i <= 159) then
print(i, utf8.char(i), tex.lccode[i], utf8.char(tex.lccode[i]))
end
end
Output:
...
65 A 97 a
66 B 98 b
67 C 99 c
...
90 Z 122 z
...
97 a 97 a
98 b 98 b
99 c 99 c
...
122 z 122 z
...
Reference:
- Corresponding C source code: ltexlib.c#L3708
- Corresponding plain TeX control sequence: \lccode
tex.uccode
TeX's character code table uccode
(upper case code) can be accessed and written to using
a virtual subtable of the tex
table.
for i = 0, 1024 do
-- Exclude C0 and C1 control codes
if i > 31 and not (i >= 127 and i <= 159) then
print(i, utf8.char(i), tex.uccode[i], utf8.char(tex.uccode[i]))
end
end
Output:
...
65 A 65 A
66 B 66 B
67 C 67 C
...
90 Z 90 Z
...
97 a 65 A
98 b 66 B
99 c 67 C
...
122 z 90 Z
...
Reference:
- Corresponding C source code: ltexlib.c#L3709
- Corresponding plain TeX control sequence: \uccode
tex.sfcode
Each character in a font has a space factor code that is an integer
between 0
and 32767
. The code is used to adjust the space factor
in a horizontal list. The uppercase letters A-Z
have space factor
code 999
. Most other characters have code 1000
[Donald E. Knuth, The TeXbook, page 76]. However,
Plain TeX makes )',
'', and ]' have space factor code
0.
Also, the
\frenchspacingand
\nonfrenchspacingmodes in Plain
TeX work by changing the
\sfcodefor:
.,
?,
!,
:,
;,
and
,` [Donald E. Knuth, The TeXbook, 351].
TeX's character code table sfcode
(space factor code) can be
accessed and written to using a virtual subtable of the tex
table.
for i = 0, 1024 do
-- Exclude C0 and C1 control codes
if i > 31 and not (i >= 127 and i <= 159) then
print(i, utf8.char(i), tex.sfcode[i])
end
end
Output:
32 1000
33 ! 3000
34 " 1000
35 # 1000
36 $ 1000
37 % 1000
38 & 1000
39 ' 0
40 ( 1000
41 ) 0
42 * 1000
43 + 1000
44 , 1250
45 - 1000
46 . 3000
47 / 1000
48 0 1000
49 1 1000
50 2 1000
51 3 1000
52 4 1000
53 5 1000
54 6 1000
55 7 1000
56 8 1000
57 9 1000
58 : 2000
59 ; 1500
60 < 1000
61 = 1000
62 > 1000
63 ? 3000
64 @ 1000
65 A 999
...
Reference:
- Corresponding C source code: ltexlib.c#L3707
- Corresponding plain TeX control sequence: \sfcode
tex.catcode
A virtual subtable of the tex
table called catcode
(category code) can be used to access and write to TeX's character code table.
The category codes are indexed by the character code.
Output:
33 ! 12
34 " 12
35 # 6
36 $ 3
37 % 14
38 & 4
39 ' 12
40 ( 12
41 ) 12
42 * 12
43 + 12
44 , 12
45 - 12
46 . 12
47 / 12
48 0 12
49 1 12
50 2 12
51 3 12
52 4 12
53 5 12
54 6 12
55 7 12
56 8 12
57 9 12
58 : 12
59 ; 12
60 < 12
61 = 12
62 > 12
63 ? 12
64 @ 12
65 A 11
66 B 11
67 C 11
68 D 11
69 E 11
70 F 11
71 G 11
72 H 11
73 I 11
74 J 11
75 K 11
76 L 11
77 M 11
78 N 11
79 O 11
80 P 11
81 Q 11
82 R 11
83 S 11
84 T 11
85 U 11
86 V 11
87 W 11
88 X 11
89 Y 11
90 Z 11
91 [ 12
92 \ 0
93 ] 12
94 ^ 7
95 _ 8
96 ` 12
97 a 11
98 b 11
99 c 11
100 d 11
101 e 11
102 f 11
103 g 11
104 h 11
105 i 11
106 j 11
107 k 11
108 l 11
109 m 11
110 n 11
111 o 11
112 p 11
113 q 11
114 r 11
115 s 11
116 t 11
117 u 11
118 v 11
119 w 11
120 x 11
121 y 11
122 z 11
123 { 1
124 | 12
125 } 2
126 ~ 13
Category codes:
0
: Escape character, normally\
1
: Begin grouping, normally{
2
: End grouping, normally}
3
: Math shift, normally$
4
: Alignment tab, normally&
5
: End of line, normally<return>
6
: Parameter, normally#
7
: Superscript, normally^
8
: Subscript, normally_
9
: Ignored character, normally<null>
10
: Space, normally<space>
and<tab>
11
: Letter, normally only contains the lettersa,...,z
andA,...,Z
. These characters can be used in command names12
: Other, normally everything else not listed in the other categories13
: Active character, for example~
14
: Comment character, normally%
-
15
: Invalid character, normally<delete>
-
Corresponding C source code: ltexlib.c#L3710
tex.mathcode
The TeX's character code table mathcode
can be accessed and written to using
a virtual subtable of the tex
table.
for i = 1, 128 do
local mathcode = tex.mathcode[i]
print(i, utf8.char(i), mathcode[1], mathcode[2], mathcode[3])
end
Output:
1 3 2 35
2 0 1 11
3 0 1 12
4 2 2 94
5 0 2 58
6 3 2 50
7 0 1 25
8 0 1 21
9 0 1 13
10 0 1 14
11 3 2 34
12 2 2 6
1 2 2 8
14 0 2 49
15 0 1 64
16 3 2 26
17 3 2 27
18 2 2 92
19 2 2 91
20 0 2 56
21 0 2 57
22 2 2 10
23 3 2 36
24 3 2 32
25 3 2 33
26 � 8 0 0
27 2 5
28 3 2 20
29 3 2 21
30 3 2 17
31 2 2 95
32 8 0 0
33 ! 5 0 33
34 " 0 0 34
35 # 0 0 35
36 $ 0 0 36
37 % 0 0 37
38 & 0 0 38
39 ' 8 0 0
40 ( 4 0 40
41 ) 5 0 41
42 * 2 2 3
43 + 2 0 43
44 , 6 1 59
45 - 2 2 0
46 . 0 1 58
47 / 0 1 61
48 0 7 0 48
49 1 7 0 49
50 2 7 0 50
51 3 7 0 51
52 4 7 0 52
53 5 7 0 53
54 6 7 0 54
55 7 7 0 55
56 8 7 0 56
57 9 7 0 57
58 : 3 0 58
59 ; 6 0 59
60 < 3 1 60
61 = 3 0 61
62 > 3 1 62
63 ? 5 0 63
64 @ 0 0 64
65 A 7 1 65
66 B 7 1 66
67 C 7 1 67
68 D 7 1 68
69 E 7 1 69
70 F 7 1 70
71 G 7 1 71
72 H 7 1 72
73 I 7 1 73
74 J 7 1 74
75 K 7 1 75
76 L 7 1 76
77 M 7 1 77
78 N 7 1 78
79 O 7 1 79
80 P 7 1 80
81 Q 7 1 81
82 R 7 1 82
83 S 7 1 83
84 T 7 1 84
85 U 7 1 85
86 V 7 1 86
87 W 7 1 87
88 X 7 1 88
89 Y 7 1 89
90 Z 7 1 90
91 [ 4 0 91
92 \ 0 2 110
93 ] 5 0 93
94 ^ 0 0 94
95 _ 8 0 0
96 ` 0 0 96
97 a 7 1 97
98 b 7 1 98
99 c 7 1 99
100 d 7 1 100
101 e 7 1 101
102 f 7 1 102
103 g 7 1 103
104 h 7 1 104
105 i 7 1 105
106 j 7 1 106
107 k 7 1 107
108 l 7 1 108
109 m 7 1 109
110 n 7 1 110
111 o 7 1 111
112 p 7 1 112
113 q 7 1 113
114 r 7 1 114
115 s 7 1 115
116 t 7 1 116
117 u 7 1 117
118 v 7 1 118
119 w 7 1 119
120 x 7 1 120
121 y 7 1 121
122 z 7 1 122
123 { 4 2 102
124 | 0 2 106
125 } 5 2 103
126 ~ 0 0 126
127 1 2 115
128 0 0 128
In math mode, the math atoms require more structure. Each symbol
originates from a different font and receives different spacing
based on its class (operator, binary infix, relation, etc.).
Following the typical style of the 1970s, these properties are
compactly packed into bit fields within a single integer called a
mathcode. The mathcode is usually expressed in hexadecimal so
that the fields can easily be pulled apart. The mathcode of +
in
plain TeX is set as:
This means it is class 2 (binary infix) and fam0 (the Roman font).
The character hex is 2B
, which is the decimal 43
, the character
code for +
in the Roman font encoding.
The mathcode
section in the
plain.tex
format file:
\mathcode`\^^?="1273 % \smallint
% INITEX sets up \mathcode x=x, for x=0..255, except that
% \mathcode x=x+"7100, for x = `A to `Z and `a to `z;
% \mathcode x=x+"7000, for x = `0 to `9.
% The following changes define internal codes as recommended
% in Appendix C of The TeXbook:
\mathcode`\^^@="2201 % \cdot
\mathcode`\^^A="3223 % \downarrow
\mathcode`\^^B="010B % \alpha
\mathcode`\^^C="010C % \beta
\mathcode`\^^D="225E % \land
\mathcode`\^^E="023A % \lnot
\mathcode`\^^F="3232 % \in
\mathcode`\^^G="0119 % \pi
\mathcode`\^^H="0115 % \lambda
\mathcode`\^^I="010D % \gamma
\mathcode`\^^J="010E % \delta
\mathcode`\^^K="3222 % \uparrow
\mathcode`\^^L="2206 % \pm
\mathcode`\^^M="2208 % \oplus
\mathcode`\^^N="0231 % \infty
\mathcode`\^^O="0140 % \partial
\mathcode`\^^P="321A % \subset
\mathcode`\^^Q="321B % \supset
\mathcode`\^^R="225C % \cap
\mathcode`\^^S="225B % \cup
\mathcode`\^^T="0238 % \forall
\mathcode`\^^U="0239 % \exists
\mathcode`\^^V="220A % \otimes
\mathcode`\^^W="3224 % \leftrightarrow
\mathcode`\^^X="3220 % \leftarrow
\mathcode`\^^Y="3221 % \rightarrow
\mathcode`\^^Z="8000 % \ne
\mathcode`\^^[="2205 % \diamond
\mathcode`\^^\="3214 % \le
\mathcode`\^^]="3215 % \ge
\mathcode`\^^^="3211 % \equiv
\mathcode`\^^_="225F % \lor
\mathcode`\ ="8000 % \space
\mathcode`\!="5021
\mathcode`\'="8000 % ^\prime
\mathcode`\(="4028
\mathcode`\)="5029
\mathcode`\*="2203 % \ast
\mathcode`\+="202B
\mathcode`\,="613B
\mathcode`\-="2200
\mathcode`\.="013A
\mathcode`\/="013D
\mathcode`\:="303A
\mathcode`\;="603B
\mathcode`\<="313C
\mathcode`\=="303D
\mathcode`\>="313E
\mathcode`\?="503F
\mathcode`\[="405B
\mathcode`\\="026E % \backslash
\mathcode`\]="505D
\mathcode`\_="8000 % \_
\mathcode`\{="4266
\mathcode`\|="026A
\mathcode`\}="5267
Reference:
- Corresponding C source code: ltexlib.c#L3711
- Corresponding plain TeX control sequence: \mathcode
- tex.stackexchange.com
tex.delcode
for i=1,128 do
local delcode = tex.delcode[i]
print(i, utf8.char(i), delcode[1], delcode[2], delcode[3], delcode[4])
end
Output:
1 -1 0 0 0
...
40 ( 0 40 3 0
41 ) 0 41 3 1
...
47 / 0 47 3 14
...
60 < 2 104 3 10
61 = -1 0 0 0
62 > 2 105 3 11
...
91 [ 0 91 3 2
92 \ 2 110 3 15
93 ] 0 93 3 3
...
124 | 2 106 3 12
...
The delcode
section in the
plain.tex
format file:
% Finally, INITEX sets all \delcode values to -1, except \delcode`.=0
\delcode`\(="028300
\delcode`\)="029301
\delcode`\[="05B302
\delcode`\]="05D303
\delcode`\<="26830A
\delcode`\>="26930B
\delcode`\/="02F30E
\delcode`\|="26A30C
\delcode`\\="26E30F
% N.B. { and } should NOT get delcodes; otherwise parameter grouping fails!
Reference:
- Corresponding C source code: ltexlib.c#L3712
- Corresponding plain TeX control sequence: \delcode
tex.box
Reference:
- Corresponding C source code: ltexlib.c#L3706
- Corresponding plain TeX control sequence: \box
tex.lists
The virtual table tex.lists
contains the set of internal registers that
keep track of building page lists.
Reference:
- Corresponding C source code: ltexlib.c#L3713
😱 Types incomplete or incorrect? 🙏 Please contribute!
tex.nest
The virtual table nest
contains the currently active semantic nesting
state. It has two main parts: a zero-based array of userdata for the semantic
nest itself, and the numerical value ptr
, which gives the highest
available index. Neither the array items in nest[]
nor ptr
can be
assigned to (as this would confuse the typesetting engine beyond repair), but you
can assign to the individual values inside the array items, e.g. tex.nest[tex.nest.ptr].prevdepth
.
tex.nest[tex.nest.ptr]
is the current nest state, nest[0]
the
outermost (main vertical list) level.
Reference:
- Corresponding C source code: ltexlib.c#L3714