Hi, I would expect, that \currentdate prints the current date, but it does not: --8<---------------cut here---------------start------------->8--- \starttext \date[d=1]% first day of this month, ok \date% again first day, last parameters are used, this is ok \currentdate% same as \date, but I would expect the day of today... \stoptext --8<---------------cut here---------------end--------------->8--- How could I print the current date please? TIA for any hints, -- Peter
Le 10 janv. 2021 à 13:23, Peter Münster
a écrit : Hi,
I would expect, that \currentdate prints the current date, but it does not:
--8<---------------cut here---------------start------------->8--- \starttext \date[d=1]% first day of this month, ok
\date% again first day, last parameters are used, this is ok
\currentdate% same as \date, but I would expect the day of today... \stoptext --8<---------------cut here---------------end--------------->8---
How could I print the current date please?
For exemple: \date[][weekday,day,month,year] and \currenttime[h,{\,:\,},m] F.
TIA for any hints, -- Peter ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________
On 1/27/2021 6:28 PM, Peter Münster wrote:
On Sun, Jan 10 2021, Peter Münster wrote:
\currentdate% same as \date, but I would expect the day of today...
Should I fill a bug-report on the tracker? Perhaps also for the missing space after \date[]? Reporting here is faster. Can (lazy me) Wolfgang confirm the issue?
Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Hans Hagen schrieb am 27.01.2021 um 22:31:
On 1/27/2021 6:28 PM, Peter Münster wrote:
On Sun, Jan 10 2021, Peter Münster wrote:
\currentdate% same as \date, but I would expect the day of today...
Should I fill a bug-report on the tracker? Perhaps also for the missing space after \date[]?
Reporting here is faster. Can (lazy me) Wolfgang confirm the issue?
1. Wrong date The \date command has wrong/weird grouping which makes global changes for the day, month and year. \permanent\tolerant\protected\def\date[#1]#*[#2]% {\dontleavehmode \ifparameter#1\or \begingroup \letdummyparameter\c!d\normalday \letdummyparameter\c!m\normalmonth \letdummyparameter\c!y\normalyear \getdummyparameters[#1]% \normalexpanded {\endgroup \normalday \number\directdummyparameter\c!d\relax \normalmonth\number\directdummyparameter\c!m\relax \normalyear \number\directdummyparameter\c!y\relax}% \fi ...} 2. Missing space When not all optional arguments are used the space after the last given argument is gobbled. This was normal behavior for a long time until you changed the code in MkIV to keep them. \tolerant\def\foo[#1]#*[#2]% {[#1][#2]} \starttext a \foo [1] b a \foo [1] [2] b \stoptext Wolfgang
On Wed, Jan 27 2021, Wolfgang Schuster wrote:
When not all optional arguments are used the space after the last given argument is gobbled. This was normal behavior for a long time until you changed the code in MkIV to keep them.
Hi, What does that mean? Is that going to be changed? How should \date[] be used now in the text? For now, I do it like "bla \date[d=3]\ bla". Is there a nicer way? TIA for any hints, -- Peter
On 3/13/2021 12:10 AM, Peter Münster wrote:
On Wed, Jan 27 2021, Wolfgang Schuster wrote:
When not all optional arguments are used the space after the last given argument is gobbled. This was normal behavior for a long time until you changed the code in MkIV to keep them.
Hi,
What does that mean? Is that going to be changed? How should \date[] be used now in the text? For now, I do it like "bla \date[d=3]\ bla". Is there a nicer way?
TIA for any hints, The problem with an interface with optional arguments is that it has to look ahead. There are actually some macros that use this feature to get rid of upcoming spaces (picking up two optional arguments where one is needed). So, no matter what solution is chosen: push back a space or not, it has some unpredictable character.
This is why I always am explicit, as in \date[d=3]\ bla because no matter what happens bvehind the screens, the \ terminates the argument check so it will stay. (I admit that i'm mnore often bitten by the pushed back one than the gobbled one so i make it a habit to be explicit about spaces, like like i use \removeunwantedspaces when i'm not sure when there can be spaces that crept in). We can of course in lmtx bring back the 'push back a space' behaviour but we then also introduce some fuzzyness. Now we have "we scan upto n arguments and gobble spaces when doing so". Btw, there is also another aspect: when looking for optional arguments the next token gets looked at and that one can be in an upcoming macro or content. \startfoo[a][b] content \stopfoo \startfoo[a] [ that starts content \stopfoo so sometimes one needs \startfoo[a] \relax [ that starts content \stopfoo to abort the scanning. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
participants (4)
-
Fabrice L
-
Hans Hagen
-
Peter Münster
-
Wolfgang Schuster