Looking to include the section within an index.


In LaTeX the nameref package allows coding a contextual macro called \currentname. This allows users to refer to the current section (or chapter, or part) without needing to type it in explicitly.

Ultimately, I'd like to include the current name in the index. For example:


\page [yes]

\input knuth

\input knuth


Being able to reference the chapter title indirectly has other uses than the one given above.


What is the equivalent to \currentname in ConTeXt?


I have tried: \the\chapter, \show\thechapter, \thechapter, \currentchaptername, etc. I have also looked at \nameref{marker}, but that, even if it worked, seems like an obtuse solution.


Some related information:

| improve this question | | | | |

The following variables give information about the current section (from strc-sec.mkiv):

   \xdef\currentstructurename           {\structureparameter\c!name}%
   \xdef\currentstructurecoupling       {\structureparameter\c!coupling}%
   \xdef\currentstructureownnumber      {\structureparameter\c!ownnumber}% optional own number
   \xdef\currentstructurelevel          {\structureparameter\c!level}%
   \edef\currentstructureexpansion      {\structureparameter\c!expansion}%
   \xdef\currentstructurexmlsetup       {\structureparameter\c!xmlsetup}%
   \xdef\currentstructurecatcodes       {\structureparameter\s!catcodes}%
   \xdef\currentstructurelabel          {\structureparameter\c!label}%
   \xdef\currentstructurereference      {\structureparameter\c!reference}%
   \xdef\currentstructurebackreference  {\structureparameter\c!backreference}%
   \xdef\currentstructureshownumber     {\structureparameter\c!number}%
   \xdef\currentstructuresaveinlist     {\structureparameter\c!saveinlist}%

   \xdef\currentstructuretitle   {\structureparameter\c!title}%
   \xdef\currentstructuremarking {\structureparameter\c!marking}%
   \xdef\currentstructurelist    {\structureparameter\c!list}%

In addition, the following have more complicated definitions.


Other useful commands are




Where #1 is the structured item to inspect and #2 is its attribute. For example:

| improve this answer | | | | |

Alternatively to Aditya's answer, what might be handy is getmarking e.g. \getmarking[title][current]

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.