ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: <denis.maier@unibe.ch>
To: <ntg-context@ntg.nl>
Subject: [NTG-context] Re: Using structureuservariables before the heading
Date: Tue, 12 Sep 2023 15:57:19 +0000	[thread overview]
Message-ID: <ZRAP278MB0495A1784E69FA6F44A4F7D383F1A@ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <ZRAP278MB049582D8D099A027D1FBFE5C83F1A@ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM>


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

Ok, \starttexdefinition allows blanks, apparently just like setups.
But, it still fails exactly like the version with \def


\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

Von: denis.maier@unibe.ch <denis.maier@unibe.ch>
Gesendet: Dienstag, 12. September 2023 17:48
An: ntg-context@ntg.nl
Betreff: [NTG-context] Using structureuservariables before the heading

Hi,

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

As an aside, I've tried to use the < command > key to provide my own command, but while \define works here (but ignores \blank), \def gives me an error.
Why is that?
How would you add blanks to a user-defined command?

Best,
Denis



\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

\starttext
\macro{1}{2}

\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

[-- Attachment #1.2: Type: text/html, Size: 10517 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 15:59 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 ` denis.maier [this message]
2023-09-12 18:41 ` [NTG-context] " Wolfgang Schuster
2023-09-12 19:24   ` denis.maier
2023-09-12 19:30     ` Wolfgang Schuster
2023-09-12 19:38       ` denis.maier
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=ZRAP278MB0495A1784E69FA6F44A4F7D383F1A@ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM \
    --to=denis.maier@unibe.ch \
    --cc=ntg-context@ntg.nl \
    /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).