Editing Attributes

From LuaTeXWiki

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 12: Line 12:
 
</pre>
 
</pre>
  
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 ConTeXt, and is available in the [http://tug.ctan.org/pkg/luatexbase luatexbase] package for plain TeX and LaTeX under the name \newluatexattribute.
+
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.
  
Whenever a count register is allowed, an attribute register is 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.
+
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.
  
 
Attributes differ from count registers in two respects:
 
Attributes differ from count registers in two respects:
  
 
* They have a special value, -"7FFFFFFF in hexadecimal or -2147483647 in decimal; an attribute with that value (which is default) is said to be <em>unset</em>. With any larger value, the attribute is <em>set</em>.
 
* They have a special value, -"7FFFFFFF in hexadecimal or -2147483647 in decimal; an attribute with that value (which is default) is said to be <em>unset</em>. With any larger value, the attribute is <em>set</em>.
* 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|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).
+
* 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).
  
 
== Box attributes ==
 
== Box attributes ==
Line 38: Line 38:
 
</pre>
 
</pre>
  
The <tt>attr</tt> declaration(s) should precede the <tt>to</tt> or <tt>spread</tt> declaration if any.
+
The <tt>attr</tt> declaration should precede the <tt>to</tt> or <tt>spread</tt> declaration if any.
  
 
== Asynchronous attribute settings ==
 
== Asynchronous attribute settings ==

Please note that all contributions to LuaTeXWiki are considered to be released under the GNU Free Documentation License 1.3 (see LuaTeXWiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)