ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <wolfgang.schuster@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Annotation Module
Date: Sun, 18 Nov 2012 21:14:12 +0100	[thread overview]
Message-ID: <740E32A5-B8EF-4D13-9980-28F638FA86C9@gmail.com> (raw)
In-Reply-To: <50A936BE.9050002@mmnetz.de>


Am 18.11.2012 um 20:27 schrieb H. Özoguz <h.oezoguz@mmnetz.de>:

> My question to your module: How can I customize the
> 
> \startannotation \stopannotation enovirnment,
> 
> s.t. it does not start with ", but with another symbol (or maybe without any symbol)?

The annotation module let you define a command/environment to collect text
and format it in (nearly) any way you want, there is no distinction between
\command{…} and \startcommand …\stopcommand.


Copy this example and process it with context:

\usemodule[annotation]

\setuplayout
  [backspace=6cm,
   cutspace=2cm,
   width=middle]

\setupannotation[color=blue]

% one + two

\defineannotation[one][alternative=paragraph]
\defineannotation[two][alternative=text]

% three

\define[2]\ThreeCommand
  {\startframedtext[middle]
   #2
   \stopframedtext}

\defineannotation[three][alternative=command,command=\ThreeCommand]

% four

\startsetups [annotation:four]
  \startframedtext[width=broad,framecolor=red]
  \placeannotationcontent
  \doifsomething{\annotationparameter{author}}{\wordright{\annotationparameter{author}}}
  \stopframedtext
\stopsetups

\defineannotationalternative[four][renderingsetup=annotation:four]

\defineannotation[four][alternative=four]

\starttext

\input knuth
\one{\input ward }
\input knuth
\starttwo\input ward \stoptwo
\input knuth
\three{\input ward }
\input knuth
\startfour[author=Ward]\input ward \stopfour
\input knuth

\stoptext


In the example above I define four annotation command, while the first two
use predefined alternatives the third and fourth use ones I define in the document.

The command “three” uses the “command” alternative which expects a command
with two parameters, the first parameter can be used to print a title with the content
of the “text” and “title” keys (not used in my example) and the second parameters
prints the content of the command/environment.

The “four” command (you could also have used \four[author=Ward]{\input ward } in
the document) uses a different approach to define a customized layout. First you
create a new alternative with \defineannotationalternative where you specify a setup.
The setup itself is created with \startsetups … \stopsetups where you can use
all context commands you like. Values from \setupannotation or optional arguments
for \four or \startfour can be accessed with \annoationparameter{<key>}.

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
___________________________________________________________________________________


      reply	other threads:[~2012-11-18 20:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.194.1353007953.2161.ntg-context@ntg.nl>
2012-11-16  8:15 ` ntg-context Digest, Vol 101, Issue 42 "H. Özoguz"
2012-11-16  9:13 ` Annotation Module "H. Özoguz"
2012-11-16 13:32   ` Wolfgang Schuster
2012-11-18 19:27 ` "H. Özoguz"
2012-11-18 20:14   ` Wolfgang Schuster [this message]

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=740E32A5-B8EF-4D13-9980-28F638FA86C9@gmail.com \
    --to=wolfgang.schuster@gmail.com \
    --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).