Von: Wolfgang Schuster <wolfgang.schuster.li...@gmail.com>
Gesendet: Dienstag, 12. September 2023 23:16
An: Maier, Denis Christian (UB) <denis.ma...@unibe.ch>
Cc: ntg-context@ntg.nl
Betreff: Re: [NTG-context] Using structureuservariables before the heading

denis.ma...@unibe.ch<mailto:denis.ma...@unibe.ch> schrieb am 12.09.2023 um 
21:38:

Von: Wolfgang Schuster 
<wolfgang.schuster.li...@gmail.com><mailto:wolfgang.schuster.li...@gmail.com>
Gesendet: Dienstag, 12. September 2023 21:30
An: Maier, Denis Christian (UB) 
<denis.ma...@unibe.ch><mailto:denis.ma...@unibe.ch>
Cc: ntg-context@ntg.nl<mailto:ntg-context@ntg.nl>
Betreff: Re: [NTG-context] Using structureuservariables before the heading

denis.ma...@unibe.ch<mailto:denis.ma...@unibe.ch> schrieb am 12.09.2023 um 
21:24:



Von: Wolfgang Schuster 
<wolfgang.schuster.li...@gmail.com><mailto:wolfgang.schuster.li...@gmail.com>
Gesendet: Dienstag, 12. September 2023 20:41
An: mailing list for ConTeXt users 
<ntg-context@ntg.nl><mailto:ntg-context@ntg.nl>; Maier, Denis Christian (UB) 
<denis.ma...@unibe.ch><mailto:denis.ma...@unibe.ch>
Betreff: Re: [NTG-context] Using structureuservariables before the heading

denis.ma...@unibe.ch<mailto:denis.ma...@unibe.ch> schrieb am 12.09.2023 um 
17:47:



Hi,

is it possible to access a structureuservariable before the heading's title ?
Using the <before> key does not seem to work.

There are ways but not in a general way because you try to access the values
before they are known to ConTeXt. To provide a proper solution you have
to tell what you're trying to achieve.

I'm just trying to output the author's name above a chapter heading. Do you 
need more information?

You can create a custom header for the chapter page and show the value of the 
author key
which works without problems because the header is added after to the finished 
page
after the value is available.

Another option when the name should appear in the same space as the chapter 
title
is a custom layout for the title.
Yes, I've tried that in the original MWE:

...

Here, I'm getting <Third author> just before <3 Third>. So I guess this goes in 
the right direction, but \define doesn't allow for blanks etc. 
\starttexdefinition and \def on the other hand gave me erros.

You need a box to get the author on a separate line.

% \define[2]\ChapterCommand
%   {\vbox
%      {\structureuservariable{author}
%      \blank
%      #1\space#2}}

\starttexdefinition protected ChapterCommand #1#2
  \vbox\bgroup
    \structureuservariable{author}
    \blank
    #1\space#2
  \egroup
\stoptexdefinition


Thank you so much, Wolfgang!

Why do you need protected here? I've realized that \protected\def also helps a 
bit, but, of course, paragraph breaks are ignored there as well...
If just found the following in the lowlevel-macros manual:
<Traditional TEX has three prefixes that can be used with macros: \global, 
\outer and \long. The last two are no-op's in LuaMetaTEX and if you want to 
know what they do (did) you can look it up in the TEXbook.>
So, \long is gone, but why is that? Is there a new mechanism that serves the 
same purpose? Other than using a vbox, I mean...

Best,
Denis
___________________________________________________________________________________
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 via email to