ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Translating from LaTeX to ConTeXt: environments
@ 2000-10-05 16:50 Giuseppe Bilotta
  2000-10-06 19:20 ` Berend de Boer
  0 siblings, 1 reply; 9+ messages in thread
From: Giuseppe Bilotta @ 2000-10-05 16:50 UTC (permalink / raw)


As I already said in a previous post, I'm trying to convert some LaTeX files
to ConTeXt. The next problem I'm facing is:

What's the ConTeXt equivalent of a (generic) LaTeX environment? To be
precise, I'm looking for an equivalent of the "verse" LaTeX environment. I
would assume that  and appropriate \defineparagraphs (with n=1) is the
answer. The problem is to set the paragraphs appropriately: I need to nest a
\startnarrower ... \stopnarrower (to ensure narrower margins) and a
\startlines ... \stoplines. But it does not seem to work:

\def\SongStart{\startnarrower[2*left,right]\startlines}
\def\SongStop{\stoplines\stopnarrowe}
\defineparagraphs[song][n=1]
\setupparagraphs[song][style=italic,before=\SongStart,after=\SongStop]

gives an incomplete conditional error (the same also swapping narrower and
lines).
Does anybody know a solution?

One more question: is there an easy way to define a command (\def) that
accepts an optional parameter? I mean:

\command{argument}

does one thing,

\command[optional]{argument}

does another, depending on [optional]. (btw, Hans, this is what I meant when
asking for a "programmer's reference").

Giuseppe Bilotta


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

* Re: Translating from LaTeX to ConTeXt: environments
  2000-10-05 16:50 Translating from LaTeX to ConTeXt: environments Giuseppe Bilotta
@ 2000-10-06 19:20 ` Berend de Boer
  2000-10-06 20:33   ` Giuseppe Bilotta
  0 siblings, 1 reply; 9+ messages in thread
From: Berend de Boer @ 2000-10-06 19:20 UTC (permalink / raw)
  Cc: ConTeXt

Giuseppe Bilotta wrote:

> What's the ConTeXt equivalent of a (generic) LaTeX environment? 

Use \definestartstop.

Groetjes,

Berend. (-:


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

* Re: Translating from LaTeX to ConTeXt: environments
  2000-10-06 19:20 ` Berend de Boer
@ 2000-10-06 20:33   ` Giuseppe Bilotta
  2000-10-08 14:08     ` Giuseppe Bilotta
  0 siblings, 1 reply; 9+ messages in thread
From: Giuseppe Bilotta @ 2000-10-06 20:33 UTC (permalink / raw)
  Cc: ConTeXt

Thank you very much. I really hope that the complete english manual comes
out soon. I think I didn't find anything appropriate on the (current?) beta
manual version ... I'll give a better look.

Giuseppe Bilotta

----- Original Message -----
From: Berend de Boer <berend@pobox.com>
To: Giuseppe Bilotta <oblomov@freemail.it>
Cc: ConTeXt <ntg-context@ntg.nl>
Sent: Friday, October 06, 2000 9:20 PM
Subject: Re: Translating from LaTeX to ConTeXt: environments

> Giuseppe Bilotta wrote:
>
> > What's the ConTeXt equivalent of a (generic) LaTeX environment?
>
> Use \definestartstop.
>
> Groetjes,
>
> Berend. (-:
>


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

* Re: Translating from LaTeX to ConTeXt: environments
  2000-10-06 20:33   ` Giuseppe Bilotta
@ 2000-10-08 14:08     ` Giuseppe Bilotta
  2000-10-13 19:36       ` Hraban
  0 siblings, 1 reply; 9+ messages in thread
From: Giuseppe Bilotta @ 2000-10-08 14:08 UTC (permalink / raw)


So, I gave a look at the \definestartstop command, and tried it. It _is_
what I'm looking for, but I lack a full manual to understand exactly how to
fine tune it to my needs.

I trying to write a few commands that should work, e.g., as the color
command; I then need:

1) a "simple" version that works like

some text\Rev{text in a particular color to show revision}

some text\Rev[comment to go in margin]{text like in "normal" \type{\Rev}}

(I managed to do this, by lettin \Rev just scan for the following char and
choose depending on it being [ or not)

2) a "full" version that works like

\startRev
lots of paragraphs in revision color

lots of paragraphs in revision color

lots of paragraphs in revision color
\stopRev

\startRev[comment to go in margin]
lots of paragraphs in revision color

lots of paragraphs in revision color

lots of paragraphs in revision color
\stopRev

I can't seem to manage this. Anybody has any ideas? Follows the code I
managed to get to (but doesn't seem to work properly. why?):

\def\RevNote#1{\inmargin{\tfxx \color[blue]{#1}}}
\def\RevWithComment[#1]#2{\leavevmode%
    \RevNote{#1}%
    \color[red]{#2}%
}
\def\RevWithoutComment#1{\leavevmode%
    \color[red]{#1}%
}
\def\Rev{\doifnextcharelse{[}{\RevWithComment}{\RevWithoutComment}}

\def\RevisionsStart{\startcolor[red]\relax}
\def\RevisionsStop{\stopcolor}

\definestartstop[revisions][command=\RevNote,before=\RevisionsStart,after=\R
evisionsStop]

(the full name is revisions and not \Rev because the file is somewhat
converted from LaTeX and I needed different names)

Giuseppe Bilotta


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

* Re: Translating from LaTeX to ConTeXt: environments
  2000-10-08 14:08     ` Giuseppe Bilotta
@ 2000-10-13 19:36       ` Hraban
       [not found]         ` <001c01c035db$85ca1fe0$01460e97@nuovo>
  2000-10-15 20:17         ` Hans Hagen
  0 siblings, 2 replies; 9+ messages in thread
From: Hraban @ 2000-10-13 19:36 UTC (permalink / raw)


You looked for a verse environment, right?

This is my try, made with help of Hans:

\definestartstop
	[verse]
	[before={\blank%
			\setuplines[indenting=always]%
			\startalignment[right]\startlines},
	after={\stoplines%
			\stopalignment%
			\blank}]

"right" aligned is "raggedright", that is, left aligned.
somewhat confusing... ;-)

BTW: You named your environment "song":
Do you have experience with music setting via MusiXTeX, Lilypond... ?

Did anyone try to combine some music macros with ConTeXt?
(Will be my next task after completing this &%$#*& book...)

-- 
Grüßlis vom Hraban!
---
http://angerweit.tikon.ch/


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

* Re: Translating from LaTeX to ConTeXt: environments
       [not found]         ` <001c01c035db$85ca1fe0$01460e97@nuovo>
@ 2000-10-14 20:45           ` Hraban
  2000-10-15 20:11             ` Hans Hagen
  0 siblings, 1 reply; 9+ messages in thread
From: Hraban @ 2000-10-14 20:45 UTC (permalink / raw)


Giuseppe Bilotta wrote:
> The main problem (as Hans suggested, too) is that, while using LaTeX, I had
> an interface that is not "compatible" with ConTeXt (I used [...] to insert
> optional test). How could I do in a ConTeXt-like manner? My startstop needs
> to take at least one argument (text), and optionally another argument (more
> text). The "more text", if present, should go in margin, "text" is typeset
> alongside the normal body text, all with different colors. The main problem
> seems to be that \inmargin does not accept \pars in it, so I need to use \\
> instead of \pars. The second problem: how to know if I passed two {...}{...}
> or only one {...} argument to the macro? I found that with [...] this could
> be achieved wtih complexorsimple; how to do it with {...}?

Sorry, I'm just a ConTeXt beginner, also in LaTeX. I started with LaTeX
and changed over to ConTeXt, because I need grid setting.
"Normally" I work with QuarkXPress and FreeHand...

I solved a similar problem (quotation with footnote) defining separate
\StartSomething and \StopSomething. One of this (or both) could take
your text argument. Perhaps is would be a solution to work with two
args and leave one of them empty, if not needed.

(Sorry, I'm not able to use if/then constructs.)

-- 
Grüßlis vom Hraban!
---
http://angerweit.tikon.ch/


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

* Re: Translating from LaTeX to ConTeXt: environments
  2000-10-14 20:45           ` Hraban
@ 2000-10-15 20:11             ` Hans Hagen
  0 siblings, 0 replies; 9+ messages in thread
From: Hans Hagen @ 2000-10-15 20:11 UTC (permalink / raw)
  Cc: Giuseppe Bilotta, ConTeXt

At 10:45 PM 10/14/00 +0200, Hraban wrote:
>Giuseppe Bilotta wrote:
>> The main problem (as Hans suggested, too) is that, while using LaTeX, I had
>> an interface that is not "compatible" with ConTeXt (I used [...] to insert
>> optional test). How could I do in a ConTeXt-like manner? My startstop needs
>> to take at least one argument (text), and optionally another argument (more
>> text). The "more text", if present, should go in margin, "text" is typeset
>> alongside the normal body text, all with different colors. The main problem
>> seems to be that \inmargin does not accept \pars in it, so I need to use \\
>> instead of \pars. The second problem: how to know if I passed two
{...}{...}
>> or only one {...} argument to the macro? I found that with [...] this could
>> be achieved wtih complexorsimple; how to do it with {...}?
>
>Sorry, I'm just a ConTeXt beginner, also in LaTeX. I started with LaTeX
>and changed over to ConTeXt, because I need grid setting.
>"Normally" I work with QuarkXPress and FreeHand...
>
>I solved a similar problem (quotation with footnote) defining separate
>\StartSomething and \StopSomething. One of this (or both) could take
>your text argument. Perhaps is would be a solution to work with two
>args and leave one of them empty, if not needed.

I may consider an optional command that picks up args there

>(Sorry, I'm not able to use if/then constructs.)

what do you mean? Did you read syst-gen.tex? There's a lot of \doifelse there

\doifelse{angerweit}{giuseppe}
  {this can't happen}
  {indeed, different names}

These commands are rather robust for embedded [context] commands which, btw
is what context's protection mechanism is about: handling commands in tests.  

Hans
-------------------------------------------------------------------------
                                                  Hans Hagen | PRAGMA ADE
                      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
-------------------------------------------------------------------------


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

* Re: Translating from LaTeX to ConTeXt: environments
  2000-10-13 19:36       ` Hraban
       [not found]         ` <001c01c035db$85ca1fe0$01460e97@nuovo>
@ 2000-10-15 20:17         ` Hans Hagen
  2000-10-16 18:49           ` music typesetting Hraban
  1 sibling, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2000-10-15 20:17 UTC (permalink / raw)
  Cc: ConTeXt

At 09:36 PM 10/13/00 +0200, Hraban wrote:
>You looked for a verse environment, right?
>
>This is my try, made with help of Hans:
>
>\definestartstop
>	[verse]
>	[before={\blank%
>			\setuplines[indenting=always]%
>			\startalignment[right]\startlines},
>	after={\stoplines%
>			\stopalignment%
>			\blank}]

no % needed after a command and since you are in so called vmode, the %
after ] are also not needed. Makes the code more readable.  

>"right" aligned is "raggedright", that is, left aligned.
>somewhat confusing... ;-)

it is confusing unless you know that it stems from \raggedright

>BTW: You named your environment "song":
>Do you have experience with music setting via MusiXTeX, Lilypond... ?

rather minimal, although tex would be pretty good in typesetting minimal music

>Did anyone try to combine some music macros with ConTeXt?

yes, but long ago, i'm still thinking of a metapost thing 

the musixtex interface is not so readable but I seem to have lost the
wrapper i wrote

what is lilypond? 

Hans
-------------------------------------------------------------------------
                                                  Hans Hagen | PRAGMA ADE
                      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
-------------------------------------------------------------------------


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

* music typesetting
  2000-10-15 20:17         ` Hans Hagen
@ 2000-10-16 18:49           ` Hraban
  0 siblings, 0 replies; 9+ messages in thread
From: Hraban @ 2000-10-16 18:49 UTC (permalink / raw)


Hans Hagen wrote:
> >Do you have experience with music setting via MusiXTeX, Lilypond... ?
> rather minimal, although tex would be pretty good in typesetting minimal music
> 
> >Did anyone try to combine some music macros with ConTeXt?
> yes, but long ago, i'm still thinking of a metapost thing

After your inspiring introduction to metapost I believe, that such would
be a very joy to use!

> what is lilypond?

"GNU project music typesetter" is based on TeX, the manual explains how
to use it's "mudela" (music description language) files within LaTeX.
The authors are Han-Wen Nienhuys, Jan Nieuwenhuizen and Adrian Mariano
-- I'm surprised, that there are nederlandse TeX projects you not know
about? ;-)
see http://www.cs.uu.nl/people/hanwen

There was an article about music typesetting programs for Linux in the
german Linux Magazin 7/99. The author, Christoph Dalitz, mentioned also
the MusiXTeX preprocessors MTX and PMX, further Tab for lute tabulatures
that is not TeX based, and some other like Rosegarden and KDE Bach (the
former kooBase).

I had no time to test it yet -- I'm working under MacOS with the great
shareware "Harmony Assistant" by Myriad (France).

-- 
Grüßlis vom Hraban!
---
http://angerweit.tikon.ch/


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

end of thread, other threads:[~2000-10-16 18:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-10-05 16:50 Translating from LaTeX to ConTeXt: environments Giuseppe Bilotta
2000-10-06 19:20 ` Berend de Boer
2000-10-06 20:33   ` Giuseppe Bilotta
2000-10-08 14:08     ` Giuseppe Bilotta
2000-10-13 19:36       ` Hraban
     [not found]         ` <001c01c035db$85ca1fe0$01460e97@nuovo>
2000-10-14 20:45           ` Hraban
2000-10-15 20:11             ` Hans Hagen
2000-10-15 20:17         ` Hans Hagen
2000-10-16 18:49           ` music typesetting Hraban

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