* date problem @ 2013-03-20 13:26 H. van der Meer 2013-03-20 13:39 ` Wolfgang Schuster 0 siblings, 1 reply; 6+ messages in thread From: H. van der Meer @ 2013-03-20 13:26 UTC (permalink / raw) To: ConTeXt NTG There is a nasty problem when defining the \date. First approach: *** > macro:->\date \def\thedate{\date}\writestatus{***}{\meaning\thedate} Alas, I get lateron a luatex error on \date: ! LuaTeX error [string "\directlua "]:1: invalid escape sequence near '\d'. Second approach, use \edef to get an expanded value. \edef\thedate{\date}\writestatus{***}{\meaning\thedate} *** > macro:->\date Alas, the date is still the unexpanded macro and not something like 20 march 2013. How to? Hans van der Meer ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: date problem 2013-03-20 13:26 date problem H. van der Meer @ 2013-03-20 13:39 ` Wolfgang Schuster 2013-03-20 13:52 ` Meer H. van der 0 siblings, 1 reply; 6+ messages in thread From: Wolfgang Schuster @ 2013-03-20 13:39 UTC (permalink / raw) To: mailing list for ConTeXt users Am 20.03.2013 um 14:26 schrieb H. van der Meer <H.vanderMeer@uva.nl>: > There is a nasty problem when defining the \date. > > First approach: > *** > macro:->\date > \def\thedate{\date}\writestatus{***}{\meaning\thedate} > Alas, I get lateron a luatex error on \date: > ! LuaTeX error [string "\directlua "]:1: invalid escape sequence near '\d'. > > Second approach, use \edef to get an expanded value. > \edef\thedate{\date}\writestatus{***}{\meaning\thedate} > *** > macro:->\date > Alas, the date is still the unexpanded macro and not something like 20 march 2013. > > How to? All commands with optional argument aren’t expandable and \date *has* two optional argument. To get now the date in the output you can either use the expandable \rawdate[] command (the brackets are necessary) or you use \ctxcommand{currentdate(<specification>,<language>)} (language can also be "false"). Wolfgang ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: date problem 2013-03-20 13:39 ` Wolfgang Schuster @ 2013-03-20 13:52 ` Meer H. van der 2013-03-20 14:11 ` Wolfgang Schuster 0 siblings, 1 reply; 6+ messages in thread From: Meer H. van der @ 2013-03-20 13:52 UTC (permalink / raw) To: mailing list for ConTeXt users One step further, thanks. But why does \edef\thedate{\rawdate[]}\writestatus{***}{\meaning\thedate} result in ** > macro:->unknown march 2013 instead of 20 march 2013? Hans van der Meer On 20 mrt. 2013, at 14:39, Wolfgang Schuster <schuster.wolfgang@gmail.com> wrote: > > Am 20.03.2013 um 14:26 schrieb H. van der Meer <H.vanderMeer@uva.nl>: > >> There is a nasty problem when defining the \date. >> >> First approach: >> *** > macro:->\date >> \def\thedate{\date}\writestatus{***}{\meaning\thedate} >> Alas, I get lateron a luatex error on \date: >> ! LuaTeX error [string "\directlua "]:1: invalid escape sequence near '\d'. >> >> Second approach, use \edef to get an expanded value. >> \edef\thedate{\date}\writestatus{***}{\meaning\thedate} >> *** > macro:->\date >> Alas, the date is still the unexpanded macro and not something like 20 march 2013. >> >> How to? > > All commands with optional argument aren’t expandable and \date *has* two optional argument. > > To get now the date in the output you can either use the expandable \rawdate[] command (the brackets are necessary) or you use \ctxcommand{currentdate(<specification>,<language>)} (language can also be "false"). > > Wolfgang > ___________________________________________________________________________________ > 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://tex.aanhet.net > archive : http://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > ___________________________________________________________________________________ ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: date problem 2013-03-20 13:52 ` Meer H. van der @ 2013-03-20 14:11 ` Wolfgang Schuster 2013-03-20 14:29 ` Meer H. van der 0 siblings, 1 reply; 6+ messages in thread From: Wolfgang Schuster @ 2013-03-20 14:11 UTC (permalink / raw) To: mailing list for ConTeXt users Am 20.03.2013 um 14:52 schrieb Meer H. van der <H.vanderMeer@uva.nl>: > One step further, thanks. > But why does > \edef\thedate{\rawdate[]}\writestatus{***}{\meaning\thedate} > result in > ** > macro:->unknown march 2013 > instead of 20 march 2013? Provide a *working* minimal example because when I run this example \starttext \rawdate[] \stoptext I get “march unknown, 2013” as output. When I use now (instead of \currentlanguage you can also use a language tag, e.g. "nl") \starttext \ctxcommand{currentdate("month, ,day, , year","\currentlanguage")} \stoptext I get as output “March 20 2013”. The problem with \rawdate is that no language is passed and context doesn’t convert the labels for the month/years and also the day results in a default string, i.e. it produces the “unknown” string. Wolfgang ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: date problem 2013-03-20 14:11 ` Wolfgang Schuster @ 2013-03-20 14:29 ` Meer H. van der 2013-03-20 14:50 ` Wolfgang Schuster 0 siblings, 1 reply; 6+ messages in thread From: Meer H. van der @ 2013-03-20 14:29 UTC (permalink / raw) To: mailing list for ConTeXt users I see. But this is not working too. Following your suggestion I now get: \edef\thisdate{\ctxcommand{currentdate("month, ,day, , year","\currentlanguage")}}\writestatus{***}{\meaning\thisdate} *** > macro:->\labeltext {march} 20 2013 The problem is essentially the same. I am most unhappy with this, because fixing the current date in some macro shouldn't be impossible. And why all those extra ,s in month, ,day, , year? I would suggest that besides \currentdate one should be able to also use \currentdate[month][day][year][language], \currentdate[day][mont][year][language],etc. And then be able to store the expansion in a macro. Is it possible to incorporate this in the next beta? By the way, the \time and \currenttime pose the same problem, here even \rawtime seems nonexistent. Hans van der Meer On 20 mrt. 2013, at 15:11, Wolfgang Schuster <schuster.wolfgang@gmail.com> wrote: > > Am 20.03.2013 um 14:52 schrieb Meer H. van der <H.vanderMeer@uva.nl>: > >> One step further, thanks. >> But why does >> \edef\thedate{\rawdate[]}\writestatus{***}{\meaning\thedate} >> result in >> ** > macro:->unknown march 2013 >> instead of 20 march 2013? > > Provide a *working* minimal example because when I run this example > > \starttext > \rawdate[] > \stoptext > > I get “march unknown, 2013” as output. > > > When I use now (instead of \currentlanguage you can also use a language tag, e.g. "nl") > > \starttext > \ctxcommand{currentdate("month, ,day, , year","\currentlanguage")} > \stoptext > > I get as output “March 20 2013”. The problem with \rawdate is that no language is passed > and context doesn’t convert the labels for the month/years and also the day results in > a default string, i.e. it produces the “unknown” string. > > Wolfgang > ___________________________________________________________________________________ > 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://tex.aanhet.net > archive : http://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > ___________________________________________________________________________________ ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: date problem 2013-03-20 14:29 ` Meer H. van der @ 2013-03-20 14:50 ` Wolfgang Schuster 0 siblings, 0 replies; 6+ messages in thread From: Wolfgang Schuster @ 2013-03-20 14:50 UTC (permalink / raw) To: mailing list for ConTeXt users Am 20.03.2013 um 15:29 schrieb "Meer H. van der" <H.vanderMeer@uva.nl>: > I see. But this is not working too. Following your suggestion I now get: > \edef\thisdate{\ctxcommand{currentdate("month, ,day, , year","\currentlanguage")}}\writestatus{***}{\meaning\thisdate} > *** > macro:->\labeltext {march} 20 2013 > The problem is essentially the same. \starttext \writestatus{***}{\cldcontext{os.date("\letterpercent Y\space\letterpercent m\space\letterpercent d")}} \stoptext > I am most unhappy with this, because fixing the current date in some macro shouldn't be impossible. \starttext \writestatus{***}{\number\normalyear \space \number\normalmonth \space \number\normalday} \stoptext > And why all those extra ,s in month, ,day, , year? This should be “month,space,day,space,year”, “space” in this list is a keywords to add a space between the entries. > I would suggest that besides \currentdate one should be able to also use \currentdate[month][day][year][language], \currentdate[day][mont][year][language],etc. And then be able to store the expansion in a macro. Is it possible to incorporate this in the next beta? http://wiki.contextgarden.net/Command/date Wolfgang ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-03-20 14:50 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-03-20 13:26 date problem H. van der Meer 2013-03-20 13:39 ` Wolfgang Schuster 2013-03-20 13:52 ` Meer H. van der 2013-03-20 14:11 ` Wolfgang Schuster 2013-03-20 14:29 ` Meer H. van der 2013-03-20 14:50 ` Wolfgang Schuster
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).