ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Garulfo via ntg-context <ntg-context@ntg.nl>
To: "ntg-context@ntg.nl >> mailing list for ConTeXt users"
	<ntg-context@ntg.nl>
Cc: Garulfo <garulfo@azules.eu>
Subject: Re: [NTG-context] how access to \namedstructurevariable [next / previous]
Date: Sat, 29 Apr 2023 23:23:01 +0200	[thread overview]
Message-ID: <c5abb298-568c-53f1-7a62-dee7ce528c35@azules.eu> (raw)
In-Reply-To: <b5354edb-525f-509c-9376-c6bb88a3d9a1@azules.eu>

Got a solution, but it looks like "not a proper way to do it"

Is it recommanded to work directly with lua tables like these :
- structures.sections.current().references
- fonts.current().specification

===================================================

\def\CheckC%
{\startluacode
local numero = structures.sections.current()
if numero == nil then
     numero = 1
else
     numero = structures.sections.current().references.listindex + 1
end
context.page()
context("inbetween : "..structures.lists.collected[numero].titledata.title)
context.page()
\stopluacode}

\setuphead [section] 
[color=darkred,style=\tfc,inbetween={\mono{\CheckC}}]
\setuphead [subsection] [inbetween=]

\starttext

     \startsection[title=Section A]
     Text of section A.

         \startsubsection[title=SubSection A.A]
         Text of subsection A.A
         \stopsubsection

     \stopsection

     \startsection[title=Section B]
         Text of section B.

         \startsubsection[title=SubSection A.A]
         Text of subsection A.A
         \stopsubsection

     \stopsection

\stoptext



Le 29/04/2023 à 18:07, Garulfo a écrit :
> Hi all,
> 
> I would like to use the title and the number of a section twice :
> - first with a specific layout (with makeup)
> - second, as usual, as part of the page flow.
> 
> like in : http://www.pragma-ade.nl/general/manuals/cont-enp.pdf#page=23
> 
> looking at the source code 
> (http://context.aanhet.net/svn/manuals/context/layo-00.tex), I 
> understood that it was achieved with :
> 
> \setuphead
>    [\v!chapter]
>    [\c!command=\PlaatsHoofdstuk,
>     \c!page=\v!yes,
>     \c!before=,
>     \c!inbetween=\PlaatsHoofdstukIndex,
>    %\c!incrementnumber=cont-\currentlanguage,
>     \c!header=\v!nomarking,
>     \c!textstyle=\bfd,
>     \c!numberstyle=\bfe]
> 
> and
> 
> \def\PlaatsHoofdstukIndex % todo: lucida
>   {%\startnotmode[*\v!frontpart]
>      \page[\v!right]
>      \setupbackgrounds[\v!paper][\c!background=\v!color]
>      \startmakeup[\v!standard]
>        \raggedleft
>        \doifsomething{\currentheadnumber}
>           {\hfill\expanded{\processMPheadnumber{\currentheadnumber}}}
>        \vfill
>        \hfill\expanded{\processMPheadtext{\currentheadtext}}
>      \stopmakeup
>      \setupbackgrounds[\v!paper][\c!background=]
>    }%\stopnotmode}
> 
> 
> 
> But currently, I can not reproduce it :
> - \currentheadtex return empty
> - \namedstructurevariable{section}{title} only report the update title
>    once the title is actually typesetted
> 
> Is there a way to access \namedstructurevariable with [next] or 
> [previous] like options ?
> 
> 
> Here is a test trying to reproduce cont-enp.pdf example
> ===================================================
> 
> \def\CheckA{{\mono\currentheadtext}}
> \def\CheckB{{\mono\namedstructurevariable{section}{title}}\page}
> 
> \setuphead
>    [section]
>    [before={before : \CheckA - \CheckB},
>    inbetween={inbetween: \CheckA - \CheckB},
>    after={after: \CheckA - \CheckB},
>    beforesection={beforesection: \CheckA - \CheckB},
>    insidesection={insidesection: \CheckA - \CheckB},
>    aftersection={aftersection: \CheckA - \CheckB},
>    color=darkred,
>    style=\tfc,
>    ]
> 
> \starttext
> 
> \startsection[title=Section A]
> Text of section A.
> \stopsection
> 
> \startsection[title=Section B]
> Text of section B.
> \stopsection
> 
> \stoptext
> 
> ===================================================
> 
> Thanks for your help
> Garulfo
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

      reply	other threads:[~2023-04-29 21:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-29 16:07 Garulfo via ntg-context
2023-04-29 21:23 ` Garulfo via ntg-context [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c5abb298-568c-53f1-7a62-dee7ce528c35@azules.eu \
    --to=ntg-context@ntg.nl \
    --cc=garulfo@azules.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).