Skip to content

Parameters

yex.control.Parameter(value=None, **kwargs) #

Bases: yex.control.Unexpandable

Parameters are a specialised form of control, with a value and a type. For example, \hsize holds the width of the current line, which is a dimen.

Like all controls, parameters can be called. This is equivalent to assigning them a value. For example,

    \hsize 3pt
assigns the value 3pt to \hsize.

Each document creates at most one instance of each parameter class.

There is a subclass of Parameter for each type:

The parameter classes themselves are subclasses of these.

TeΧbook: pp269-271

Attributes:

Name Type Description
our_type yex.control.register.Type

the class we represent, in the form we use to store it. If this is a tuple, we can contain multiple types; the first one listed will be used to initialise a new control.

initial_value yex.control.table.Any

the value this parameter has on startup

do_not_initialise bool

if True, _value will not be initialised. If False (the default), _value will be initialised with a new instance of our_type (or our_type[0] if our_type is a tuple).

is_outer bool

not applicable, and always False

is_queryable bool

not applicable, and always True

List of all current parameter subclasses:#

Symbol Type Class Description
\abovedisplayshortskip Glue Abovedisplayshortskip
\abovedisplayskip Glue Abovedisplayskip
\adjdemerits Number Adjdemerits
\badness Number Badness How badly the most recent line of text was set.
\baselineskip Glue Baselineskip
\belowdisplayshortskip Glue Belowdisplayshortskip
\belowdisplayskip Glue Belowdisplayskip
\binoppenalty Number Binoppenalty
\boxmaxdepth Dimen Boxmaxdepth
\brokenpenalty Number Brokenpenalty
\clubpenalty Number Clubpenalty
\day Number Day
\deadcycles Number Deadcycles
\defaulthyphenchar Number Defaulthyphenchar
\defaultskewchar Number Defaultskewchar
\delimiterfactor Number Delimiterfactor
\delimitershortfall Dimen Delimitershortfall
\displayindent Dimen Displayindent
\displaywidowpenalty Number Displaywidowpenalty
\displaywidth Dimen Displaywidth
\documentfield DocumentField A reference to a field in a Document instance.
\doublehyphendemerits Number Doublehyphendemerits
\emergencystretch Dimen Emergencystretch
\endlinechar Number Endlinechar
\errhelp Tokenlist Errhelp
\errorcontextlines Number Errorcontextlines
\escapechar Number Escapechar The symbol we print before control names.
\everycr Tokenlist Everycr
\everydisplay Tokenlist Everydisplay
\everyhbox Tokenlist Everyhbox
\everyjob Tokenlist Everyjob
\everymath Tokenlist Everymath
\everypar Tokenlist Everypar
\everyvbox Tokenlist Everyvbox
\exhyphenpenalty Number Exhyphenpenalty
\fam Number Fam
\finalhyphendemerits Number Finalhyphendemerits
\floatingpenalty Number Floatingpenalty
\globaldefs Number Globaldefs Whether definitions should have global effect.
\hangafter Number Hangafter
\hangindent Dimen Hangindent
\hbadness Number Hbadness
\hfuzz Dimen Hfuzz
\hoffset Dimen Hoffset
\holdinginserts Number Holdinginserts
\hsize Dimen Hsize The width of the current line.
\hyphenpenalty Number Hyphenpenalty
\inputlineno Number Inputlineno The current line in the input file.
\insertpenalties Number Insertpenalties
\interlinepenalty Number Interlinepenalty
\jobname Tokenlist Jobname
\language Number Language
\lastkern Dimen Lastkern
\lastpenalty Number Lastpenalty
\lastskip Glue Lastskip
\lefthyphenmin Number Lefthyphenmin
\leftskip Glue Leftskip
\linepenalty Number Linepenalty
\lineskip Glue Lineskip
\lineskiplimit Dimen Lineskiplimit
\looseness Number Looseness
\mag Number Mag
\mathsurround Dimen Mathsurround
\maxdeadcycles Number Maxdeadcycles
\maxdepth Dimen Maxdepth
\medmuskip Muglue Glue Medmuskip
\month Number Month
\newlinechar Number Newlinechar
\nulldelimiterspace Dimen Nulldelimiterspace
\output Tokenlist Output Runs every time we have enough text typeset to produce a new page.
\outputpenalty Number Outputpenalty
\overfullrule Dimen Overfullrule
\pagedepth Dimen Pagedepth
\pagefilllstretch Dimen Pagefilllstretch
\pagefillstretch Dimen Pagefillstretch
\pagefilstretch Dimen Pagefilstretch
\pagegoal Dimen Pagegoal
\pageshrink Dimen Pageshrink
\pagestretch Dimen Pagestretch
\pagetotal Dimen Pagetotal
\parfillskip Glue Parfillskip The amount of space to add at the end of a paragraph.
\parindent Dimen Parindent The width of the indentation for new paragraphs.
\parskip Glue Parskip
\pausing Number Pausing
\postdisplaypenalty Number Postdisplaypenalty
\predisplaypenalty Number Predisplaypenalty
\predisplaysize Dimen Predisplaysize
\pretolerance Number Pretolerance How loose lines can get before we try hyphenation.
\prevdepth Dimen Prevdepth The depth of the most recent box, or -1000 for none.
\prevgraf Number Prevgraf
\relpenalty Number Relpenalty
\righthyphenmin Number Righthyphenmin
\rightskip Glue Rightskip
\scriptspace Dimen Scriptspace
\showboxbreadth Number Showboxbreadth
\showboxdepth Number Showboxdepth
\spacefactor Number Spacefactor
\spaceskip Glue Spaceskip
\splitmaxdepth Dimen Splitmaxdepth
\splittopskip Glue Splittopskip
\tabskip Glue Tabskip
\thickmuskip Muglue Glue Thickmuskip
\thinmuskip Muglue Glue Thinmuskip
\time Number Time
\tolerance Number Tolerance
\topskip Glue Topskip
\tracingcommands Number Tracingcommands Commands before they are executed
\tracinglostchars Number Tracinglostchars Characters not in the font
\tracingmacros Number Tracingmacros Macros, as they are expanded
\tracingonline Number Tracingonline If positive, tracing goes to stdout; otherwise they go to the logfile.
\tracingoutput Number Tracingoutput Boxes that are shipped out
\tracingpages Number Tracingpages Page-break calculations
\tracingparagraphs Number Tracingparagraphs Line-break calculations
\tracingrestores Number Tracingrestores Deassignments when groups end
\tracingstats Number Tracingstats Statistics about memory usage
\uchyph Number Uchyph
\vbadness Number Vbadness
\vfuzz Dimen Vfuzz
\voffset Dimen Voffset
\vsize Dimen Vsize The height of a page.
\widowpenalty Number Widowpenalty
\xspaceskip Glue Xspaceskip
\year Number Year
doc['_contents'] X__contents
doc['_created'] X__created Timestamp of the document's creation. Same as created_at.timestamp().
doc['_font'] X__font
doc['_fonts'] X__fonts
doc['_mode'] X__mode
doc['_modelist'] X__modelist
doc['_output'] X__output
doc['_parshape'] X__parshape
Source code in yex/control/parameter.py
75
76
77
78
79
80
81
82
83
84
85
86
87
88
def __init__(self, value=None, **kwargs):

    super().__init__(**kwargs)

    if value is not None:
        self._value = value
    elif self.do_not_initialise:
        pass
    elif isinstance(self.initial_value, self.our_type):
        self._value = self.initial_value
    elif isinstance(self.our_type, tuple):
        self._value = self.our_type[0](self.initial_value)
    else:
        self._value = self.our_type(self.initial_value)

get_the(parser) #

Finds a representation of this parameter's value, as used by the control \the.

Returns:

Type Description
str

a string representing the value.

Source code in yex/control/parameter.py
123
124
125
126
127
128
129
130
131
132
133
134
def get_the(self, parser: 'yex.parse.Parser') -> str:
    r"""
    Finds a representation of this parameter's value, as used by
    the control \the.

    Returns:
        a string representing the value.
    """
    if isinstance(self.value, str):
        return self.value
    else:
        return repr(self.value)

set_from(parser) #

Sets the value from a token stream.

Source code in yex/control/parameter.py
113
114
115
116
117
118
119
120
121
def set_from(self, parser: 'yex.parse.Parser'):
    """
    Sets the value from a token stream.
    """
    parser.eat_optional_char('=')
    v = self.our_type.from_parser(parser)
    logger.debug("Setting %s=%s",
            self, v)
    self.value = v