[NTG-context] Changing default rule thickness (globally)

2020-03-25 Thread Benjamin Buchmuller
Hi!

I would like to change the rule thickness that is used by default in ConTeXt. 
However, from the  command documentation 
(http://www.pragma-ade.nl/general/qrcs/setup-en.pdf), I see that I would need 
to basically change this for

\basegrid[rulethickness=...]
\setupbar[rulethickness=...]
\setupchemical[rulethickness=...]
\setupeffect[rulethickness=...]
\setupfillinlines[rulethickness=...]
\setupfillinrules[rulethickness=...]
\setupframed[rulethickness=...]
\setuplinefillers[rulethickness=...]
\setupmarginrules[rulethickness=...]
\setupmixedcolumns[rulethickness=...]
\setupnote[rulethickness=...]
\setupparagraphs[rulethickness=...]
\setupsidebar[rulethickness=...]
\setuptables[rulethickness=...]
\setuptabulation[rulethickness=...]
\setuptextbackground[rulethickness=...]
\setuptextrules[rulethickness=...]
\setupthinrules[rulethickness=...]
\setupxtable[rulethickness=...]

(And for \setupbackgrounds for [top header text footer bottom].) I’m sure there 
is a more elegant way to do this. But how?

Cheers


Benjamin
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
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] Fwd: Need help with \definetabulate

2012-10-16 Thread Hans Hagen

On 16-10-2012 13:23, Wolfgang Schuster wrote:


Am 16.10.2012 um 13:08 schrieb Hans Hagen pra...@wxs.nl:


On 16-10-2012 12:52, Sietse Brouwer wrote:

The problem is that \starttabulate does not accept a format parameter.

Cheap solution (only figured it out now, or I'd have replied before): use

\setuptabulate[alpha][format={}]

before every \startalpha call.
It's not very contexty syntax, but on the other hand it requires no
new definitions at all.

Full example below.
Cheers,
Sietse

\definetabulate[alpha][|l|] % dummy format
\setuptabulate[alpha][style=bold]

\setuptabulate[alpha][format={|r|r|r|}]
\startalpha
\NC r \NC r \NC r \NC \NR
\NC test \NC test \NC test \NC \NR
\stopalpha

\setuptabulate[alpha][format={|c|c|}]
\startalpha
\NC c \NC c \NC \NR
\NC test \NC test \NC \NR
\stopalpha


There's also:

\starttext

\definetabulate
  [whatever]
  [|l|r|]

\definetabulate
  [whatever][else]
  [|l|c|r|]

\startwhatever
\NC l\NC r \NC \NR
\NC left \NC right \NC \NR
\stopwhatever

\startwhatever[else]
\NC l\NC m  \NC r \NC \NR
\NC left \NC middle \NC right \NC \NR
\stopwhatever

\stoptext


Can you add a second argument to custom tabulation which would allow one to 
write

   \startwhatever[format={…}]

or

   \startwhatever[else][format={…}]

to change the number of columns and format for a certain table.


I wonder is someone can remember this ...

\unprotect

\unexpanded\def\tabl_start_defined[#1]%
  {\bgroup
   \edef\currenttabulationparent{#1}%
   \let\currenttabulation\currenttabulationparent
   \dodoubleargument\tabl_start_defined_indeed}

\def\tabl_start_defined_indeed
  {\iffirstargument
 \ifsecondargument
   \doubleexpandafter\tabl_start_defined_two
 \else
   \doubleexpandafter\tabl_start_defined_one
 \fi
   \else
  \singleexpandafter\tabl_start_defined_zero
   \fi}

\def\tabl_start_defined_one[#1][#2]%
  {\doifassignmentelse{#1}
 {\setuptabulation[\currenttabulation][#1]}%
 {\edef\currenttabulation{\currenttabulation:#1}}%
   \tabl_tabulate_start_building}

\def\tabl_start_defined_two[#1][#2]%
  {\edef\currenttabulation{\currenttabulation:#1}%
   \setuptabulation[\currenttabulation][#2]%
   \tabl_tabulate_start_building}

\def\tabl_start_defined_zero[#1][#2]%
  {\tabl_tabulate_start_building}


\protect

\starttext

\definetabulate
  [whatever]
  [|l|r|]

\definetabulate
  [whatever][else]
  [|l|c|r|]

\startwhatever
\NC l\NC r \NC \NR
\NC left \NC right \NC \NR
\stopwhatever

\startwhatever[else]
\NC l\NC m  \NC r \NC \NR
\NC left \NC middle \NC right \NC \NR
\stopwhatever

\startwhatever[else][format={|c|c|c|c|}]
\NC l\NC m  \NC m  \NC r \NC \NR
\NC left \NC middle \NC middle \NC right \NC \NR
\stopwhatever

\stoptext

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