Re: [NTG-context] Invoking ConTeXt from inside php web appliction

2016-07-11 Thread massifr
> That is what I suspect as well.  How do I find out which cache path is 
> being used?
> 

I'm using Debian+ConTeXt+Apache+PHP.
I've struggled a bit to make it work, but now it works.
It works even inside a docker container.

In my PHP code I've put this:

putenv("TEXMFCACHE=/var/cache/context/texmf-cache");

This forces ConTeXt to use that directory as cache.
Then I made /var/cache/context/texmf-cache world-writable:

chmod ugo+rwx /var/cache/context/texmf-cache

Perhaps it's not the best choice for security.
Try that and tell me if it works.

Best regards,
Massi
___
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] passing the \starttabulate format in XML typesetting

2016-06-16 Thread massifr
Hello list,
I'm trying to map HTML with tabs to \starttabulate in ConTeXt.
A div of class "tabulate" is mapped to a \starttabulate ... \stoptabulate 
section,
p elements are rows and span elements of class "tab" produce \NCs in ConTeXt.
That div element has a "format" attribute that must be passed to 
\starttabulate[...]
to format the columns.

I managed to pass that attribute using lua, but I failed using only ConTeXt:

\startbuffer[test]

  
a b c
  

\stopbuffer

\startxmlsetups xml:somesetups
  \xmlsetsetup{#1}{text}{xml:text}
  \xmlsetsetup{#1}{div[@class='tabulate']}{xml:div:tabulate}
  \xmlsetsetup{#1}{div[@class='tabulate']/p}{xml:div:tabulate:p}
  
\xmlsetsetup{#1}{div[@class='tabulate']/p/span[@class='tab']}{xml:div:tabulate:p:tab}
\stopxmlsetups

\xmlregistersetup{xml:somesetups}

\startxmlsetups xml:text
  \indenting[{yes,first,12pt}]
  \xmlflush{#1}
\stopxmlsetups

\setuptabulation[rulethickness=1pt,unit=2pt]

\ctxlua{
function xml.functions.divTabulate(t)
  local format = xml.attribute(t, "", "format")
  context.starttabulate( { format } )
  lxml.flush(t)
  context.stoptabulate()
end
}

\startxmlsetups xml:div:tabulate
%  \xmlfunction{#1}{divTabulate}  % this works!
% the following line can't pass the format correctly to ConTeXt
  \starttabulate[{\xmlatt{#1}{format}}]
\xmlflush{#1}
  \stoptabulate
\stopxmlsetups

\startxmlsetups xml:div:tabulate:p
  \NC{}\xmlflush{#1}\NC\NR
\stopxmlsetups

\startxmlsetups xml:div:tabulate:p:tab
  \NC{}
\stopxmlsetups

\starttext
  \xmlprocessbuffer{main}{test}{}
\stoptext

I suspect it's a simple mistake of mine.
Thanks in advance,
Massi
___
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] reading the value of a counter (footnote counter, i.e.) from lua

2016-06-15 Thread massifr
> > how can I read the numeric value of a counter in Lua?
> >
> \starttext
> 
> x \footnote{x} x \footnote{x} x \footnote{x} x
> 
> \cldcontext{structures.counters.currentvalue("footnote",1)}
> 
> \stoptext

Thank you, Hans.

I searched for "currentvalue" in the source and now I'm looking at 
"strc-num.lua".
Is the second argument of currentvalue the level of a multi-level counter?
I suppose it is always 1 in footnotes, isn't it?

Best regards,
Massi
___
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] reading the value of a counter (footnote counter, i.e.) from lua

2016-06-15 Thread massifr
Hello list,
how can I read the numeric value of a counter in Lua?

local c_value = ...

Something like \rawcountervalue in ConTeXt, but in Lua.

Thanks in advance,
Massi
___
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] space between equations in mathalignment

2016-06-13 Thread massifr
Hello list,
is there a way to modify the space between equations in mathalignment?
Something like \TB in tabulate would be great.
In tabulate, \TB[-3mm] i.e. lets you shrink the vertical space between two rows.

Aditya spoke about that here:
http://www.mail-archive.com/ntg-context%40ntg.nl/msg34316.html
and the answer seems to be "no".

Working example:
\starttext
\startformula
  \startmathalignment[n=1]
\NC v = u + at, \NR[+]
\NC d = ut + \frac{1}{2} at^2. \NR[+]
  \stopmathalignment
\stopformula
\stoptext

Not working example (what I'd like)
\starttext
\startformula
  \startmathalignment[n=1]
\NC v = u + at, \NR[+]
\TB
\NC d = ut + \frac{1}{2} at^2. \NR[+]
  \stopmathalignment
\stopformula
\stoptext

I've looked at math-ali.mkiv for a place to "inject" a \blank to modify 
the vertical space between rows. 
Is \math_alignment_NR_indeed the right place?

Thanks,
Massi
___
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] writebetweenlist bug?

2016-05-19 Thread massifr
Hello list,
I'm experimenting with the table of contents and I found a strange behaviour of 
writebetweenlist.
Try this:

\setuphead[chapter][number=no]

\starttext

\placecontent

\chapter{chapter 1}
\chapter{chapter 2}
\writebetweenlist[chapter]{\blank Why am I not between chapter 2 and chapter 3?}
\chapter{chapter 3}
\chapter{chapter 4}

\stoptext

I exptected the text of \writebetweenlist to fall between chapters 2 and 3, but 
it falls between chapters 1 and 2.
Is that right or is it a bug?

Best greetings,
Massi
___
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] Garamond Premier Pro font goodies file

2016-04-28 Thread massifr
Hello list,
I'm using the Adobe Garamond Premier Pro font.
It has 4 optical sizes: Caption, Normal, Subhead, Display.
I tried to modify ebgaramond.lfg to adapt it to Garamond Premier Pro.
You find it as an attachment.

I don't know how to use that goodies file to see the different optical sizes
in a document. I've tried this:

\loadfontgoodies[GaramondPremierPro]

\definefontfamily [default] [rm] [tf=name:GaramondPremierPro-Regular,
  it=name:GaramondPremierPro-Italic]

\setupbodyfont[default,12pt]

\dostepwiserecurse {6} {22} {1} {
  \definebodyfontenvironment[default][#1pt][text=#1pt,em=italic]
}

\starttext

\dostepwiserecurse {6} {22} {1} {
\switchtobodyfont[#1pt]
\purefontname\font: \input tufte
\blank
}

\stoptext

but it does not work. Any help?
Thanks in advance, Massi

To Hans: if you find it useful for Context, you can add and/or modify it
to the distribution. You can also change the author to yourself.return {
name = "GaramondPremierPro",
version = "1.00",
comment = "Goodies that complement Garamond Premier Pro.",
author = "MF",
copyright = "ConTeXt development team",
designsizes = {
["GaramondPremierPro-Regular"] = {
["6pt"]   = "file:GaramondPremrPro-Capt",
["7pt"]   = "file:GaramondPremrPro-Capt",
["8pt"]   = "file:GaramondPremrPro-Capt",
["8.5pt"] = "file:GaramondPremrPro",
["9pt"]   = "file:GaramondPremrPro",
["9.5pt"] = "file:GaramondPremrPro",
["10pt"]  = "file:GaramondPremrPro",
["11pt"]  = "file:GaramondPremrPro",
["12pt"]  = "file:GaramondPremrPro",
["12pt"]  = "file:GaramondPremrPro",
["14pt"]  = "file:GaramondPremrPro-Subh",
["21pt"]  = "file:GaramondPremrPro-Subh",
["22pt"]  = "file:GaramondPremrPro-Disp",
default   = "file:GaramondPremrPro",
},
["GaramondPremierPro-Italic"] = {
["6pt"]   = "file:GaramondPremrPro-ItCapt",
["7pt"]   = "file:GaramondPremrPro-ItCapt",
["8pt"]   = "file:GaramondPremrPro-ItCapt",
["8.5pt"] = "file:GaramondPremrPro-It",
["9pt"]   = "file:GaramondPremrPro-It",
["9.5pt"] = "file:GaramondPremrPro-It",
["10pt"]  = "file:GaramondPremrPro-It",
["11pt"]  = "file:GaramondPremrPro-It",
["12pt"]  = "file:GaramondPremrPro-It",
["12pt"]  = "file:GaramondPremrPro-It",
["14pt"]  = "file:GaramondPremrPro-ItSubh",
["21pt"]  = "file:GaramondPremrPro-ItSubh",
["22pt"]  = "file:GaramondPremrPro-ItDisp",
default   = "file:GaramondPremrPro-It",
},
["GaramondPremierPro-Bold"] = {
["6pt"]   = "file:GaramondPremrPro-BdCapt",
["7pt"]   = "file:GaramondPremrPro-BdCapt",
["8pt"]   = "file:GaramondPremrPro-BdCapt",
["8.5pt"] = "file:GaramondPremrPro-Bd",
["9pt"]   = "file:GaramondPremrPro-Bd",
["9.5pt"] = "file:GaramondPremrPro-Bd",
["10pt"]  = "file:GaramondPremrPro-Bd",
["11pt"]  = "file:GaramondPremrPro-Bd",
["12pt"]  = "file:GaramondPremrPro-Bd",
["12pt"]  = "file:GaramondPremrPro-Bd",
["14pt"]  = "file:GaramondPremrPro-BdSubh",
["21pt"]  = "file:GaramondPremrPro-BdSubh",
["22pt"]  = "file:GaramondPremrPro-BdDisp",
default   = "file:GaramondPremrPro-Bd",
},
["GaramondPremierPro-BoldItalic"] = {
["6pt"]   = "file:GaramondPremrPro-BdItCapt",
["7pt"]   = "file:GaramondPremrPro-BdItCapt",
["8pt"]   = "file:GaramondPremrPro-BdItCapt",
["8.5pt"] = "file:GaramondPremrPro-BdIt",
["9pt"]   = "file:GaramondPremrPro-BdIt",
["9.5pt"] = "file:GaramondPremrPro-BdIt",
["10pt"]  = "file:GaramondPremrPro-BdIt",
["11pt"]  = "file:GaramondPremrPro-BdIt",
["12pt"]  = "file:GaramondPremrPro-BdIt",
["12pt"]  = "file:GaramondPremrPro-BdIt",
["14pt"]  = "file:GaramondPremrPro-BdItSubh",
["21pt"]  = "file:GaramondPremrPro-BdItSubh",
["22pt"]  = "file:GaramondPremrPro-BdItDisp",
default   = "file:GaramondPremrPro-BdIt",
},
["GaramondPremierPro-Medium"] = {
["6pt"]   = "file:GaramondPremrPro-MedCapt",
["7pt"]   = "file:GaramondPremrPro-MedCapt",
["8pt"]   = "file:GaramondPremrPro-MedCapt",
["8.5pt"] = "file:GaramondPremrPro-Med",
["9pt"]   = "file:GaramondPremrPro-Med",
["9.5pt"] = "file:GaramondPremrPro-Med",
["10pt"]  = "file:GaramondPremrPro-Med",
["11pt"]  = "file:GaramondPremrPro-Med",
["12pt"]  = "file:GaramondPremrPro-Med",
["12pt"]  = "file:GaramondPremrPro-Med",

Re: [NTG-context] language setting scope

2016-04-21 Thread massifr
My problem was not related to \language or \mainlanguage.
It was the side-effect of a different mistake: \startnotmode 
that was not closed by a \stopnotmode.

...
\startmode[Info]
... % things to do when mode Info is active
\stopmode
\startnotmode[Info]
... % things to do when mode Info is not active
\stopmode % <-- THE BUG: should be \stopnotmode
...
\mainlanguage[it]  % without the right \stopnotmode this statement works only 
when mode Info is not active
...

I just copied and pasted \startmode[Info] ... \stopmode changing only
\startmode into \startnotmode, but not \stopmode into \stopnotmode.

context did not complain for that mismatch, 
but --mode=Info made the \mainlanguage[it] ignored,
because \startnotmode[Info] was not closed.

Everything else seemed to work just fine, and the missing
italian hyphenation looked like a mistery.

Before that I used \doifmode{Info}{ ... } and \doifnotmode{Info}{ ... }:
they are less readable but more robust, since a missing brace gets
detected by context.

> I apologize for the noise.
> \mainlanguage[it] before \starttext solves the problem.
> 
> > Hello list,
> > I'm typesetting XHTML italian text with Context (version 4/4/16).
> > 
> > I've put a \language[it] just after \starttext, but I get words
> > with a wrong hyphenation.
> > 
> > As a patch, I just put \language[it] at the beginning of the xmlsetup
> > that processes the  tag, and now words are hyphenated right,
> > following the italian rules.
> > 
> > It looks like \language[it] get reset at some point.
> > 
> > Have you an explanation? 
> > 

___
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] language setting scope

2016-04-20 Thread massifr
I apologize for the noise.
\mainlanguage[it] before \starttext solves the problem.

> Hello list,
> I'm typesetting XHTML italian text with Context (version 4/4/16).
> 
> I've put a \language[it] just after \starttext, but I get words
> with a wrong hyphenation.
> 
> As a patch, I just put \language[it] at the beginning of the xmlsetup
> that processes the  tag, and now words are hyphenated right,
> following the italian rules.
> 
> It looks like \language[it] get reset at some point.
> 
> Have you an explanation? 
> 
> Thank you in advance,
> Massi
> ___
> 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
> ___

___
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] language setting scope

2016-04-20 Thread massifr
Hello list,
I'm typesetting XHTML italian text with Context (version 4/4/16).

I've put a \language[it] just after \starttext, but I get words
with a wrong hyphenation.

As a patch, I just put \language[it] at the beginning of the xmlsetup
that processes the  tag, and now words are hyphenated right,
following the italian rules.

It looks like \language[it] get reset at some point.

Have you an explanation? 

Thank you in advance,
Massi
___
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] parallel texts, setuptabulate and widows-orphans control

2016-04-19 Thread massifr
Hello list,
I've found that \start ... \stoptabulate can be used to format parallel texts,
with paragraphs that are synchronized and split well on different pages.

I also found that they don't play well with widow-orphan penalties.
Try this:

\setuptabulate[split=yes]

\starttext
  \setpenalties\widowpenalties{1}{1}
  \setpenalties\clubpenalties{1}{1}
  \starttabulate[|p|p|]
\NC
\dorecurse{3}{\input knuth}
\NC
\dorecurse{2}{\input knuth}
\NC\NR
  \stoptabulate
\stoptext

The penalties' settings make some lines overlap.
Comment out those two lines and everything works well.
Not a great problem, since I don't think you need
widow-orphan control in parallel texts.

It took me some time to understand what was making 
lines overlap.
So I leave it here for future reference, if someone else
stumbles on the same problem.
___
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] automatically "smashing" È in xml typesetting

2016-04-12 Thread massifr
Thank you Hans for your example:

> > so I'm looking for an automatic way to replace every "È" in the text with 
> > "\smash{È}".
> 
> \definefontfeature[default][default][dimensions={0,1.9,0}]
> 

It took a while to understand how it works but it was worthy.

I try to summarize because others may find it useful:
- the "dimensions" feature is defined in font-ext.lua
- its parameters modify the footprint of the glyphs of a font
- its parameters are factors for glyph's width, height (over the baseline) and 
depth (under the baseline)
- they are factors of emwidth, exheight and exheight respectively
- a value of zero for any of them means "leave the default value untouched",
  dimensions={0,1.9,0} means that only the height of (the footprint of) glyphs 
is set to 1.9 times exheight,
  the other two dimensions stay untouched

Before looking at the code I started playing with the dimensions values 
to understand what they controlled. One trial was this

\definefontfeature[default][default][dimensions={2,0,0}]

I got "spaced" text (glyphs have a larger footprint and appear spaced)

But this does not work:

\definefontfeature[spaced][dimensions={2,0,0}]
\starttext
Normal text and {\feature[+][spaced]spaced text}
\stoptext

Is it a feature that works only globally?
___
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] automatically "smashing" È in xml typesetting

2016-04-11 Thread massifr
Hello list,
I'm typesetting italian text that contains "E" letters with a grave accent, 
like this: "È".

In my "body font environment" the interline space is narrow and those
"È" make their lines taller, making every following line move downwards.

The problem is easily solvable putting "\smash" before "È".

But my sources are XML and typesetting is done through xmlsetups,
so I'm looking for an automatic way to replace every "È" in the text 
with "\smash{È}".
Is it possible?

Thanks, Massi

___
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] late reset of counter with way=bypage

2016-02-22 Thread massifr
Solved with a workaround
> -
> \setupnotation[footnote][way=bypage]
> 
> \definecounter[authornote][way=bypage]
> 
> % taken and adapted from 
> https://www.mail-archive.com/ntg-context@ntg.nl/msg56637.html
> \define[1]\authorNote{\bgroup%
>\savecounter[footnote]%
   \incrementcounter[authornote]\decrementcounter[authornote]%  <-- authornote 
is incremented and decremented to force the reset by page
>\setcounter[footnote][{\rawcountervalue[authornote]}]%
>\setupnotation[footnote][numberconversion=set 1]%
>\footnote{#1}%
>\restorecounter[footnote]%
>\incrementcounter[authornote]%
>\egroup}
> 
> \starttext
> 
> First footnote\footnote{First footnote}.
> First author's footnote\authorNote{First author's footnote}.
> Second footnote\footnote{Second footnote}.
> Second author's footnote\authorNote{Second author's footnote}.
> 
> \page
> 
> First footnote\footnote{First footnote}.
> First author's footnote\authorNote{First author's footnote}.
> Second footnote\footnote{Second footnote}.
> Second author's footnote\authorNote{Second author's footnote}.
> 
> \stoptext
> -

Wolfgang Schuster already answered me on this (see 
https://www.mail-archive.com/ntg-context%40ntg.nl/msg78847.html):
> It’s a bug and hopefully fixed in a new beta but the counter is only reset
> when you increment the value.

If you need the value of a counter with "way=bypage" without modifying its 
value, the workaround is:
- increment the counter to force its reset by page
- decrement it to get the correct current value

Greetings,
Massi
___
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] late reset of counter with way=bypage

2016-02-18 Thread massifr
Hello list,
this is an example of footnotes with two different markers (and counters): 
numbers for editor's footnotes, stars for author's footnotes.
The footnotes are typeset together, in the order they appear in the text, so 
number and star markers are interspersed.
The two counters are reset every page (way=bypage).
-
\setupnotation[footnote][way=bypage]

\definecounter[authornote][way=bypage]

% taken and adapted from 
https://www.mail-archive.com/ntg-context@ntg.nl/msg56637.html
\define[1]\authorNote{\bgroup%
   \savecounter[footnote]%
   \setcounter[footnote][{\rawcountervalue[authornote]}]%
   \setupnotation[footnote][numberconversion=set 1]%
   \footnote{#1}%
   \restorecounter[footnote]%
   \incrementcounter[authornote]%
   \egroup}

\starttext

First footnote\footnote{First footnote}.
First author's footnote\authorNote{First author's footnote}.
Second footnote\footnote{Second footnote}.
Second author's footnote\authorNote{Second author's footnote}.

\page

First footnote\footnote{First footnote}.
First author's footnote\authorNote{First author's footnote}.
Second footnote\footnote{Second footnote}.
Second author's footnote\authorNote{Second author's footnote}.

\stoptext
-

The problem: the first authorNote of the second page has its counter set to 3 
instead of 1 (you see 3 stars as marker).
The second authorNote has the right value of 2 (2 stars as marker).
This means that "way=bypage" works for the authornote counter too, but one step 
late.
What am I missing? Some \iftrialtypesetting?

Greetings,
Massi

___
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] Sanitize in XML/XHTML documents

2016-02-02 Thread massifr
> Pandoc produces some text. In TeX I would usually use 
> \quotation{some text} to have proper, language dependent quotes.
Are you sure that Pandoc can produce  only? Have you tried the 
--html-q-tags option?

Greetings,
Massi
___
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] fontname

2016-01-14 Thread massifr
> I want to display the name of the current (body)font.
> \fontname{#1} should do the trick but what parameter to use?
> \currentfont
> \bodyfont
> \currentbodyfont
> are all wrong.
> 
Try \fontname\font

\purefontname\font should show only its name, not the size, 
but this does not work for me (version 2015.05.18 included in Debian)

Greetings,
Massi
___
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] font style query

2016-01-14 Thread massifr
> Some fonts as for example Lucida have a calligraphic style called up with \cg.
> If it is not present a default is taken.
> However, I would like to take other action in that case, for example 
> switching to another font.
> 
> Thus, how to test on the presence of that calligraphic style in the current 
> font?

It depends on the font, whether it has a calligraphic variant.
In the case of Lucida, its name is "Lucida Calligraphy".
There's also a "Lucida Handwriting".

You can use it in ConTeXt because there are some default typescripts 
mapping that font on the \cg fontstyle.
You can look at these files in your ConTeXt distribution:
/tex/texmf-context/tex/context/base/type-imp-lucida-opentype.mkiv
/tex/texmf-context/tex/context/base/type-imp-lucida-typeone.mkiv

If you want to use a different font, for which there's no default typescript, 
you have to write your own typescripts.
You can also mix font families, taking the missing calligraphic variant 
from a different family with a similar look.

Hope it helps,
greetings,
Massi
___
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] simplefonts question

2016-01-14 Thread massifr
> \definefontfamily [mainface] [rm] [Lucida Bright OT]
> \definefontfamily [mainface] [ss] [Lucida Sans OT]
> \definefontfamily [mainface] [tt] [Lucida Sans Typewriter OT]
> \definefontfamily [mainface] [mm] [Lucida Bright Math OT]
> \definefontfamily [mainface] [hw] [Lucida Handwriting OT]
> \definefontfamily [mainface] [cg] [Lucida Calligraphy OT]

What should I do to use \definefontfamily with GaramondPremierPro?
I have the otf files, but ConTeXt is not configured to use them by default.

This does not work:
\definefontfamily [mainface][rm][tf=file:GaramondPremrPro.otf]

ConTeXt can't find the otf file, even if it's in the same directory.
According to the wiki, it should work.

Best greetings,
Massi
___
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] font scaling does not work in footnotes

2016-01-12 Thread massifr
Hello list,
I have a problem with font scaling (see "sc=SansCaps sa 1.5" below).

I'm using MyriadPro as sans font, but it lacks small caps.
So I decided to provide them using AlegreyaSansSC, because it's similar to 
MyriadPro and it's made of small caps only.
When I use \ss and \sc I get AlegreyaSC instead of MyriadPro.
I want to scale them differently to balance their weights.
That's why I wrote "sc=SansCaps sa 0.95".

In body text the two fonts are balanced, but in the footnotes the scaling is 
ignored.
What am I missing?

Here's (part of) the typescript:

\starttypescript [sans] [meo]
  \definefontsynonym [Sans] 
[name:MyriadPro-Regular][features=meo,fallbacks=mancanti]
  \definefontsynonym [SansBold] 
[name:MyriadPro-Bold][features=meo,fallbacks=mancanti]
  \definefontsynonym [SansItalic]   
[name:MyriadPro-It][features=meo,fallbacks=mancanti]
% ...
  \definefontsynonym [SansCaps] 
[name:AlegreyaSansSC-Medium][features=meo,smcp,fallbacks=mancanti]
  \definebodyfont
   [13pt,11pt,10pt,8pt,7pt,6pt]
   [ss]
   [tf=Sans sa 0.85,
it=SansItalic sa 0.85,
bf=SansBold sa 0.85,
bi=SansBoldItalic sa 0.85,
sl=SansSlanted sa 0.85,
sc=SansCaps sa 0.95]
\stoptypescript

Thank you,
Massi
___
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] place figure at the top left corner of the header

2015-11-26 Thread massifr
Hello list,
I need to place a figure with its topleft corner on the topleft corner of the 
header.
The figure would be large as the textframe and covering all the header and
part of the textframe, leaving the text flow below the figure.

In other words, a normal figure \textwidth large, but starting out of the 
textframe,
at the header top, as if the textframe had the same topleft corner of the 
header.

Which is the best way to obtain it? Do I need a custom page makeup, a layer or
simply configuring \placefigure?

Thank you,
Massi
___
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] flushing the last hbox of a paragraph to the right

2015-11-16 Thread massifr
Hello list,
I'm typesetting end notes with the pages where they get called
(don't think about \endnote since I'm not using it; they are simple
\item paragraphs).
Here's an example:

4 Text of the end note blah blah blah blah
  blah, end of para.  p. 3, 45, 96

which means that the end note 4 occurs in pages 3, 45, 96.

The pages are flushed to the right using \hfill.

This works as long as there's enough room for the pages'
numbers. In case like this:

5 Text of the fifth endnote blah blah blah
  a little longer to  fill the text width.  p. 4, 12
the pages are note flushed right because the \hfill expires
at the end of the second line. What I'd like is this:

5 Text of the fifth endnote blah blah blah
  a little longer to  fill the text width.  p. 
4, 12
Since I'm typesetting XML, is there an automatic way to achieve that
right alignment in both cases?
Thanks,
Massi
___
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] flushing the last hbox of a paragraph to the right

2015-11-16 Thread massifr
Sorry, there was a typo in my previous email.
The last example should look like this:

5 Text of the fifth endnote blah blah blah
  a little longer to  fill the text width.
  p. 4, 12


> Hello list,
> I'm typesetting end notes with the pages where they get called
> (don't think about \endnote since I'm not using it; they are simple
> \item paragraphs).
> Here's an example:
> 
> 4 Text of the end note blah blah blah blah
>   blah, end of para.  p. 3, 45, 96
> 
> which means that the end note 4 occurs in pages 3, 45, 96.
> 
> The pages are flushed to the right using \hfill.
> 
> This works as long as there's enough room for the pages'
> numbers. In case like this:
> 
> 5 Text of the fifth endnote blah blah blah
>   a little longer to  fill the text width.  p. 4, 12
> the pages are note flushed right because the \hfill expires
> at the end of the second line. What I'd like is this:
> 
> 5 Text of the fifth endnote blah blah blah
>   a little longer to  fill the text width.
>   p. 4, 12
> Since I'm typesetting XML, is there an automatic way to achieve that
> right alignment in both cases?
> Thanks,
> Massi

___
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] only page number in the header of the chapter title page

2015-11-10 Thread massifr
Thanks a lot, Wolfgang
just now I was posting a solution of mine, 
but yours is more elegant and concise.

Best regards,
Massi

PS: here's my solution (but I'll use yours):

\definemarking[headertitle]

\setupheadertexts[]
\setupheadertexts[\setups{oddpages}][][][\setups{evenpages}]

\startsetups[evenpages]
  \pagenumber
  \emspace
  \getmarking[headertitle][top]
  \hfill
\stopsetups

\startsetups[oddpages]
  \hfill
  \getmarking[headertitle][top]
  \emspace
  \pagenumber
\stopsetups

\starttext

\startchapter[title=Trial chapter]

\marking[headertitle]{\space}
\marking[headertitle]{Trial chapter}

\dorecurse{11}{\input knuth\par}

\stopchapter

\stoptext

In data martedì 10 novembre 2015 18:35:55, hai scritto:
> > mass...@fastwebnet.it 
> > 10. November 2015 um 12:50
> >
> > I mean something like this:
> >
> > On the top of a chapter title page:
> >
> > +---
> >
> > | 34
> > |
> >
> > On the top of a page without chapter title:
> >
> > +---
> >
> > | 36 - Chapter title
> > |
> >
> > Or (odd page):
> >
> > --+
> >
> > Chapter title - 35 |
> > |
> >
> > Thanks, Massi
> >
> >
> You can use the \definetext command to set a different header (or 
> footer) for chapter pages.
> 
> \setuppagenumbering[alternative=doublesided,location=]
> 
> \setupheadertexts
>[][{\getmarking[chapter] – \convertedcounter[userpage]}]
>[{\convertedcounter[userpage] – \getmarking[chapter]}][]
> 
> \definetext[chapterheader][header][][pagenumber]
> 
> \setuphead[chapter][header=chapterheader]
> 
> \starttext
> 
> \dorecurse{4}
>{\expanded{\chapter{Chapter \recurselevel}}
> \dorecurse{10}{\input knuth\par}}
> 
> \stoptext
> 
> 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] only page number in the header of the chapter title page

2015-11-10 Thread massifr
I mean something like this:

On the top of a chapter title page:
+---
|  34
|
On the top of a page without chapter title:
+---
| 36 - Chapter title
|

Or (odd page):
--+
   Chapter title - 35 |
  |
Thanks, Massi

In data lunedì 9 novembre 2015 14:51:31, mass...@fastwebnet.it ha scritto:
> Hello list,
> how can I keep the page number but not the header text in the page of a 
> chapter title?
> 
> \setuphead[chapter][header=empty] makes all the header disappear. Is there an 
> option
> to keep the page number?
> 
> Thanks, Massi
> ___
> 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
> ___
___
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] only page number in the header of the chapter title page

2015-11-09 Thread massifr
Hello list,
how can I keep the page number but not the header text in the page of a chapter 
title?

\setuphead[chapter][header=empty] makes all the header disappear. Is there an 
option
to keep the page number?

Thanks, Massi
___
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] accented capital in XML, how to smash it?

2015-11-02 Thread massifr
Hello list,
I have problems with accented capitals like "È" adding some vertical space
to their lines.
Is there a way to \smash them automatically?
That's because I'm typesetting XML and not directly using ConTeXt.

I tried an automatic translation with

\usemodule[translate]
\translateinput[È][\smash{È}]
...
\enableinputtranslation

but it does not work.
___
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] use of preceding-sibling in xmlsetsetup

2015-10-20 Thread massifr
Here's the (complete) code:

\startbuffer[test]

  Dear list,
  this paragraph should not be indented, because it 
follows the “incipit”
  of the letter.
  This one and the following ones should be indented.
  You may question whether “Dear list,” should be a paragraph of his own,
  but my text is already formatted like that and I can’t do anything 
  about it.

\stopbuffer
 
\startxmlsetups xml:somesetups
  \xmlsetsetup{#1}{text}{xml:text}
  \xmlsetsetup{#1}{p}{xml:p}
  \xmlsetsetup{#1}{p[@class='incipit']}{xml:p:noindent}
  % the following lpath expression does not work
  % \xmlsetsetup{#1}{p[reverse-sibling::p[1]/attribute('class') == 
'incipit']}{xml:p:noindent}
\stopxmlsetups

\xmlregistersetup{xml:somesetups}

\startxmlsetups xml:text
  \indenting[{yes,first,12pt}]
  \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:p
  \doif{\xmlattribute{#1}{reverse-sibling::p[1]}{class}}{incipit}{\noindent}
  \xmlflush{#1}\par
\stopxmlsetups
 
\startxmlsetups xml:p:noindent
  \noindent\xmlflush{#1}\par
\stopxmlsetups

\starttext
  \xmlprocessbuffer{main}{test}{}
\stoptext
 
It's the example of the original message of this thread, with the 
modifications posted in the second message.

In the \startxmlsetups section I tried to put that condition in a
\xmlsetsetup, but I commented it out because it did not work.
 
Here's where I found an example with reverse-sibling:
https://www.mail-archive.com/ntg-context%40ntg.nl/msg77364.html
I was searching for "sibling" in the mailing list archive to see whether
"sibling expressions" had been implemented.

Greetings,
Massi

> > On 10/17/2015 11:19 AM, mf wrote:
> > > "reverse-sibling" is ConTeXt specific and very useful: it's a "reversed
> > > preceding-sibling", so that you find the nearest sibling at index [1].
> > > I've used it successfully in a \doif statement, but I failed in
> > > translating it in a \xmlsetsetup statement, to tell ConTeXt: "this
> > > setup is for an element p whose nearest preceding sibling p has class
> > > 'incipit'".
> > 
> > In that case, why don't you show the code where you've used it 
> > successfully and maybe we can take it from there.
> > 
> > Thomas
> > 

___
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 136, Issue 30

2015-10-19 Thread massifr
Here's the (complete) code:

\startbuffer[test]

  Dear list,
  this paragraph should not be indented, because it 
follows the “incipit”
  of the letter.
  This one and the following ones should be indented.
  You may question whether “Dear list,” should be a paragraph of his own,
  but my text is already formatted like that and I can’t do anything 
  about it.

\stopbuffer

\startxmlsetups xml:somesetups
  \xmlsetsetup{#1}{text}{xml:text}
  \xmlsetsetup{#1}{p}{xml:p}
  \xmlsetsetup{#1}{p[@class='incipit']}{xml:p:noindent}
  % the following lpath expression does not work
  % \xmlsetsetup{#1}{p[reverse-sibling::p[1]/attribute('class') == 
'incipit']}{xml:p:noindent}
\stopxmlsetups

\xmlregistersetup{xml:somesetups}

\startxmlsetups xml:text
  \indenting[{yes,first,12pt}]
  \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:p
  \doif{\xmlattribute{#1}{reverse-sibling::p[1]}{class}}{incipit}{\noindent}
  \xmlflush{#1}\par
\stopxmlsetups

\startxmlsetups xml:p:noindent
  \noindent\xmlflush{#1}\par
\stopxmlsetups

\starttext
  \xmlprocessbuffer{main}{test}{}
\stoptext

It's the example of the original message of this thread, with the 
modifications posted in the second message.

In the \startxmlsetups section I tried to put that condition in a
\xmlsetsetup, but I commented it out because it did not work.

Here's where I found an example with reverse-sibling:
https://www.mail-archive.com/ntg-context%40ntg.nl/msg77364.html
I was searching for "sibling" in the mailing list archive to see whether
"sibling expressions" had been implemented.

Greetings,
Massi

> On 10/17/2015 11:19 AM, mf wrote:
> > "reverse-sibling" is ConTeXt specific and very useful: it's a "reversed
> > preceding-sibling", so that you find the nearest sibling at index [1].
> > I've used it successfully in a \doif statement, but I failed in
> > translating it in a \xmlsetsetup statement, to tell ConTeXt: "this
> > setup is for an element p whose nearest preceding sibling p has class
> > 'incipit'".
> 
> In that case, why don't you show the code where you've used it 
> successfully and maybe we can take it from there.
> 
> Thomas
> 
___
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] use of preceding-sibling in xmlsetsetup

2015-10-14 Thread massifr
I've found a better solution:

\startxmlsetups xml:p
  \doif{\xmlattribute{#1}{reverse-sibling::p[1]}{class}}{incipit}{\noindent}%
  \xmlflush{#1}\par
\stopxmlsetups

Still I did not manage to put that rule in a xmlsetsetup.
Tried this:

\xmlsetsetup{#1}{p[reverse-sibling::p[1]/attribute('class') == 
'incipit']}{xml:p:noindent}

but it does not work.

> Hello list,
> I need a lpath expression to intercept the first p (HTML paragraph) 
> after a p of class "incipit". Here's a (not) working example:
> 
> \startbuffer[test]
> 
>   Dear list,
>   this paragraph should not be indented, because it follows the “incipit”
>   of the letter.
>   This one and the following ones should be indented.
>   You may question whether “Dear list,” should be a paragraph of his own,
>   but my text is already formatted like that and I can’t do anything 
>   about it.
> 
> \stopbuffer
> 
> \startxmlsetups xml:somesetups
>   \xmlsetsetup{#1}{text}{xml:text}
>   \xmlsetsetup{#1}{p}{xml:p}
>   \xmlsetsetup{#1}{p[@class='incipit']}{xml:p:noindent}
>   % the following lpath expression does not work
>   \xmlsetsetup{#1}{p[./preceding-sibling::[-1][@class = 
> 'incipit']]}{xml:p:noindent}
> \stopxmlsetups
> 
> \xmlregistersetup{xml:somesetups}
> 
> \startxmlsetups xml:text
>   \indenting[{yes,first,12pt}]
>   \xmlflush{#1}
> \stopxmlsetups
> 
> \startxmlsetups xml:p
>   \xmlflush{#1}\par
> \stopxmlsetups
> 
> \startxmlsetups xml:p:noindent
>   \noindent\xmlflush{#1}\par
> \stopxmlsetups
> 
> \starttext
>   \xmlprocessbuffer{main}{test}{}
> \stoptext
> 
> Thanks for any help.

___
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] use of preceding-sibling in xmlsetsetup

2015-10-12 Thread massifr
Hello list,
I need a lpath expression to intercept the first p (HTML paragraph) 
after a p of class "incipit". Here's a (not) working example:

\startbuffer[test]

  Dear list,
  this paragraph should not be indented, because it follows the “incipit”
  of the letter.
  This one and the following ones should be indented.
  You may question whether “Dear list,” should be a paragraph of his own,
  but my text is already formatted like that and I can’t do anything 
  about it.

\stopbuffer

\startxmlsetups xml:somesetups
  \xmlsetsetup{#1}{text}{xml:text}
  \xmlsetsetup{#1}{p}{xml:p}
  \xmlsetsetup{#1}{p[@class='incipit']}{xml:p:noindent}
  % the following lpath expression does not work
  \xmlsetsetup{#1}{p[./preceding-sibling::[-1][@class = 
'incipit']]}{xml:p:noindent}
\stopxmlsetups

\xmlregistersetup{xml:somesetups}

\startxmlsetups xml:text
  \indenting[{yes,first,12pt}]
  \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:p
  \xmlflush{#1}\par
\stopxmlsetups

\startxmlsetups xml:p:noindent
  \noindent\xmlflush{#1}\par
\stopxmlsetups

\starttext
  \xmlprocessbuffer{main}{test}{}
\stoptext

Thanks for any help.
___
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] reading attribute from ancestor element in XML

2015-10-06 Thread massifr
Hello list,
I have an XML fragment like this:


  12 blah blah...


In the typeset text I want to substitute the text of the sup element ("12") 
with the id ("myid") in its div grandfather.

The xmlsetup associated to the sup element looks like this:

\startxmlsetups xml:sup
  \xmlatt{\xmlfirst{#1}{../..}}{id}
\stopxmlsetups

This gives an error (TeX capacity exceeded).
I'm using ConTeXt version 2015.06.15.
I've tried \xmlfilter and \xmlall too, with different lpaths.
Sometimes ConTeXt ends without errors,
but I've never managed to get the text of that attribute.

What's the right way to backtrack to parent and ancestor nodes?
___
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] Ampersand followed by semicolon in XML: possible bug?

2015-09-29 Thread massifr
Hello list,
I've found what it looks like a bug in XML handling in ConTeXt. Try this:

\startbuffer[test]

  
  Me  my friends; you  your friends.
  
  Me  my friends. You  your friends.
  
  Me  my friends; you  your friends.

\stopbuffer

\startxmlsetups xml:somesetups
  \xmlsetsetup{#1}{text}{xml:text}
  \xmlsetsetup{#1}{p}{xml:p}
\stopxmlsetups

\xmlregistersetup{xml:somesetups}

\startxmlsetups xml:text
  \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:p
  \xmlflush{#1}\par\blank[line]
\stopxmlsetups

\starttext
  \xmlprocessbuffer{main}{test}{}
\stoptext

In the first case, the ampersand and the following semicolon are eaten up.
I've found a way around, until the bug is fixed (if it's a bug and not my
limited knowledge of ConTeXt): put a XML comment after the ampersand,
and everything works as expected.
___
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] Ampersand followed by semicolon in XML: possible bug?

2015-09-29 Thread massifr
I've seen that the ampersand gets interpreted as HTML on the mailing list.
I'm sending the example as an attachment.

Here's a modified version to be seen on the mailing list site:
\startbuffer[test]

  
  Me amp; my friends; you amp; your friends.
  
  Me amp; my friends. You amp; your friends.
  
  Me amp; my friends; you amp; your friends.

\stopbuffer

\startxmlsetups xml:somesetups
  \xmlsetsetup{#1}{text}{xml:text}
  \xmlsetsetup{#1}{p}{xml:p}
\stopxmlsetups

\xmlregistersetup{xml:somesetups}

\startxmlsetups xml:text
  \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:p
  \xmlflush{#1}\par\blank[line]
\stopxmlsetups

\starttext
  \xmlprocessbuffer{main}{test}{}
\stoptext
\startbuffer[test]

  
  Me  my friends; you  your friends.
  
  Me  my friends. You  your friends.
  
  Me  my friends; you  your friends.

\stopbuffer

\startxmlsetups xml:somesetups
  \xmlsetsetup{#1}{text}{xml:text}
  \xmlsetsetup{#1}{p}{xml:p}
\stopxmlsetups

\xmlregistersetup{xml:somesetups}

\startxmlsetups xml:text
  \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:p
  \xmlflush{#1}\par\blank[line]
\stopxmlsetups

\starttext
  \xmlprocessbuffer{main}{test}{}
\stoptext___
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 expression to read HTML classes

2015-08-26 Thread massifr
A working example to clarify my request:

\startluacode
  -- splits the attribute class using spaces as classes' separator
  -- returns an array of strings
  function xml.functions.classes(classAttr)
local classes = {}
if classAttr then
  for c in string.gmatch(classAttr, %S+) do
if (string.len(c)  0) then classes[c] = true end
  end
end
return classes
  end

  function xml.expressions.hasClass(classAttr, className)
if classAttr and className then
  return xml.functions.classes(classAttr)[className] ~= nil
end
return false
  end
\stopluacode

\startbuffer[test]
text
  pGeneric paragraph (no class)./p
  p class=myClass1Emphasized paragraph (ttclass=myClass1/tt)./p
  p class=otherClass myClass1Another emphasized paragraph
  (but ttmyClass1/tt is not the only class specified).
  /p
  p class=myClass12Another not emphasized paragraph 
  (ttclass=myClass12/tt) showing why br/
  ttp[hasClass(@class, myClass1)]/ttbr/
  is better than br/
  ttp[@class=myClass1]/ttbr/
  or br/
  ttp[contains(@class, myClass1)]/tt.
  /p
  pttp[hasClass(myClass1)]/tt would be better 
  since it's obvious that the classes are specified 
  in the ttclass/tt attribute, but this means that 
  the lua expression needs to access the current selected element
  (ttll/tt?).
  /p
/text
\stopbuffer

\startxmlsetups xml:somesetups
  \xmlsetsetup{#1}{text}{xml:text}
  \xmlsetsetup{#1}{p}{xml:p}
  \xmlsetsetup{#1}{p[hasClass(@class, 'myClass1')]}{xml:p:myClass1}
  \xmlsetsetup{#1}{tt}{xml:tt}
  \xmlsetsetup{#1}{br}{xml:br}
\stopxmlsetups

\xmlregistersetup{xml:somesetups}

\startxmlsetups xml:text
  \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:p
  \xmlflush{#1}\par\blank[line]
\stopxmlsetups

\startxmlsetups xml:p:myClass1
  {\em\xmlflush{#1}}\par\blank[line]
\stopxmlsetups

\startxmlsetups xml:br
  \\
\stopxmlsetups

\startxmlsetups xml:tt
  \dontleavehmode{\tt\xmlflush{#1}}
\stopxmlsetups

\starttext
  \xmlprocessbuffer{main}{test}{}
\stoptext

Thanks in advance for any help,
Massi
___
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] XML expression to read HTML classes

2015-08-25 Thread massifr
Hello list,
I'm working on HTML typesetting with ConTeXt.
I wrote a custom expression to test whether an element has a class:

function xml.functions.classes(classAttr)
  local classes = {}
  if classAttr then
for c in string.gmatch(classAttr, %S+) do
  if (string.len(c)  0) then classes[c] = true end
end
  end
  return classes
end

function xml.expressions.hasClass(classAttr, className)
  if classAttr and className then
return xml.functions.classes(classAttr)[className] ~= nil
  end
  return false
end

This way I can write this in my xmlsetup:
\xmlsetsetup{#1}{p[hasClass(@class,'myclass1')]}{html:p:myclass1}

That is better than 
- p[@class='myclass1']   (it fails when you have more classes)
- p[contains(@class, 'myclass1')](it gives you false positives when you 
have class=myclass12)

That works, but I would like to write:
\xmlsetsetup{#1}{p[hasClass('myclass1')]}{html:p:myclass1}

omitting the @class argument, because it's obvious.
To omit it I need to access the current collected element.

At page 25 of Dealing with XML in ConTeXt MkIV it is said 
that the predefined variables list,l,ll (I think I need that one)
and order are available, but I did not manage to access them.

How can I get the current element in Lua to write
local classAttr = xml.attribute(currentElement, , class)   ?

Thanks in advance,
Massi
___
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] line break between number and footnote text in paragraph footnotes

2015-04-01 Thread massifr
 On 4/1/2015 12:15 AM, mf wrote:
  Hello,
  I have a problem with paragraph footnotes. I don't know how to prevent a
  line break occurring between the footnote number and the footnote text.
  Sometimes a thing like this happens:
 
  ... [main text] ...
 
  --
  1. text of the first footnote --- 2. text of the second one --- 3.
  text of the third one
 
  Is there a way to force ConTeXt to keep the 3. with text of the third
  one?
 
 example needed
 
 -
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
   | www.pragma-pod.nl
 -

Here it is:

\definenote[footnote]
\setupnotation[footnote][
  alternative=serried,
  numberstopper=, 
  numbercommand={\high},  
  numberconversion=a, 
  way=bypage, 
  width=0.5pt,
  location=page]

\setupnote[footnote][
  alternative=serried,
  paragraph=yes,
  inbetween= \emdash{} ,
  location=page,
  before={\blank[2*line]}]

\starttext
First footnote\footnote{this is the text of the first footnote}. Another
one\footnote{the second one, longer to get to the right margin}.
And the third one,\footnote{third footnote} with the “c” letter 
separated by a line break from the footnote text.
\stoptext

I'm using the ConTeXt package from Debian testing, version 
2014.05.21.20140528-2.
Here's the output of context --version:
mtx-context | ConTeXt Process Management 0.60
mtx-context |
mtx-context | main context file: 
/usr/share/texmf/tex/context/base/context.mkiv
mtx-context | current version: 2014.05.21 22:04


___
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] paragraph footnotes line height

2015-03-09 Thread massifr
On 03/07/2015 10:59 AM, Wolfgang Schuster wrote:
 Am 07.03.2015 um 00:08 schrieb mf:
 I'd like to know how I can set the line height of paragraph footnotes.
 [...]
 
 \startsetups[footnote:interlinespace]
   \setupinterlinespace[line=10pt]
 \stopsetups
 
 \setupnote[footnote][setups=footnote:interlinespace]

Wolfgang,

this doesn’t work with paragraph footnotes:

\startsetups[setups:footnote]
  \setupinterlinespace[line=8ex]
\stopsetups

\setupnotation[footnote][
  alternative=serried,
  numbercommand=\high,
  numberconversion=a,
  way=bypage,
  width=0pt,
]
\setupnote[footnote][
  paragraph=yes,
  inbetween= \emdash{} ,
  setups=setups:footnote,
]

\starttext
\dorecurse{2}{These are footnotes\footnote{\input knuth}. }
\stoptext

Is it a bug?


Pablo

This problem was already outlined here: 
http://www.ntg.nl/pipermail/ntg-context/2007/024384.html

Is it a bug or a feature that has not been implemented?
I know that paragraph footnotes are less common, but a smaller font with the 
same line space of the main text is ugly.
Is there a workaround? Where should I look for a solution?
I tried to modify the interline space in before parameter, without success.
I looked at strc-not.mkvi, but it's too difficult for me (at least for now), 
since I'm new to ConTeXt (and TeX).
Any suggestions?
Thanks in advance,
Massi
___
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] inline footnotes

2015-01-30 Thread massifr
Hello,
I'd like to know how to get inline footnotes with ConTeXt.
There are some packages in LaTeX (option para in footmisc, manyfoot, bigfoot) 
providing that feature.
How can I do that in ConTeXt?
Thanks,
Massi
___
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
___