ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Expansion of date inside \section
@ 2016-06-19 20:17 Mojca Miklavec
  2016-06-19 20:38 ` Mojca Miklavec
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Mojca Miklavec @ 2016-06-19 20:17 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

I'm trying to generate daily reports and wanted to include the date in
bookmarks, but there is some weird (non)expansion going on.

I might just as well switch to lua for certain parts of the document
(like cycling through dates), but I suspect that there must be some
trivial hack to prevent me from getting my sections labeled
    date[y={2016},m={06},d={25}]

\setupinteraction
    [state=start]
\placebookmarks
    [chapter,section,subsection]
    [chapter,section]
\setupinteractionscreen
    [option=bookmark]

\def\generatesection#1#2#3{%
    \edef\dt{\date[y={#1},m={#2},d={#3}][year,-,mm,-,dd]}
    \setupheadertexts[{\dt}][pagenumber]
    \section{\dt}
    % \externalfigure[#1#2#3.pdf]
}

\starttext
\chapter{Daily files}
\generatesection{2016}{06}{25}
\generatesection{2016}{06}{26}
\stoptext

Thank you,
    Mojca
___________________________________________________________________________________
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] 5+ messages in thread

* Re: Expansion of date inside \section
  2016-06-19 20:17 Expansion of date inside \section Mojca Miklavec
@ 2016-06-19 20:38 ` Mojca Miklavec
  2016-06-19 21:37 ` Thomas A. Schmitz
  2016-06-19 21:51 ` Hans Hagen
  2 siblings, 0 replies; 5+ messages in thread
From: Mojca Miklavec @ 2016-06-19 20:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 19 June 2016 at 22:17, Mojca Miklavec wrote:
> Hi,
>
> I'm trying to generate daily reports and wanted to include the date in
> bookmarks, but there is some weird (non)expansion going on.
>
> I might just as well switch to lua for certain parts of the document
> (like cycling through dates), but I suspect that there must be some
> trivial hack to prevent me from getting my sections labeled
>     date[y={2016},m={06},d={25}]

... other than using \section{#1-#2-#3} (which might also do the job for now).

> \setupinteraction
>     [state=start]
> \placebookmarks
>     [chapter,section,subsection]
>     [chapter,section]
> \setupinteractionscreen
>     [option=bookmark]
>
> \def\generatesection#1#2#3{%
>     \edef\dt{\date[y={#1},m={#2},d={#3}][year,-,mm,-,dd]}
>     \setupheadertexts[{\dt}][pagenumber]
>     \section{\dt}
>     % \externalfigure[#1#2#3.pdf]
> }
>
> \starttext
> \chapter{Daily files}
> \generatesection{2016}{06}{25}
> \generatesection{2016}{06}{26}
> \stoptext
>
> Thank you,
>     Mojca
___________________________________________________________________________________
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] 5+ messages in thread

* Re: Expansion of date inside \section
  2016-06-19 20:17 Expansion of date inside \section Mojca Miklavec
  2016-06-19 20:38 ` Mojca Miklavec
@ 2016-06-19 21:37 ` Thomas A. Schmitz
  2016-06-19 21:51 ` Hans Hagen
  2 siblings, 0 replies; 5+ messages in thread
From: Thomas A. Schmitz @ 2016-06-19 21:37 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 06/19/2016 08:17 PM, Mojca Miklavec wrote:
> Hi,
>
> I'm trying to generate daily reports and wanted to include the date in
> bookmarks, but there is some weird (non)expansion going on.


I'm not quite sure what you're trying to do, but are you maybe missing a 
simple

\setuphead[section][expansion=yes] ?

Thomas

___________________________________________________________________________________
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] 5+ messages in thread

* Re: Expansion of date inside \section
  2016-06-19 20:17 Expansion of date inside \section Mojca Miklavec
  2016-06-19 20:38 ` Mojca Miklavec
  2016-06-19 21:37 ` Thomas A. Schmitz
@ 2016-06-19 21:51 ` Hans Hagen
  2016-06-20  5:34   ` Pablo Rodriguez
  2 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2016-06-19 21:51 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 6/19/2016 10:17 PM, Mojca Miklavec wrote:
> Hi,
>
> I'm trying to generate daily reports and wanted to include the date in
> bookmarks, but there is some weird (non)expansion going on.
>
> I might just as well switch to lua for certain parts of the document
> (like cycling through dates), but I suspect that there must be some
> trivial hack to prevent me from getting my sections labeled
>     date[y={2016},m={06},d={25}]
>
> \setupinteraction
>     [state=start]
> \placebookmarks
>     [chapter,section,subsection]
>     [chapter,section]
> \setupinteractionscreen
>     [option=bookmark]
>
> \def\generatesection#1#2#3{%
>     \edef\dt{\date[y={#1},m={#2},d={#3}][year,-,mm,-,dd]}
>     \setupheadertexts[{\dt}][pagenumber]
>     \section{\dt}
>     % \externalfigure[#1#2#3.pdf]
> }
>
> \starttext
> \chapter{Daily files}
> \generatesection{2016}{06}{25}
> \generatesection{2016}{06}{26}
> \stoptext

first of all, did you try

\startsection[title=foo,bookmark=bar]

to separate between typeset text and bookmark (bookmark then can be 
#1-#2-#3)

another possibility is

\enabledirectives[references.bookmarks.preroll]

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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] 5+ messages in thread

* Re: Expansion of date inside \section
  2016-06-19 21:51 ` Hans Hagen
@ 2016-06-20  5:34   ` Pablo Rodriguez
  0 siblings, 0 replies; 5+ messages in thread
From: Pablo Rodriguez @ 2016-06-20  5:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 06/19/2016 11:51 PM, Hans Hagen wrote:
> [...]
> another possibility is
> 
> \enabledirectives[references.bookmarks.preroll]

Many thanks for this extremely useful directive, Hans.

I have two improvement suggestions for it, shown in the following sample:

    \def\BookTitle{{\em A \ConTeXt\ Book}}
    \setupinteraction[state=start, title=\BookTitle]
    \enabledirectives[references.bookmarks.preroll]
    \placebookmarks[chapter,section][chapter,section]

    \starttext
    \chapter{\BookTitle}
    \section{\ConTeXt\ is \TeX, but not \LaTeX}
    \stoptext

Would it be possible that \TeX (or \TEX) is translated as TeX? (ConTeXt
is the PDF creator in the PDF documentation info).

Would it be possible that this bookmark prerolling could be applied to
PDF info fields?

Many thanks for your help,

Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
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] 5+ messages in thread

end of thread, other threads:[~2016-06-20  5:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-19 20:17 Expansion of date inside \section Mojca Miklavec
2016-06-19 20:38 ` Mojca Miklavec
2016-06-19 21:37 ` Thomas A. Schmitz
2016-06-19 21:51 ` Hans Hagen
2016-06-20  5:34   ` Pablo Rodriguez

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).