ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: <denis.maier@unibe.ch>
To: <wolfgang.schuster.lists@gmail.com>
Cc: ntg-context@ntg.nl
Subject: [NTG-context] Re: Using structureuservariables before the heading
Date: Tue, 12 Sep 2023 19:38:02 +0000	[thread overview]
Message-ID: <ZRAP278MB04957B26035656EA9ED7345083F1A@ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <005bc695-fac3-18d0-f903-81f7720506d7@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 3077 bytes --]

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

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


Von: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com><mailto:wolfgang.schuster.lists@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.maier@unibe.ch><mailto:denis.maier@unibe.ch>
Betreff: Re: [NTG-context] Using structureuservariables before the heading

denis.maier@unibe.ch<mailto:denis.maier@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:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setuphead[chapter][
    before={Before: \structureuservariable{author}\blank},
    beforesection={Beforesection: \structureuservariable{author}\blank},
    insidesection={Insidesection: \structureuservariable{author}\blank},
    after={After: \structureuservariable{author}\blank},
    ]

\def\myChapterCommand#1#2{\structureuservariable{author}\space\blank}
\define[2]\myChapterCommand{\structureuservariable{author}\blank #1\space#2}
%\def\myChapterCommand#1#2{\structureuservariable{author}\blank #1\space#2} % does not work

% \starttexdefinition myChapterCommand #1 #2 % doesn't work either, but at least blanks should work
%   \structureuservariable{author}
%   Test
%   \blank
%   #1\space#2
% \stoptexdefinition

\starttext

\myChapterCommand{1}{asdf}

\startchapter[title=First][author=First Author]
\input knuth
\stopchapter

\startchapter[title=Second][author=Second Author]
\input knuth
\stopchapter

\setuphead[chapter]
    [
    before=,after=,beforesection=,insidesection=,
    command=\myChapterCommand,
    ]

\startchapter[title=Third][author={Third Author}]
\input knuth
\stopchapter

\stoptext
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

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.

Denis


[-- Attachment #1.2: Type: text/html, Size: 13909 bytes --]

[-- Attachment #2: Type: text/plain, Size: 495 bytes --]

___________________________________________________________________________________
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-09-12 19:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-12 15:47 [NTG-context] " denis.maier
2023-09-12 15:57 ` [NTG-context] " denis.maier
2023-09-12 18:41 ` Wolfgang Schuster
2023-09-12 19:24   ` denis.maier
2023-09-12 19:30     ` Wolfgang Schuster
2023-09-12 19:38       ` denis.maier [this message]
2023-09-12 21:15         ` Wolfgang Schuster
2023-09-12 21:32           ` denis.maier
2023-09-14  7:55             ` Wolfgang Schuster
     [not found] <169454748804.38484.3621451343993224756@cgl.ntg.nl>
2023-09-12 23:09 ` Andres Conrado Montoya

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=ZRAP278MB04957B26035656EA9ED7345083F1A@ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM \
    --to=denis.maier@unibe.ch \
    --cc=ntg-context@ntg.nl \
    --cc=wolfgang.schuster.lists@gmail.com \
    /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).