ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Entities names instead of characters in header texts
@ 2004-10-05 13:39 Piotr Kopszak
  2004-10-06  8:49 ` Hans Hagen
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Piotr Kopszak @ 2004-10-05 13:39 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 594 bytes --]

Hello,

I am having problems with setting up header texts based on source xml
utf-8 coded. 

When I use: 
     
     \useXMLfilter [utf]
     \defineXMLargument [imie-i-nazwisko] \title
     \setupheadertexts[title]

I get the title right, e.g.:

      Maria Giżbert
        
whereas the header text is:

      Maria Gi"zdotaccent b ert

I attach the necessary files (without graphic files of course).

Piotr

-- 
   Piotr Kopszak, Ph.D.          
   Polish Art Gallery, National Museum in Warsaw    
   ----------------------------->    http://kopszak.mnw.art.pl/ 

[-- Attachment #2: posredni.xml --]
[-- Type: application/xml, Size: 66064 bytes --]

[-- Attachment #3: katalog2.tex --]
[-- Type: text/x-tex, Size: 1483 bytes --]

\input katalog-setup2
\useXMLfilter [utf]
\defineXMLenvironment [katalog] {\starttext} {\stoptext}
\defineXMLargument [imie-i-nazwisko] \title
\defineXMLenvironment[obraz] {\bgroup} {\egroup\par}
\defineXMLargument [tytul] \subject
%\defineXMLenvironment[dane] {\startitemize[5,packed]\tfx} {\stopitemize}
\defineXMLargument [technika-i-material] \item
%\defineXMLargument [material]\item
\defineXMLargument [wymiary]\item
\defineXMLargument [wlasciciel-i-nr]\item
%\defineXMLargument [nrinw]\item
\defineXMLargument [datowanie]\item
\defineXMLenvironment[podroze] {\bgroup} {\egroup\page}
\defineXMLenvironment[podroz] {\startitemize[5,packed]\tfx} {\stopitemize}
\defineXMLenvironment[it] {\bgroup\it} {\egroup}
\defineXMLenvironment [daty-przyjazdu]{\bgroup\tfd} {\egroup
}

\defineXMLargument [bibliografia]\item
\defineXMLargument [nota]\item
\defineXMLargument [zrodlo]\blank
\defineXMLenvironment[obrazy-z-podrozy] {\bgroup} {\egroup\par}
\defineXMLenvironment[cytat] {\setuplinewidth[1pt]\startnarrower\startcolumns[n=2,tolerance=verytolerant]} {\stopcolumns\stopnarrower}
\defineXMLenvironment[obraz-z-podrozy]{\bgroup}{\egroup\blank}



\defineXMLenvironment [dane] {\startitemize[5,packed]\blank\defineXMLpush[ilustracja]}{\blank\externalfigure[\XMLpop{ilustracja}][width=10cm]\stopitemize\page}


%\showsetups
%\showlayout
\processXMLfilegrouped{posredni.xml}
%trzeba pokombinować z blankami żeby uzyskać odstępy jak trzeba





[-- Attachment #4: katalog-setup2.tex --]
[-- Type: text/x-tex, Size: 2008 bytes --]

% ustawiamy rozmiary czcionek i styl
\setupoutput[pdftex]
\setupbodyfont[8pt]
\language[pl]
%musimy zdefiniować własne kolory
\definecolor[moj-kolor-ramki] [r=1,g=.66,b=.64]
\definecolor[moj-kolor-tla] [r=.97,g=1,b=.86]
\definecolor[moj-kolor-ramki-podroz] [r=.05,g=.63,b=.62]
\definecolor[moj-kolor-tla-podroz] [r=.83,g=1,b=.11]
\definecolor[moj-kolor-ramki-obraz] [r=.91,g=.31,b=.29]
\definecolor[moj-kolor-tla-obraz] [r=.87,g=1,b=.96]
\definecolor[moj-kolor-ramki-cytatu] [r=.78,g=.5,b=.45]
\definecolor[moj-kolor-tla-cytatu] [r=1,g=.87,b=.6]

%parametry nagłówków
\setuphead[subject][style=italic]

%informacje o obrazie są w formie listy, tu się ustawia jej odstęp od
%symbolu poprzedzającego szerokość marginesu,  i co jest tym symbolem.
% Spróbujemy też wpłynąć na odstępy między wierszami w ramach wyliczeń
\definesymbol[5][\space]
\setupitemize[each][packed][margin=1cm,between={\blank[small]}]
%musimy zdefiniować spację jako symbol na początek, bo nie wiem jak
%wyłączyć wyświetlanie symbolu na początku linii, jak się dowiem to
%będzie niepotrzebne

\setupbackground[frame=on,
background=color,
backgroundcolor=moj-kolor-tla-podroz,
framecolor=moj-kolor-ramki-podroz,
framecorner=round,
frameradius=0.2cm,
backgroundcorner=round,
backgroundradius=0.2cm
]

%parametry ramek
\setupframedtexts[background=color,
backgroundcolor=moj-kolor-tla,
framecolor=moj-kolor-ramki,
framecorner=round,
frameradius=0.6cm,
backgroundcorner=round,
backgroundradius=0.6cm]

%odstęp między wierszami
\setupinterlinespace[small]
%odstęp między akapitami
\setupwhitespace[small]

%odstęp między pozycjami
\setupitemgroup[itemize][each][inbetween={\blank[.1em]}]


%grubość linii używanej w ramkach i w ogóle
\setuplinewidth[3pt]

\setupalign[hanging]

\setuptolerance[verytolerant]

\setuppagenumbering[footer,right]

\setupheadertexts[title]

\setupexternalfigures[directory={/home/kopszak/PRACE/ITALIA/srednie}] 

[-- Attachment #5: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: Entities names instead of characters in header texts
  2004-10-05 13:39 Entities names instead of characters in header texts Piotr Kopszak
@ 2004-10-06  8:49 ` Hans Hagen
  2004-10-06  9:38 ` Hans Hagen
  2004-10-06 11:53 ` Hans Hagen
  2 siblings, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2004-10-06  8:49 UTC (permalink / raw)


Piotr Kopszak wrote:

> Hello,
> 
> I am having problems with setting up header texts based on source xml
> utf-8 coded. 
> 
> When I use: 
>      
>      \useXMLfilter [utf]
>      \defineXMLargument [imie-i-nazwisko] \title
>      \setupheadertexts[title]
> 
> I get the title right, e.g.:
> 
>       Maria Giżbert
>         
> whereas the header text is:
> 
>       Maria Gi"zdotaccent b ert
> 
> I attach the necessary files (without graphic files of course).

i'll look into it

a tip first:

- remove the \starttext and \stoptext in your root element def
- comment the \processXMLfile... and you can then say:

   texexec --env=katalog2 --pdf posredni.xml

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

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

* Re: Entities names instead of characters in header texts
  2004-10-05 13:39 Entities names instead of characters in header texts Piotr Kopszak
  2004-10-06  8:49 ` Hans Hagen
@ 2004-10-06  9:38 ` Hans Hagen
  2004-10-06 11:53 ` Hans Hagen
  2 siblings, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2004-10-06  9:38 UTC (permalink / raw)


Piotr Kopszak wrote:

> Hello,
> 
> I am having problems with setting up header texts based on source xml
> utf-8 coded. 
> 
> When I use: 
>      
>      \useXMLfilter [utf]
>      \defineXMLargument [imie-i-nazwisko] \title
>      \setupheadertexts[title]
> 
> I get the title right, e.g.:
> 
>       Maria Giżbert
>         
> whereas the header text is:
> 
>       Maria Gi"zdotaccent b ert
> 
> I attach the necessary files (without graphic files of course).

in cont-new.tex, add:

\def\XMLexpanded#1%
   {\bgroup
    \let\unicodechar\relax
    \honorunexpanded
    \dontexpandencoding
    \xdef\@@globalexpanded{\noexpand#1}%
    \egroup
    \@@globalexpanded}

a better solution follows

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

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

* Re: Entities names instead of characters in header texts
  2004-10-05 13:39 Entities names instead of characters in header texts Piotr Kopszak
  2004-10-06  8:49 ` Hans Hagen
  2004-10-06  9:38 ` Hans Hagen
@ 2004-10-06 11:53 ` Hans Hagen
  2004-10-06 12:59   ` Piotr Kopszak
  2 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2004-10-06 11:53 UTC (permalink / raw)


Hi Piotr

you can copy this code in cont-new;

when i can be sure that polish/czech users have switched to latin 
modern, we may be able to simplify some of teh nasty parts of the xml 
handler (having to deal with { } $ etc not being in their normal slot 
leads to much low level hacks and this is related)


% In 2005 we will abandon support for font encodings that don't have
% the ascii characters { } $ etc in their normal slot, i.e. latin modern
% instead of computer modern. Then we can also clean up some of the ugly
% xml internals that are a result from the need to deal with funny
% encodings.

% a solution:
%
% \defineXMLargument[ctx:c]{\getXMLcharacter}
% \defineXMLargument[ctx:e]{\getXMLentity   }
% \defineXMLargument[ctx:u]{\unicodechar    }
%
% \bgroup \catcode`\<=\active \catcode`\&=\active
%
% \gdef\dontexpandutf
%   {\def\getXMLcharacter##1{<ctx:c>##1</ctx:c>}%
%    \def\getXMLentity   ##1{<ctx:e>##1</ctx:e>}%
%    \def\unicodechar    ##1{<ctx:u>##1</ctx:u>}}
%
% \egroup
%
% more generic:

\def\defineactivecharacter #1 #2%
   {\scratchcounter\the\uccode\activehackcode
    \uccode\activehackcode\expandafter\doifnumberelse
      \expandafter{\string#1}\empty`#1%
    \catcode\uccode\activehackcode\@@active
    \uppercase{\def\next{~}}%
    \uccode\activehackcode\scratchcounter
    % unexpanded goes wrong in pdfdoc
    \@EA\@EA\@EA\def\@EA\next\@EA{\@EA\dohandleactivecharacter\next{#2}}}

\let\dohandleactivecharacter\secondoftwoarguments

\def\donthandleactivecharacter#1#2{\noexpand#1}

\def\XMLexpanded#1%
   {\bgroup
    \honorunexpanded
%    \dontexpandencoding
%    \dontexpandutf
    \let\dohandleactivecharacter\donthandleactivecharacter
    \xdef\@@globalexpanded{#1}%
    \egroup
    \@@globalexpanded}

\def\setXMLexpandedmark#1#2%
   {\XMLexpanded{\scratchtoks{\enableXML#2}}%
    \expanded{\normalsetnormalmark{#1}{\the\scratchtoks}}}

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

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

* Re: Entities names instead of characters in header texts
  2004-10-06 11:53 ` Hans Hagen
@ 2004-10-06 12:59   ` Piotr Kopszak
  2004-10-06 15:02     ` website Hans Hagen
  0 siblings, 1 reply; 6+ messages in thread
From: Piotr Kopszak @ 2004-10-06 12:59 UTC (permalink / raw)


On Wed, Oct 06, 2004 at 01:53:10PM +0200, Hans Hagen wrote:
> Hi Piotr
> 
> you can copy this code in cont-new;
> 
> when i can be sure that polish/czech users have switched to latin 
> modern, we may be able to simplify some of teh nasty parts of the xml 
> handler (having to deal with { } $ etc not being in their normal slot 
> leads to much low level hacks and this is related)
> 
> [...]
> 
> \def\defineactivecharacter #1 #2%
>   {\scratchcounter\the\uccode\activehackcode
>    \uccode\activehackcode\expandafter\doifnumberelse
>      \expandafter{\string#1}\empty`#1%
>    \catcode\uccode\activehackcode\@@active
>    \uppercase{\def\next{~}}%
>    \uccode\activehackcode\scratchcounter
>    % unexpanded goes wrong in pdfdoc
>    \@EA\@EA\@EA\def\@EA\next\@EA{\@EA\dohandleactivecharacter\next{#2}}}
> 
> \let\dohandleactivecharacter\secondoftwoarguments
> 
> \def\donthandleactivecharacter#1#2{\noexpand#1}
> 
> \def\XMLexpanded#1%
>   {\bgroup
>    \honorunexpanded
> %    \dontexpandencoding
> %    \dontexpandutf
>    \let\dohandleactivecharacter\donthandleactivecharacter
>    \xdef\@@globalexpanded{#1}%
>    \egroup
>    \@@globalexpanded}
> 
> \def\setXMLexpandedmark#1#2%
>   {\XMLexpanded{\scratchtoks{\enableXML#2}}%
>    \expanded{\normalsetnormalmark{#1}{\the\scratchtoks}}}
> [...]

Great thanks! 

Both solutions work. And the tip is really useful. Much easier to test
different variants. 

Piotr
-- 
   Piotr Kopszak, Ph.D.          
   Polish Art Gallery, National Museum in Warsaw    
   ----------------------------->    http://kopszak.mnw.art.pl/ 

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

* website
  2004-10-06 12:59   ` Piotr Kopszak
@ 2004-10-06 15:02     ` Hans Hagen
  0 siblings, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2004-10-06 15:02 UTC (permalink / raw)


Hi,

I uploaded the new pragma website. There are still some flaws but .. 
later thi smonth (when i've installed the new web servers) i will enable 
   remot eprocessing options (the example framework now provides html 
forms as well as pdf forms).

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

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

end of thread, other threads:[~2004-10-06 15:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-05 13:39 Entities names instead of characters in header texts Piotr Kopszak
2004-10-06  8:49 ` Hans Hagen
2004-10-06  9:38 ` Hans Hagen
2004-10-06 11:53 ` Hans Hagen
2004-10-06 12:59   ` Piotr Kopszak
2004-10-06 15:02     ` website 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).