Re: [NTG-context] Putting chord names above the lyrics

2010-01-12 Thread Wolfgang Schuster

Am 12.01.2010 um 03:48 schrieb Vyatcheslav Yatskovsky:

 Hello,
 
 How to put chord names above the lyrics? I have the following in mind

Do you need them at the begin of the line or can you live with a solution
where the chord names are place at the same horizontal position where you
inserted them in your text?

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
___


Re: [NTG-context] Putting chord names above the lyrics

2010-01-12 Thread Mojca Miklavec
On Tue, Jan 12, 2010 at 03:48, Vyatcheslav Yatskovsky wrote:
 Hello,

 How to put chord names above the lyrics? I have the following in mind

 \starttext
 \setupinterlinespace[big]
 \startlines
 \chord[C6]Pardon me, boy

 Is that the Chattanooga choo choo?

 Track twenty-nin\chord[Gadd9/D]e
 Boy, you can gimme a sh\chord[C6]ine

I'm just copy-pasting some of old songs. (written LaTeX):

The following LaTeX code worked perfectly:

\def\Ch#1{%
\makebox[0pt][l]{%
\raisebox{0.4\baselineskip}{\bf #1}%
}}

\setlength{\baselineskip}{1.8\baselineskip}}

\Ch{E}Cvet dišeč z \Ch{H7}jutrom se od\Ch{cis}pre, \par
\Ch{A}sonce od\Ch{E}pira o\Ch{H}či. \par
\Ch{E}Polje z vetrom v \Ch{H7}plesu ziblje \Ch{cis}se. \par
Gos\Ch{E}pod, pov\Ch{H}sod vidim \Ch{E}Te. \par}

In ConTeXt an approximately the same, but unoptimized solution could be

\def\Ch#1{%
\strut\hbox to 0pt{\raisebox{0.8\baselineskip}\hbox{\bf#1}\hss}}
\setupwhitespace[big]

and then the same lyrics.

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
___


Re: [NTG-context] Putting chord names above the lyrics

2010-01-12 Thread Wolfgang Schuster

Am 12.01.2010 um 10:08 schrieb Mojca Miklavec:

 In ConTeXt an approximately the same, but unoptimized solution could be
 
 \def\Ch#1{%
   \strut\hbox to 0pt{\raisebox{0.8\baselineskip}\hbox{\bf#1}\hss}}
 \setupwhitespace[big]
 
 and then the same lyrics.
 
 Mojca

Or he can use my ruby module (where i should put the latest version to the 
garden)
and define himself a command with

\define[1]\Chord{\ruby[position=after,align=left]{}{#1}}

text text tex\Chord{Chord}t text

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
___


Re: [NTG-context] XML - creating a list by hand (mkiv)

2010-01-12 Thread Peter Rolf
Hi,

after a (too short) vacation I'm again trying to make this run.
(btw: inserting in empty root still does not work here)

I have attached a more detailed example (ugly XMP), that shows my
current problems. The result of the operations is saved in xmp.xml.

And here are the problems...

1.
xml.replace(xmp,xml://rdf:Description/dc:creator/rdf:Seq/rdf:li,rdf:lidc:CREATOR1/rdf:li)

wanted:  .. rdf:Seq rdf:lidc:CREATOR1/rdf:li /rdf:Seq ..
I get :  .. rdf:Seq dc:CREATOR1 /rdf:Seq ..

2.
How can I inject a piece of XML (file or text sequence) into the
existing XML tree? I have managed to get a valid lpath expression
(xml://rdf:... does not work), but nothing is inserted.

3.
xml.insert(xmp,xml://rdf:Description/dc:creator/rdf:Seq,rdf:lidc:CREATOR2/rdf:li)

works only, if another (even empty) rdf:li element already exists. If
I delete this element beforehand, the string is inserted after rdf:Seq.

What does
 [comment]={ auto-child replaced by auto-descendant }
mean here?

---
The problems must be examined exclusively (comment other problems to test).

This is all very confusing, aside from the fact, that I'm used to think
in xpath and not lpath. So I'm quite unsure, if this is a ConTeXt
problem or just my ignorance of lpath. Anyhow, no fun ;)


Greetings, Peter

MTXrun | current version: 2010.01.11 14:57
This is LuaTeX, Version beta-0.50.0-201008



Am 22.12.2009 14:33, schrieb Hans Hagen:
 Peter Rolf wrote:
 Am 22.12.2009 14:04, schrieb Hans Hagen:
 Peter Rolf wrote:
 Hi,

 can someone give me a helping hand with the following example. I still
 have no general survey over the XML related code in ConTeXt (donno
 what functions to use). The last time I played with it is one and a
 half year ago and many things have changed (meaning that the old
 examples no longer work).
 http://www.pragma-ade.com/general/manuals/xml-mkiv.pdf

 oeps, how could I missed that one... :(


 I simply want to create a XML document and insert some elements. My
 main problem is to insert an element at root level. I can insert an
 element before and after another element, but not into the element.
 I'm not sure, if I have understood the meaning of the pattern
 parameter correctly. Is this equal to XPath?


 %-
 \starttext

 \startluacode

 local xmp = xml.convert(?xml version='1.0'
 standalone='yes'?\nroot\nbarbla/bar\n/root)
 --xml.before(xmp,/root/bar,subfoo/sub)

 --xml.delete(xmp,bar)
 --xml.inject(xmp,/sub,subbar/sub)-- only for xml-files?

 xml.insert(xmp,/root/bar,sub/)
 --xml.inject(xmp,/*/bar,sub/)
 this works

 sub/sub

 Mhh, not here. When I look into the saved file (test.xml) I get
 
 add some content (i need to look into the empty case (root only))
 
 ?xml version='1.0' standalone='yes'?
 root
 barbla/barerrorinvalid xml file - unparsed text/error
 /root


 But I guess that the linked PDF will give all the answers I need.
 
 the most important change is that we now can have many handlers; when
 you are inside tex and want to manipulate xml without piping to tex, you
 need the xml:// path prefix but the manual mentions this
 
 also, there are some tracing options that can be handy
 
 Hans
 
 
 -
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | fax: 038 477 53 74 | 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
 ___
 
 

\starttext

\enabletrackers[xml.parse]
%\enabletrackers[xml.path] 
%\enabletrackers[xml.profile] -- exclusive
%\enabletrackers[xml.entities]

\startluacode

local xmp = xml.load(xmp-default.xml)

-- 1. replace empty rdf:li/; (results in dc:CREATOR1 without rdf:li tags)
xml.replace(xmp,xml://rdf:Description/dc:creator/rdf:Seq/rdf:li,rdf:lidc:CREATOR1/rdf:li)
-- 2. inject XML sequence; (how?)
--xml.inject 
(xmp,xml:///rdf:Description/dc:creator/rdf:Seq,rdf:lidc:CREATOR1/rdf:li)

-- delete the first rdf:li entry
--xml.delete(xmp,xml://rdf:Description/dc:creator/rdf:Seq/rdf:li)
-- 3. insert element into rdf:Seq; (only after/before, but not into empty)
--xml.insert 
(xmp,xml:///rdf:Description/dc:creator/rdf:Seq,rdf:lidc:CREATOR2/rdf:li)


xml.save(xmp,xmp.xml)

\stopluacode
\null

\stoptext
x:xmpmeta xmlns:x=adobe:ns:meta/
rdf:RDF xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#;
rdf:Description rdf:about= 

Re: [NTG-context] ntg-context Digest, Vol 67, Issue 18

2010-01-12 Thread Vyatcheslav Yatskovsky

Thanks for answers, friends!

I don't have ruby installed, so I try Mojca solution.

It works perfectly (thanks!), except I need to wrap the lyrics into the 
'lines' envinroment. To achieve this, I need to replace \setupwhitespace 
with \setupinterlinespace and adjust raisebox amount.


\starttext

\def\Ch#1{%

\strut\hbox to 0pt{\raisebox{0.45\baselineskip}\hbox{\bf#1}\hss}}

\setupinterlinespace[big]

\startlines

\Ch{E}Cvet dišeč z \Ch{H7}jutrom se od\Ch{cis}pre,

\Ch{A}sonce od\Ch{E}pira o\Ch{H}či.

\Ch{E}Polje z vetrom v \Ch{H7}plesu ziblje \Ch{cis}se.

Gos\Ch{E}pod, pov\Ch{H}sod vidim \Ch{E}Te.

\stoplines

\stoptext


What do you mean talking about optimization? )


Regards,
Vyatcheslav
___
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
___


Re: [NTG-context] ntg-context Digest, Vol 67, Issue 18

2010-01-12 Thread Aditya Mahajan

On Tue, 12 Jan 2010, Vyatcheslav Yatskovsky wrote:


Thanks for answers, friends!

I don't have ruby installed, so I try Mojca solution.


Wolfgang's module is for writing Ruby annotations 
(http://www.w3.org/TR/ruby), it is not require Ruby programming language.



From W3c's website:


Ruby text is usually presented alongside the base text, using a smaller 
typeface. The name ruby in fact originated from the name of the 5.5pt 
font size in British printing, which is about half the 10pt font size 
commonly used for normal text.


Aditya
___
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
___


Re: [NTG-context] ntg-context Digest, Vol 67, Issue 18

2010-01-12 Thread Wolfgang Schuster



position.tex
Description: Binary data


t-ruby.tex
Description: Binary data


chord.tex
Description: Binary data


README
Description: Binary data

Am 12.01.2010 um 18:24 schrieb Aditya Mahajan:

 On Tue, 12 Jan 2010, Vyatcheslav Yatskovsky wrote:
 
 Thanks for answers, friends!
 
 I don't have ruby installed, so I try Mojca solution.
 
 Wolfgang's module is for writing Ruby annotations 
 (http://www.w3.org/TR/ruby), it is not require Ruby programming language.


I attached my last version of the module with two test files to show
Vyatcheslav what Mojca meant with a optimized version of her code,
the module provides the same as she showed by hidden from the user
and customizable with different keys.

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
___


Re: [NTG-context] Putting chord names above the lyrics

2010-01-12 Thread Vyatcheslav Yatskovsky

Thanks, Wolfgang!

Good toy )

\usemodule[ruby]

\define[1]\chord{\dontleavehmode\ruby[position=before,align=left,inbetween={\blank[big]}]{}{#1}}

\starttext

\setupinterlinespace[big]

\startlines

\chord{E}Cvet dišeč z \chord{H7}jutrom se od\chord{cis}pre,

\chord{A}sonce od\chord{E}pira o\chord{H}či.

\chord{E}Polje z vetrom v \chord{H7}plesu ziblje \chord{cis}se.

Gos\chord{E}pod, pov\chord{H}sod vidim \chord{E}Te.

\stoplines

\stoptext


However, it was tricky to find out that inbetween={\blank[big]}key 
controls the distance between chords and lyrics. Can this distance be 
set more precisely?


And position=before or after would better be above and below, 
respectively. Don't you dare to change this? )


Regards,
Vyatcheslav

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


Re: [NTG-context] Putting chord names above the lyrics

2010-01-12 Thread Wolfgang Schuster

Am 12.01.2010 um 23:51 schrieb Vyatcheslav Yatskovsky:

 However, it was tricky to find out that inbetween={\blank[big]}key controls 
 the distance between chords and lyrics. Can this distance be set more 
 precisely?

You can use \blank[dimen] or \vskip xxpt or whatever else inserts a vertical 
space.

 And position=before or after would better be above and below, 
 respectively. Don't you dare to change this? )

The names for keys/values are taken from ruby documentation on the W3C page,
changing them to context is something i left out so far. I want to keep before
and after but i can make above/below synonyms (just one extra line for each 
name).

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
___


[NTG-context] simple layout

2010-01-12 Thread Wolfgang Werners-Lucchini
Hallo,

I need a little help for this simple layout. I am looking for a 
solution for hours now, but I can not get it work:

\setupcolors[state=start]

\starttext
\framed[background=color, backgroundcolor=gray]{%
\starttable[|lp(.1\textwidth)|lp(.9\textwidth)|]
\NC \placefigure[left,high]{none}{\framed[height=1cm]{graphic}}
\NC Text rechts!\crlf Text rechts!\crlf Text rechts!\crlf Text 
rechts!\crlf Text rechts!\crlf Text rechts!\crlf Text rechts!\crlf 
Text rechts!\crlf Text rechts!  \NC\AR
% \NC Text rechts!  \NC\AR
\stoptable}

Mehr Text \ldots
\stoptext
-
left: picture (not always the same height)
right: text (variable height, sometimes more, sometimes less than on 
the left)
left and right framed (height should be the maximum of left and right 
height)
after that: normal text.

Problems:
If height(left)height(right) than height(framed) is not height(left)

'Mehr Text' is not left aligned

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
___


Re: [NTG-context] simple layout

2010-01-12 Thread Wolfgang Schuster

Am 13.01.2010 um 00:25 schrieb Wolfgang Werners-Lucchini:

 Hallo,
 
 I need a little help for this simple layout. I am looking for a 
 solution for hours now, but I can not get it work:
 
 \setupcolors[state=start]
 
 \starttext
 \framed[background=color, backgroundcolor=gray]{%
 \starttable[|lp(.1\textwidth)|lp(.9\textwidth)|]
 \NC \placefigure[left,high]{none}{\framed[height=1cm]{graphic}}

\NC \tbox{\externalfigure[...]} \NC ... \NC\AR

You can find more box type in supp-box.tex

Kind regards,
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
___