<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.luatex.org/index.php?action=history&amp;feed=atom&amp;title=Attributes</id>
	<title>Attributes - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.luatex.org/index.php?action=history&amp;feed=atom&amp;title=Attributes"/>
	<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=Attributes&amp;action=history"/>
	<updated>2026-04-14T23:00:15Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=Attributes&amp;diff=96&amp;oldid=prev</id>
		<title>Paul: Added link to example in the post_linebreak_filter article.</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=Attributes&amp;diff=96&amp;oldid=prev"/>
		<updated>2011-05-11T10:27:14Z</updated>

		<summary type="html">&lt;p&gt;Added link to example in the post_linebreak_filter article.&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 10:27, 11 May 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l120&quot; &gt;Line 120:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 120:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;= Examples =&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;The idea behind attributes is to mark material at a given time so as to spot it at a later stage of processing. The example in the page on the [[Post linebreak filter#Margin notes|&amp;lt;tt&amp;gt;post_linebreak_filter&amp;lt;/tt&amp;gt;]] [[Callbacks|callback]] shows how attributes can be put to use for margin notes: the text to which a note is added is marked with an attribute, and later, when the paragraph has been built, the note is appended to the line containing that text, identified by its having a given value for the attribute.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Paul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=Attributes&amp;diff=93&amp;oldid=prev</id>
		<title>Paul: Small correction.</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=Attributes&amp;diff=93&amp;oldid=prev"/>
		<updated>2011-05-10T15:29:46Z</updated>

		<summary type="html">&lt;p&gt;Small correction.&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 15:29, 10 May 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l12&quot; &gt;Line 12:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 12:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;It is wise to have a \newattribute command, like \newcount (from plain TeX, used also in LaTeX and ConTeXt), for the allocation of registers. The command exists in &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;LuaTeX&lt;/del&gt;, and is available in the [http://tug.ctan.org/pkg/luatexbase luatexbase] package for plain TeX and LaTeX under the name \newluatexattribute.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;It is wise to have a \newattribute command, like \newcount (from plain TeX, used also in LaTeX and ConTeXt), for the allocation of registers. The command exists in &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;ConTeXt&lt;/ins&gt;, and is available in the [http://tug.ctan.org/pkg/luatexbase luatexbase] package for plain TeX and LaTeX under the name \newluatexattribute.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Whenever a count register is allowed, an attribute register too; that is, primitives like \advance, \multiply, \divide, can be used. More generally, anywhere a number is needed, attributes will do. Of course, assignments to attribute registers obey grouping.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Whenever a count register is allowed, an attribute register &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;is &lt;/ins&gt;too; that is, primitives like \advance, \multiply, \divide, can be used. More generally, anywhere a number is needed, attributes will do. Of course, assignments to attribute registers obey grouping.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Attributes differ from count registers in two respects:&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Attributes differ from count registers in two respects:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* They have a special value, -&amp;quot;7FFFFFFF in hexadecimal or -2147483647 in decimal; an attribute with that value (which is default) is said to be &amp;lt;em&amp;gt;unset&amp;lt;/em&amp;gt;. With any larger value, the attribute is &amp;lt;em&amp;gt;set&amp;lt;/em&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* They have a special value, -&amp;quot;7FFFFFFF in hexadecimal or -2147483647 in decimal; an attribute with that value (which is default) is said to be &amp;lt;em&amp;gt;unset&amp;lt;/em&amp;gt;. With any larger value, the attribute is &amp;lt;em&amp;gt;set&amp;lt;/em&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* When [[nodes]] are created, they carry with them the values of all the attributes in force at creation time (except for some asynchronous attribute settings). In other words, when inspecting a [[nodes|node]] at whatever stage of its processing, one can retrieve (and also modify) the values of the attributes when the node was created. In that respect, attributes behave like fonts (glyph [[nodes]] always carry information about their fonts).&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* When [[nodes]] are created, they carry with them the values of all the attributes in force at creation time (except for some &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[[#Asynchronous attribute settings|&lt;/ins&gt;asynchronous attribute settings&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;]]&lt;/ins&gt;). In other words, when inspecting a [[nodes|node]] at whatever stage of its processing, one can retrieve (and also modify) the values of the attributes when the node was created. In that respect, attributes behave like fonts (glyph [[nodes]] always carry information about their fonts).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Box attributes ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Box attributes ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l38&quot; &gt;Line 38:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 38:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The &amp;lt;tt&amp;gt;attr&amp;lt;/tt&amp;gt; declaration should precede the &amp;lt;tt&amp;gt;to&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;spread&amp;lt;/tt&amp;gt; declaration if any.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The &amp;lt;tt&amp;gt;attr&amp;lt;/tt&amp;gt; declaration&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;(s) &lt;/ins&gt;should precede the &amp;lt;tt&amp;gt;to&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;spread&amp;lt;/tt&amp;gt; declaration if any.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Asynchronous attribute settings ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Asynchronous attribute settings ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Paul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=Attributes&amp;diff=91&amp;oldid=prev</id>
		<title>Paul: How attributes work. There lack examples.</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=Attributes&amp;diff=91&amp;oldid=prev"/>
		<updated>2011-05-10T15:06:10Z</updated>

		<summary type="html">&lt;p&gt;How attributes work. There lack examples.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
Attributes are a new concept introduced in LuaTeX. In a way, they are a mix between count registers (they are numbers) and fonts (they are attached to the [[nodes]] created under their scope). They allow information to be carried between different stages of processing.&lt;br /&gt;
&lt;br /&gt;
= Syntax =&lt;br /&gt;
&lt;br /&gt;
Syntactically, attributes are no different from (and can be used as) count registers. Accordingly, primitive commands to handle attribute registers mimick those for count registers: like &amp;lt;tt&amp;gt;\count&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;\attribute&amp;lt;/tt&amp;gt; is used to refer to a register, and like &amp;lt;tt&amp;gt;\countdef&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;\attributedef&amp;lt;/tt&amp;gt; defines a control sequence to be a synonym for a register. The syntax is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
\attribute &amp;lt;16-bit number&amp;gt; &amp;lt;optional equals&amp;gt; &amp;lt;32-bit number&amp;gt;&lt;br /&gt;
\attributedef &amp;lt;csname&amp;gt; &amp;lt;optional equals&amp;gt; &amp;lt;16-bit number&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is wise to have a \newattribute command, like \newcount (from plain TeX, used also in LaTeX and ConTeXt), for the allocation of registers. The command exists in LuaTeX, and is available in the [http://tug.ctan.org/pkg/luatexbase luatexbase] package for plain TeX and LaTeX under the name \newluatexattribute.&lt;br /&gt;
&lt;br /&gt;
Whenever a count register is allowed, an attribute register too; that is, primitives like \advance, \multiply, \divide, can be used. More generally, anywhere a number is needed, attributes will do. Of course, assignments to attribute registers obey grouping.&lt;br /&gt;
&lt;br /&gt;
Attributes differ from count registers in two respects:&lt;br /&gt;
&lt;br /&gt;
* They have a special value, -&amp;quot;7FFFFFFF in hexadecimal or -2147483647 in decimal; an attribute with that value (which is default) is said to be &amp;lt;em&amp;gt;unset&amp;lt;/em&amp;gt;. With any larger value, the attribute is &amp;lt;em&amp;gt;set&amp;lt;/em&amp;gt;.&lt;br /&gt;
* When [[nodes]] are created, they carry with them the values of all the attributes in force at creation time (except for some asynchronous attribute settings). In other words, when inspecting a [[nodes|node]] at whatever stage of its processing, one can retrieve (and also modify) the values of the attributes when the node was created. In that respect, attributes behave like fonts (glyph [[nodes]] always carry information about their fonts).&lt;br /&gt;
&lt;br /&gt;
== Box attributes ==&lt;br /&gt;
&lt;br /&gt;
When creating boxes, there exists a new keyword &amp;lt;tt&amp;gt;attr&amp;lt;/tt&amp;gt; besides &amp;lt;tt&amp;gt;to&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;spread&amp;lt;/tt&amp;gt;. The node representing the box will then have the associate attribute, but not its contents. For instance, after:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
\attribute0=1&lt;br /&gt;
\setbox0=\hbox attr 1 = 1 {contents}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The box (as a node) and each node of its contents have value 1 for attribute 0, but only the box node has value 1 for attribute 1; its contents has whatever value is currently assigned to that attribute (very probably the attribute is unset).&lt;br /&gt;
&lt;br /&gt;
The syntax for the &amp;lt;tt&amp;gt;attr&amp;lt;/tt&amp;gt; keyword is the following (all spaces are optional):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
attr &amp;lt;number&amp;gt; = &amp;lt;number&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;attr&amp;lt;/tt&amp;gt; declaration should precede the &amp;lt;tt&amp;gt;to&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;spread&amp;lt;/tt&amp;gt; declaration if any.&lt;br /&gt;
&lt;br /&gt;
== Asynchronous attribute settings ==&lt;br /&gt;
&lt;br /&gt;
Sometimes [[nodes]] are assigned attribute values depending not on the real values at creation time but on the values of the surrounding nodes. The following simplistic code illustrates that:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{\attribute0=1 Ve}\par&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
LuaTeX will insert a font kern between the two letters (if the font says so, of course). That node will have attribute 0 set to 1, even though that is no longer the real value. Indeed, the kern node is created when building the paragraph, i.e. when the &amp;lt;tt&amp;gt;\par&amp;lt;/tt&amp;gt; command is encountered; at that time, attribute 0 no longer has value 1, since that value was assigned in a group and the group is closed. So the kern should normally have whatever value is in force outside the group; instead it is given the value of the nodes that prompted its creation (more precisely, the value of the first node, which can differ from the second one). Similarly, a ligature node takes the values of those nodes it is created from, as does a discretionary node.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;\leftskip&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;\rightskip&amp;lt;/tt&amp;gt; glues, inserted when non-zero at the beginning and end of each line of a paragraph, take the value of the neighboring nodes (i.e. the first and last nodes of a line, respectively).&lt;br /&gt;
&lt;br /&gt;
Those asynchronous settings are supposed to make more sense than assignments that would follow the real values. Counter-measures can easily be implemented if necessary: for instance, one can inspect all lines in a paragraph and reassign to the &amp;lt;tt&amp;gt;\leftskip&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;\rightskip&amp;lt;/tt&amp;gt; glues the current values for the attributes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= On the Lua side =&lt;br /&gt;
&lt;br /&gt;
== Registers ==&lt;br /&gt;
&lt;br /&gt;
Like all registers, attributes are stored in a Lua table in the &amp;lt;tt&amp;gt;tex&amp;lt;/tt&amp;gt; library. Hence besides &amp;lt;tt&amp;gt;tex.count&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;tex.box&amp;lt;/tt&amp;gt;, etc., there exists &amp;lt;tt&amp;gt;tex.attribute&amp;lt;/tt&amp;gt;. The indices to entries are either a register number or the name of a control sequence defined with &amp;lt;tt&amp;gt;\attributedef&amp;lt;/tt&amp;gt;. For instance, after&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
\attributedef\myattribute=100&lt;br /&gt;
\myattribute=1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
both &amp;lt;tt&amp;gt;tex.attribute.myattribute&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;tex.attribute[100]&amp;lt;/tt&amp;gt; return 1. The entry can also be assigned to, but then the assignment is necessarily local.&lt;br /&gt;
&lt;br /&gt;
There are also two functions to set or retrieve attribute values, with the following syntax:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tex.getattribute(&amp;lt;register&amp;gt;)&lt;br /&gt;
tex.setattribute([&amp;quot;global&amp;quot;,] &amp;lt;register&amp;gt;, &amp;lt;number&amp;gt;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In both case &amp;lt;tt&amp;gt;&amp;lt;register&amp;gt;&amp;lt;/tt&amp;gt; is the same as an entry in &amp;lt;tt&amp;gt;tex.attribute&amp;lt;/tt&amp;gt;: either a number or a string representing a control sequence defined with &amp;lt;tt&amp;gt;\attributedef&amp;lt;/tt&amp;gt;. The first function returns the current value of the attribute, while the second sets it, either locally or globally if the first optional argument is given.&lt;br /&gt;
&lt;br /&gt;
== Attributes in nodes ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;node&amp;lt;/tt&amp;gt; library offers the following function to deal with the values of attributes for a given node:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
node.has_attribute(&amp;lt;node&amp;gt;, &amp;lt;attribute&amp;gt;[, &amp;lt;value&amp;gt;])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Without the third argument, if &amp;lt;tt&amp;gt;&amp;lt;node&amp;gt;&amp;lt;/tt&amp;gt; has &amp;lt;tt&amp;gt;attribute&amp;lt;/tt&amp;gt; &amp;lt;em&amp;gt;set&amp;lt;/em&amp;gt;, i.e. with a value different from -&amp;quot;7FFFFFFF, then the value is returned; otherwise &amp;lt;tt&amp;gt;nil&amp;lt;/tt&amp;gt; is returned. If the third argument is given, the value of the attribute is returned if and only if it is equal to &amp;lt;value&amp;gt;, and &amp;lt;tt&amp;gt;nil&amp;lt;/tt&amp;gt; otherwise.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
node.set_attribute(&amp;lt;node&amp;gt;, &amp;lt;attribute&amp;gt;, &amp;lt;value&amp;gt;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sets &amp;lt;attribute&amp;gt; to &amp;lt;value&amp;gt; for &amp;lt;node&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
node.unset_attribute(&amp;lt;node&amp;gt;, &amp;lt;attribute&amp;gt;[, &amp;lt;value&amp;gt;])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unsets &amp;lt;attribute&amp;gt; for &amp;lt;node&amp;gt; and returns the old value; if &amp;lt;value&amp;gt; is present, the attribute is unset only if it matches &amp;lt;value&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Attribute lists ==&lt;br /&gt;
&lt;br /&gt;
In [[nodes]], attributes actually are implemented as nodes in a list. That is why the &amp;lt;tt&amp;gt;attr&amp;lt;/tt&amp;gt; field of all nodes (except attribute nodes themselves) points to a node of type &amp;lt;tt&amp;gt;attribute_list&amp;lt;/tt&amp;gt;. That node has only one field &amp;lt;tt&amp;gt;next&amp;lt;/tt&amp;gt; pointing to the first attribute node in the list, if any. There might not be any such node because only &amp;lt;em&amp;gt;set&amp;lt;/em&amp;gt; attributes are present in the list. Attribute nodes have three fields:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;number&amp;lt;/tt&amp;gt;: the attribute&amp;#039;s number;&lt;br /&gt;
* &amp;lt;tt&amp;gt;value&amp;lt;/tt&amp;gt;: the attribute&amp;#039;s value;&lt;br /&gt;
* &amp;lt;tt&amp;gt;next&amp;lt;/tt&amp;gt;: the next attribute in the list, i.e. an attribute node that is &amp;lt;em&amp;gt;set&amp;lt;/em&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
As an example, the following code prints &amp;lt;tt&amp;gt;0 = 5&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;10 = 45&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
\setbox0=\hbox attr0 = 5 attr10 = 45 {contents}&lt;br /&gt;
&lt;br /&gt;
\directlua{&lt;br /&gt;
  local attr = tex.box[0].attr.next&lt;br /&gt;
  while attr do&lt;br /&gt;
    texio.write_nl(attr.number .. &amp;quot; = &amp;quot; .. attr.value)&lt;br /&gt;
    attr = attr.next&lt;br /&gt;
  end&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Paul</name></author>
		
	</entry>
</feed>