Difference between revisions of "Command/currentstructuretitle"

From Wiki
Jump to navigation Jump to search
m (Created page with "The {{cmd|currentstructuretitle}} command allows the document to reference the name of the current document structure element. For example, this could be the chapter name, the ti...")
 
m
Line 31: Line 31:
 
\stoptext
 
\stoptext
 
</pre>
 
</pre>
 +
 +
Another way to refer to the name of a structure's attribute is using:
 +
 +
{{cmd|namedstructurevariable}}<tt>{section}{title}</tt>

Revision as of 02:12, 22 September 2013

The \currentstructuretitle command allows the document to reference the name of the current document structure element. For example, this could be the chapter name, the title name, the section name, subsection name, and so forth.

Here is an example:

\define[2]\Index
    {\expanded{\index{#1+\currentstructuretitle}{#2}}}

\starttext

\startsection[title={Everything Buns}]

  \Index{all-purpose flour}{all-purpose flour}
  \Index{olive oil}{olive oil}

  Instructions on how to make buns.

\stopsection

\startsection[title={Butternut Squash Soup}]

  \Index{olive oil}{olive oil}
  \Index{bacon}{bacon}

  Instructions on how to make butternut squash soup.

\stopsection

\placeindex

\stoptext

Another way to refer to the name of a structure's attribute is using:

\namedstructurevariable{section}{title}