ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* problems with "pagecomment"
@ 2019-04-27  3:16 Mohammad Hossein Bateni
  2019-04-27  5:24 ` Wolfgang Schuster
  0 siblings, 1 reply; 3+ messages in thread
From: Mohammad Hossein Bateni @ 2019-04-27  3:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Hi,

Look at the following MWE:


\setuppagecomment[state=start,location=right]
%\definestartstop[Notes]
%[before=\startpagecomment,after=\stoppagecomment]
\def\startNotes{\startpagecomment}
\def\stopNotes{\stoppagecomment}

\starttext
\input knuth
\startpagecomment
Hello
\stoppagecomment
\page
\input tufte
\startNotes
Testing
\stopNotes
\stoptext


This snippet does not compile.  Page comments work when I use the commands
\startpagecomment and \stoppagecomment directly (like in the first page),
but when I invoke via macros (as in the second page), ConTeXt produces
errors.

What is wrong there?

Thanks!
~MHB

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

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

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: problems with "pagecomment"
  2019-04-27  3:16 problems with "pagecomment" Mohammad Hossein Bateni
@ 2019-04-27  5:24 ` Wolfgang Schuster
  2019-04-27 10:44   ` Mohammad Hossein Bateni
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Schuster @ 2019-04-27  5:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Mohammad Hossein Bateni

Mohammad Hossein Bateni schrieb am 27.04.2019 um 05:16:
> Hi,
>
> Look at the following MWE:
>
>
> \setuppagecomment[state=start,location=right]
> %\definestartstop[Notes]
> %[before=\startpagecomment,after=\stoppagecomment]
> \def\startNotes{\startpagecomment}
> \def\stopNotes{\stoppagecomment}
>
> \starttext
> \input knuth
> \startpagecomment
> Hello
> \stoppagecomment
> \page
> \input tufte
> \startNotes
> Testing
> \stopNotes
> \stoptext
>
>
> This snippet does not compile.  Page comments work when I use the 
> commands \startpagecomment and \stoppagecomment directly (like in the 
> first page), but when I invoke via macros (as in the second page), 
> ConTeXt produces errors.
>
> What is wrong there?

The pagecomment environment uses the buffer mechanism to store the content
of the environment but a limitation of buffers is that you can't put 
them into other
commands because the scan for a certain delimiter, e.g. \stoppagecomment.

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: problems with "pagecomment"
  2019-04-27  5:24 ` Wolfgang Schuster
@ 2019-04-27 10:44   ` Mohammad Hossein Bateni
  0 siblings, 0 replies; 3+ messages in thread
From: Mohammad Hossein Bateni @ 2019-04-27 10:44 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: mailing list for ConTeXt users


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

I see.  Thanks for the explanation.

So the following works:

-------------------------------
\unprotect
\setvalue{startNotes}%
  {\global\settrue\c_page_comment_enabled
   \grabbufferdatadirect{pagecomment}{startpagecomment}{stopNotes}}
\protect
\def\stopNotes{}
------------------------------

What does the second argument to \grabbufferdatadirect mean?  Nothing
changes when I modify that.

The point of redefining the pagecomment environment for me was to style it
a bit: add \righttoleft at the beginning, and surround the content in
startstopnarrower.  How can I inject prepend/append to a buffer's content?

The solution I can think of is to use a different buffer
"pagecomment_internal" in the above definition, and then build buffer
"pagecomment" using that.

Thanks,
~MHB

On Sat, Apr 27, 2019 at 1:24 AM Wolfgang Schuster <
wolfgang.schuster.lists@gmail.com> wrote:

> Mohammad Hossein Bateni schrieb am 27.04.2019 um 05:16:
> > Hi,
> >
> > Look at the following MWE:
> >
> >
> > \setuppagecomment[state=start,location=right]
> > %\definestartstop[Notes]
> > %[before=\startpagecomment,after=\stoppagecomment]
> > \def\startNotes{\startpagecomment}
> > \def\stopNotes{\stoppagecomment}
> >
> > \starttext
> > \input knuth
> > \startpagecomment
> > Hello
> > \stoppagecomment
> > \page
> > \input tufte
> > \startNotes
> > Testing
> > \stopNotes
> > \stoptext
> >
> >
> > This snippet does not compile.  Page comments work when I use the
> > commands \startpagecomment and \stoppagecomment directly (like in the
> > first page), but when I invoke via macros (as in the second page),
> > ConTeXt produces errors.
> >
> > What is wrong there?
>
> The pagecomment environment uses the buffer mechanism to store the content
> of the environment but a limitation of buffers is that you can't put
> them into other
> commands because the scan for a certain delimiter, e.g. \stoppagecomment.
>
> Wolfgang
>
>

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

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

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-27 10:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-27  3:16 problems with "pagecomment" Mohammad Hossein Bateni
2019-04-27  5:24 ` Wolfgang Schuster
2019-04-27 10:44   ` Mohammad Hossein Bateni

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