Command/setregisterentry

From Wiki
< Command
Revision as of 21:28, 12 October 2020 by Jano Kula (talk | contribs) (typos)
Jump to navigation Jump to search


\setregisterentry

Summary

The command \setregisterentry writes entry to the register.

Settings

\setregisterentry[...][...=...,...][...=...,...]
[...]name
labelname
keystext processor->text
entriestext processor->text
keys:1text
keys:2text
keys:3text
entries:1text
entries:2text
entries:3text
alternativetext
keyvalue

Description

\setregisterentry is more structured form of the regular \index command. With its more complex and robust structure it is suitable for automatic workflows.

When processing the command on Lua end, one has to take care of colons in the key:1 and entry:1 parameters by enclosing them inside ["..."], which is more robust form of putting key in Lua table, see example bellow.

Examples

Three levels, changes in the sorting, comma in the entry

\setupregister[index][balance=no]

\starttext

\chapter{Alfred Hitchcock}

The Skin Game (1931)    \setregisterentry[index]
                        [keys:1=Hitchcock Alfred,
                        entries:1={Hitchcock, Alfred},
                        keys:2=1931,
                        entries:2=1931,
                        keys:3=Skin Game,
                        entries:3={Skin Game, The}]

Mary (1931)             \setregisterentry[index]
                        [keys:1=Hitchcock Alfred,
                        entries:1={Hitchcock, Alfred},
                        keys:2=1931,
                        entries:2=1931,
                        keys:3=Mary,
                        entries:3=Mary]

Rich and Strange (1931)	\setregisterentry[index]
                        [keys:1=Hitchcock Alfred,
                        entries:1={Hitchcock, Alfred},
                        keys:2=1931,
                        entries:2=1931,
                        keys:3=Rich and Strange,
                        entries:3=Rich and Strange]

Number Seventeen (1932) \setregisterentry[index]
                        [keys:1=Hitchcock Alfred,
                        entries:1={Hitchcock, Alfred},
                        keys:2=1932,
                        entries:2=1932,
                        keys:3=Number Seventeen,
                        entries:3=Number Seventeen]


\blank

\placeregister[index]   % without title

\stoptext

Processing on Lua end

\startluacode
context.setregisterentry({ "index" },
    { ["keys:1"]="sorting key", ["entries:1"]="displayed entry"})
\stopluacode

Notes

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: