ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Automating a letter module style
@ 2002-11-21  0:00 Nigel King
  2002-11-21 14:40 ` John Culleton
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Nigel King @ 2002-11-21  0:00 UTC (permalink / raw)


I have been using a letter format and gradually improving the macro format
and style each time I use it. It makes a lot of use of backgrounds to set
elements on the page. I would like to improve some other elements.
The target structure of a letter source would be as follows.
\usemodule[lett-01]
\setupletter
[address=...\\...\\..,
signature=Nigel King,
thedate=\currentdate,
......] 
\starttext
\opening
Further to your ...... %main letter content

\closing[Yours ...,]
\encl[...]
\cc[...]
\ps[...]
\stoptext

A lot of this works quite well using the following typical "macros" in
u-lett-01.tex typical parts of which are shown below
----------
\unprotect
\def\setupletter{%
  \dosingleargument\dosetupletter}
\def\dosetupletter[#1]{%
  \getparameters[letter@][#1]}
Some other \defs....
\def\opening{
\definelayer
  [letter@layer@toaddress]
\setlayer
  [letter@layer@toaddress]
  [x=\backspace,y=50mm]
  {\framed
    [height=37.6mm,
    width=89mm,
    frame=on,
    align={right,lohi},
    strut=no,
    offset=overlay]
    {\getvalue{letter@toaddress}}}
\setupbackgrounds
  [page]
  [background={letter@layer@toaddress}]
}% end of opening
\protect
-----------

The main problems that I have follow;
1. \usemodule[lett-01] has to be \input u-lett-01 because the definitions
are not recognized properly otherwise. "no macros found", I have not found
any documentation on macros. I had a look at m-chart.tex but it was too long
and complicated to get the simple idea from. Is there another
2. I cannot find a way of defining elements which are effectively in the
running text like \openingline=Dear ..., in the setupletter because
\getvalue{letter@opening} seems not to pick up the value. A similar problem
occurs with closing which has a number of formatting constraints which
deosn't want to be seen in the letter source. The only way I have been able
to achieve the objective has been to use the following type of construct.
In the source letter
\signature[Nigel King]
In the module
\def\signature[#1]{\def\fromsig{#1}}
\def\closing[#1]{\par\framed[width=\textwidth,frame=off]{\rbox{
  \blank[2*big] #1 \blank[6*big] \fromsig\par}}}

Any help would be much appreciated.
-- 
Nigel

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

* Re: Automating a letter module style
  2002-11-21  0:00 Automating a letter module style Nigel King
@ 2002-11-21 14:40 ` John Culleton
  2002-11-21 15:23 ` Bruce D'Arcus
  2002-11-22 23:14 ` Automating a letter module style Hans Hagen
  2 siblings, 0 replies; 14+ messages in thread
From: John Culleton @ 2002-11-21 14:40 UTC (permalink / raw)


On Thursday 21 November 2002 12:00 am, Nigel King wrote:
> I have been using a letter format and gradually improving the macro
> format and style each time I use it. It makes a lot of use of
> backgrounds to set elements on the page. I would like to improve some
> other elements. 
(snip)

You may find some useful ideas in Knuth's letterformat (see the
TeXbook) and also in the TeXsis macros. I use a variant on
letterformat for single letters and an amalgam of TeXsis and
letterformat for form letters. 

FWIW

John Culleton
Able Indexers and Typesetters 
Rowse Reviews
Culleton Editorial Services
http://wexfordpress.com

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

* Re: Automating a letter module style
  2002-11-21  0:00 Automating a letter module style Nigel King
  2002-11-21 14:40 ` John Culleton
@ 2002-11-21 15:23 ` Bruce D'Arcus
  2002-11-22 22:31   ` Hans Hagen
  2002-11-22 23:14 ` Automating a letter module style Hans Hagen
  2 siblings, 1 reply; 14+ messages in thread
From: Bruce D'Arcus @ 2002-11-21 15:23 UTC (permalink / raw)



This brings up an issue that periodically comes up, but I don't 
remember how this went the last time:

I would really love to have a section of the ConTeXt website where I 
could access a few sample documents and modules created by more 
knowledgeable users.  I often find trying to figure out how to do 
something from the manuals a frustrating experience, and the samples 
that are available are too limited...

With respect to modules, I'm thinking basic things like letters, 
articles, books, and presentations.

Bruce

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

* Re: Automating a letter module style
  2002-11-21 15:23 ` Bruce D'Arcus
@ 2002-11-22 22:31   ` Hans Hagen
  2002-11-22 23:40     ` Bruce D'Arcus
  0 siblings, 1 reply; 14+ messages in thread
From: Hans Hagen @ 2002-11-22 22:31 UTC (permalink / raw)


At 10:23 AM 11/21/2002 -0500, Bruce D'Arcus wrote:

>This brings up an issue that periodically comes up, but I don't remember 
>how this went the last time:
>
>I would really love to have a section of the ConTeXt website where I could 
>access a few sample documents and modules created by more knowledgeable 
>users.  I often find trying to figure out how to do something from the 
>manuals a frustrating experience, and the samples that are available are 
>too limited...

no problem, but someone should collect them, package them in a zip, and 
provide a nice readme on how to process them

>With respect to modules, I'm thinking basic things like letters, articles, 
>books, and presentations.

some day ... (will be part of another context gimmick to come)

Hans
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                        information: http://www.pragma-ade.com/roadmap.pdf
                     documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------

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

* Re: Automating a letter module style
  2002-11-21  0:00 Automating a letter module style Nigel King
  2002-11-21 14:40 ` John Culleton
  2002-11-21 15:23 ` Bruce D'Arcus
@ 2002-11-22 23:14 ` Hans Hagen
  2 siblings, 0 replies; 14+ messages in thread
From: Hans Hagen @ 2002-11-22 23:14 UTC (permalink / raw)


At 12:00 AM 11/21/2002 +0000, Nigel King wrote:

concerning modules, why not make it an environment?

>2. I cannot find a way of defining elements which are effectively in the
>running text like \openingline=Dear ..., in the setupletter because
>\getvalue{letter@opening} seems not to pick up the value. A similar problem
>occurs with closing which has a number of formatting constraints which
>deosn't want to be seen in the letter source. The only way I have been able
>to achieve the objective has been to use the following type of construct.
>In the source letter
>\signature[Nigel King]
>In the module
>\def\signature[#1]{\def\fromsig{#1}}
>\def\closing[#1]{\par\framed[width=\textwidth,frame=off]{\rbox{
>   \blank[2*big] #1 \blank[6*big] \fromsig\par}}}
>
>Any help would be much appreciated.

The best way to deal with variables is the following:

\setvariables
   [letter:opening]
   [name=...,
    date=...]

\setvariables
   [letter:closing]
   [name=...,
    whatver=...]

....

\getvariable{letter:opening}{name}

This way there is no need for the get parameter stuff and you can group 
your variables; this mechanism also bypasses the multi lingual inferface, 
since this is what is troubling you: getparameter remaps tags to the low 
level names. You get better error messages for free.

Hans
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                        information: http://www.pragma-ade.com/roadmap.pdf
                     documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------

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

* Re: Automating a letter module style
  2002-11-22 22:31   ` Hans Hagen
@ 2002-11-22 23:40     ` Bruce D'Arcus
  2002-11-25 16:58       ` Hans Hagen
  0 siblings, 1 reply; 14+ messages in thread
From: Bruce D'Arcus @ 2002-11-22 23:40 UTC (permalink / raw)



On Friday, November 22, 2002, at 05:31 PM, Hans Hagen wrote:

>> With respect to modules, I'm thinking basic things like letters, 
>> articles, books, and presentations.
>
> some day ... (will be part of another context gimmick to come)

Don't tease Hans; what "gimmick"?   :-)

Bruce

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

* Re: Automating a letter module style
  2002-11-22 23:40     ` Bruce D'Arcus
@ 2002-11-25 16:58       ` Hans Hagen
  2002-11-25 17:10         ` Bruce D'Arcus
  2002-11-29 11:36         ` metafun and \input graph Hartmut Henkel
  0 siblings, 2 replies; 14+ messages in thread
From: Hans Hagen @ 2002-11-25 16:58 UTC (permalink / raw)


At 06:40 PM 11/22/2002 -0500, Bruce D'Arcus wrote:

>On Friday, November 22, 2002, at 05:31 PM, Hans Hagen wrote:
>
>>>With respect to modules, I'm thinking basic things like letters, 
>>>articles, books, and presentations.
>>
>>some day ... (will be part of another context gimmick to come)
>
>Don't tease Hans; what "gimmick"?   :-)

a user interface to processing tex docs, based on pdf, controlled by a 
tex-applet; think of entering your letter text and data in a form, pushing 
a button and getting a letter back (this is just one application, we also 
use it to make enveloppes and alike); click and point layout options, etc; 
works quite well; to tease you again, this is just part of a bigger game -)

Hans

-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                        information: http://www.pragma-ade.com/roadmap.pdf
                     documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------

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

* Re: Automating a letter module style
  2002-11-25 16:58       ` Hans Hagen
@ 2002-11-25 17:10         ` Bruce D'Arcus
  2002-11-25 17:23           ` Hans Hagen
  2002-11-29 11:36         ` metafun and \input graph Hartmut Henkel
  1 sibling, 1 reply; 14+ messages in thread
From: Bruce D'Arcus @ 2002-11-25 17:10 UTC (permalink / raw)



On Monday, November 25, 2002, at 11:58 AM, Hans Hagen wrote:

> a user interface to processing tex docs, based on pdf, controlled by a 
> tex-applet; think of entering your letter text and data in a form, 
> pushing a button and getting a letter back (this is just one 
> application, we also use it to make enveloppes and alike); click and 
> point layout options, etc; works quite well; to tease you again, this 
> is just part of a bigger game -)

Hmm...interesting indeed!  Just to prod a bit more, though, what kind 
of UI, and entered into what kind "form"?  I won't ask about the 
"bigger game" :-)

This may or may not be relevant, but any chance as you work on this 
stuff XML might enter the picture as an alternate coding approach?

Bruce

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

* Re: Automating a letter module style
  2002-11-25 17:10         ` Bruce D'Arcus
@ 2002-11-25 17:23           ` Hans Hagen
  0 siblings, 0 replies; 14+ messages in thread
From: Hans Hagen @ 2002-11-25 17:23 UTC (permalink / raw)


At 12:10 PM 11/25/2002 -0500, Bruce D'Arcus wrote:

>On Monday, November 25, 2002, at 11:58 AM, Hans Hagen wrote:
>
>>a user interface to processing tex docs, based on pdf, controlled by a 
>>tex-applet; think of entering your letter text and data in a form, 
>>pushing a button and getting a letter back (this is just one application, 
>>we also use it to make enveloppes and alike); click and point layout 
>>options, etc; works quite well; to tease you again, this is just part of 
>>a bigger game -)
>
>Hmm...interesting indeed!  Just to prod a bit more, though, what kind of 
>UI, and entered into what kind "form"?  I won't ask about the "bigger game" :-)

i let tex generate a document with fields that a user can fill in; that way 
you get a platform independent interface; the submits this data to a 
servlet, which, based on the embedded request, takes some action; after a 
while a pdf doc is send back; the document is (yet) coded in tex (rather 
high level interface macros), the request specific scripts are coded in xml 
as is the whole environment in which this takes place; communication takes 
place in xml as well.

[i may add an xml user interface to the tex part as well, when i'm in the mood]

>This may or may not be relevant, but any chance as you work on this stuff 
>XML might enter the picture as an alternate coding approach?

xml already has entered the picture since we use it for processing tex and 
xml docs

Hans

-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                        information: http://www.pragma-ade.com/roadmap.pdf
                     documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------

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

* metafun and \input graph
  2002-11-25 16:58       ` Hans Hagen
  2002-11-25 17:10         ` Bruce D'Arcus
@ 2002-11-29 11:36         ` Hartmut Henkel
  2002-11-29 12:53           ` Nigel King
  2002-11-29 12:58           ` Hans Hagen
  1 sibling, 2 replies; 14+ messages in thread
From: Hartmut Henkel @ 2002-11-29 11:36 UTC (permalink / raw)


When I try to run some plain MetaPost foo.mp file, which includes an
\input graph command, through mptopdf, e. g. by the call `mptopdf
foo.mp' fails. Check with texexec --mptex foo.mp shows

! Redundant equation.
<to be read again>
                   ;
l.148 Ten_to0=1;
                 Ten_to1=10; Ten_to2=100; Ten_to3=1000; Ten_to4=10000;

These are redundant, since the lines appear first in mp-form.mp and then
are again loaded from graph.mp.

Is there a way to use mptopdf for conversion of plain/non-metafun
MetaPost files, e. g. a switch for mptopdf?

Greetings Hartmut

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

* Re: metafun and \input graph
  2002-11-29 11:36         ` metafun and \input graph Hartmut Henkel
@ 2002-11-29 12:53           ` Nigel King
  2002-11-29 12:58           ` Hans Hagen
  1 sibling, 0 replies; 14+ messages in thread
From: Nigel King @ 2002-11-29 12:53 UTC (permalink / raw)


The beginning of my files typically have something like this before the
first beginfig();

input metafun ;
input boxes;

verbatimtex
\setupcolors[state=start]
\setupencoding[default=texnansi]
\setupbodyfont[pos,11pt,ss]
\def\f#1{\framed[frame=off,align=middle]{#1}}
\starttext
\bf\ss
etex

input graph
        init_numbers
                (textext(btex $-$ etex),
                textext(btex $1$ etex),
                textext(btex ${\times}10$ etex),
                textext(btex ${}^-$ etex),
                textext(btex ${}^2$ etex));
        Fe_base := textext(btex $10$ etex) ;

> When I try to run some plain MetaPost foo.mp file, which includes an
> \input graph command, through mptopdf, e. g. by the call `mptopdf
> foo.mp' fails. Check with texexec --mptex foo.mp shows
> 
> ! Redundant equation.
> <to be read again>
>                  ;
> l.148 Ten_to0=1;
>                Ten_to1=10; Ten_to2=100; Ten_to3=1000; Ten_to4=10000;
> 
> These are redundant, since the lines appear first in mp-form.mp and then
> are again loaded from graph.mp.
> 
> Is there a way to use mptopdf for conversion of plain/non-metafun
> MetaPost files, e. g. a switch for mptopdf?

I hope this helps it took me a long time to get the this point!

I (with help from many others) wrote the following code for iTeXMax
compilation. For other systems ${iTMInput} is the basename of the metapost
source file.

setenv TEX texexec
mpost ${iTMInput}
texexec --pdf --fig=c ${iTMInput}.[0-9] ${iTMInput}.[0-9][0-9]
${iTMInput}.[0-9][0-9][0-9]
mv texexec.pdf ${iTMInput}.pdf

This produces the files to be referenced in a ConTeXt document and a pdf
with all the pictures to review them.

Nigel

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

* Re: metafun and \input graph
  2002-11-29 11:36         ` metafun and \input graph Hartmut Henkel
  2002-11-29 12:53           ` Nigel King
@ 2002-11-29 12:58           ` Hans Hagen
  2002-11-29 16:55             ` Hartmut Henkel
  1 sibling, 1 reply; 14+ messages in thread
From: Hans Hagen @ 2002-11-29 12:58 UTC (permalink / raw)


At 12:36 PM 11/29/2002 +0100, you wrote:
>When I try to run some plain MetaPost foo.mp file, which includes an
>\input graph command, through mptopdf, e. g. by the call `mptopdf
>foo.mp' fails. Check with texexec --mptex foo.mp shows
>
>! Redundant equation.
><to be read again>
>                    ;
>l.148 Ten_to0=1;
>                  Ten_to1=10; Ten_to2=100; Ten_to3=1000; Ten_to4=10000;
>
>These are redundant, since the lines appear first in mp-form.mp and then
>are again loaded from graph.mp.

i'll send you a file for testing,

mptopdf --raw yourfile.mp


>Is there a way to use mptopdf for conversion of plain/non-metafun
>MetaPost files, e. g. a switch for mptopdf?

mp to pdf will convert any mp output file into pdf

Hans
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                        information: http://www.pragma-ade.com/roadmap.pdf
                     documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------

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

* Re: metafun and \input graph
  2002-11-29 12:58           ` Hans Hagen
@ 2002-11-29 16:55             ` Hartmut Henkel
  2002-11-29 17:12               ` Hans Hagen
  0 siblings, 1 reply; 14+ messages in thread
From: Hartmut Henkel @ 2002-11-29 16:55 UTC (permalink / raw)


Hi Hans,

the mptopdf.pl --raw from your mail works perfect. Pure magic! (tested
with teTeX-021116)

Thanks a lot!

Ah, one has to give the .mp extension explicitely. Otherwise it says
MPtoPDF 1.2 : no filename matches foo.*

Greetings Hartmut


On Fri, 29 Nov 2002, Hans Hagen wrote:

> At 12:36 PM 11/29/2002 +0100, you wrote:
> >When I try to run some plain MetaPost foo.mp file, which includes an
> >\input graph command, through mptopdf, e. g. by the call `mptopdf
> >foo.mp' fails. Check with texexec --mptex foo.mp shows
> >
> >! Redundant equation.
> ><to be read again>
> >                    ;
> >l.148 Ten_to0=1;
> >                  Ten_to1=10; Ten_to2=100; Ten_to3=1000; Ten_to4=10000;
> >
> >These are redundant, since the lines appear first in mp-form.mp and then
> >are again loaded from graph.mp.
>
> i'll send you a file for testing,
>
> mptopdf --raw yourfile.mp
>
>
> >Is there a way to use mptopdf for conversion of plain/non-metafun
> >MetaPost files, e. g. a switch for mptopdf?
>
> mp to pdf will convert any mp output file into pdf
>
> Hans

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

* Re: metafun and \input graph
  2002-11-29 16:55             ` Hartmut Henkel
@ 2002-11-29 17:12               ` Hans Hagen
  0 siblings, 0 replies; 14+ messages in thread
From: Hans Hagen @ 2002-11-29 17:12 UTC (permalink / raw)


At 05:55 PM 11/29/2002 +0100, you wrote:
>Hi Hans,
>
>the mptopdf.pl --raw from your mail works perfect. Pure magic! (tested
>with teTeX-021116)
>
>Thanks a lot!
>
>Ah, one has to give the .mp extension explicitely. Otherwise it says
>MPtoPDF 1.2 : no filename matches foo.*

right, the main purpose of mptopdf is the conversion, the mp processing is 
an extra

Hans
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                        information: http://www.pragma-ade.com/roadmap.pdf
                     documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------

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

end of thread, other threads:[~2002-11-29 17:12 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-21  0:00 Automating a letter module style Nigel King
2002-11-21 14:40 ` John Culleton
2002-11-21 15:23 ` Bruce D'Arcus
2002-11-22 22:31   ` Hans Hagen
2002-11-22 23:40     ` Bruce D'Arcus
2002-11-25 16:58       ` Hans Hagen
2002-11-25 17:10         ` Bruce D'Arcus
2002-11-25 17:23           ` Hans Hagen
2002-11-29 11:36         ` metafun and \input graph Hartmut Henkel
2002-11-29 12:53           ` Nigel King
2002-11-29 12:58           ` Hans Hagen
2002-11-29 16:55             ` Hartmut Henkel
2002-11-29 17:12               ` Hans Hagen
2002-11-22 23:14 ` Automating a letter module style Hans Hagen

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