[NTG-context] Command that does not give the expected result (Metafun)

2015-08-09 Thread Fabrice Couvreur
Hi Hans,
In the document Metafun, you use commands that I like, and I try to
understand the definition and operation, which is not always easy with TeX
commands.
Also, in the following code, this does not give the expected result.
Thank you.
Fabrice

\showframe

\setupcolors
  [state=start]

\setuppagenumbering[location=,alternative]

\startuniqueMPgraphic{titled}
path p ;
p := unitsquare xscaled OverlayWidth yscaled OverlayHeight ;
pickup pencircle scaled 1mm ;
drawoptions(withcolor .625yellow) ;
draw llcorner p--lrcorner p ;
setbounds currentpicture to p ;
\stopuniqueMPgraphic

\defineoverlay[titled][\uniqueMPgraphic{titled}]

\def\ChapterCommand#1#2%
  {\setbox0=\hbox to \leftmarginwidth{#1\hss}%
   \hskip-\leftmarginwidth
   \hskip-\leftmargindistance
   \framed
 [background=titled,frame=off,offset=0pt]
 {\box0
  \hskip\leftmargindistance
  #2}}

\setuphead
  [chapter,section,subsection]
  [command=\ChapterCommand,
   color=darkred]

\starttext
\chapter{First}
\section{First}
\subsection{First}
\stoptext


ntg29.pdf
Description: Adobe PDF document
___
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] Can \getmarking take more than one argument?

2015-08-09 Thread tala...@fastmail.fm
Many thanks, Hans, as that seems to have done the trick!

 On 9 Aug 2015, at 11:59, Hans Hagen pra...@wxs.nl wrote:
 
 On 8/9/2015 2:42 AM, tala...@fastmail.fm mailto:tala...@fastmail.fm wrote:
 Hello,
 
 I currently use the following to define my even and odd page headers.
 
 —
 \startsetups[header]
   {\doifoddpageelse
  {\getmarking[section]}
  {\getmarking[chapter]}
  }
   \doiftextelse
  {\getmarking[chapter]}
 \stopsetups
 —
 
 The problem is that some of my ‘section’s are not sections, but ‘subject’s 
 (because I don’t want that section heading to appear in the TOC). As a 
 result, my header is blank on the ‘subject’ pages.
 
 Is it possible to define getmarking to take either a section or a subject, 
 somehow? Listing them both separated by a coma 
 (\getmarking[section,subject]) produced no result. I also tried:
 —
   {\doifoddpageelse
  {\getmarking[section]}
  {\getmarking[subject]}
  {\getmarking[chapter]}
 —
 …but that caused the subject and the chapter to both be printed in the 
 header.
 
 Many thanks for any help.
 
 \setupheadertexts[{\getmarking[section]}]
 \definehead[suction][section][number=no]
 
 \starttext
\placelist[section] \page
\section{foo} \page
\suction{bar} \page
 \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 
 http://www.pragma-ade.com/
 | www.pragma-pod.nl 
 http://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
 ___

___
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] m-graph read data and plot

2015-08-09 Thread Alan BRASLAU
On Fri, 7 Aug 2015 13:00:47 -0400
John Kitzmiller k...@inradius.net wrote:

 Thank you Alan. setrange is the key I had not tried and I will be
 more careful with (2).
 
 This may not be the proper way to ask, but it is related to the
 topic: how to get Hobby’s Figure 9 from the mpgraph manual to work
 using m-graph?
 
 http://ctan.org/tex-archive/systems/doc/metapost/source-manual
 http://ctan.org/tex-archive/systems/doc/metapost/source-manual
 
 Thanks again,
 John

\usemodule [graph]

\startMPpage [instance=graph]

draw begingraph(3in,2in);
  glabel.lft(btex \vbox{\hbox{Quadrillions}\hbox{of BTU}} etex, OUT);
  path p[];
  numeric t;
  gdata(energy.d, $,
t:=0; augment.p1($1,0);
for j=2 upto 5:
t:=t+scantokens $[j]; augment.p[j]($1,t);
endfor)
  picture lab[];
  lab2=btex coal etex; lab3=btex crude oil etex;
  lab4=btex natural gas etex; lab5=btex hydroelectric etex;
  for j=5 downto 2:
  gfill p[j]--reverse p[j-1]--cycle withcolor .16j*white;
  glabel.lft(image(unfill bbox lab[j]; draw lab[j]), .7+length p[j]);
  endfor
endgraph;
closefrom energy.d ;

\stopMPpage



One needs to think about closing the data file as ConTeXt opens a single
MP instance that is run throughout the entire document AND over its
multiple runs. If the file is left open, a second run will try to read
on from the point where it left off.

THIS IS A SUBTLE POINT THAT SHOULD BE NOTICED BY ALL MPLIB USERS!

Alan
-- 
Alan Braslau
CEA DSM-IRAMIS-SPEC
CNRS UMR 3680
Orme des Merisiers
91191 Gif-sur-Yvette cedex FRANCE
tel: +33 1 69 08 73 15
fax: +33 1 69 08 87 86
mailto:alan.bras...@cea.fr
___
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] Documentation: full list of commands

2015-08-09 Thread Hans Hagen

On 8/9/2015 10:26 AM, juh wrote:

Hello,

even though the commands in the autogenerated command list
(http://www.pragma-ade.com/general/qrcs/setup-en.pdf) are not commented
the document is useful to me.

In a MWE on this list I saw the command \doifoddpage which is not in the
list.

Wiki and even Google does not find anything about this command. I think
that I kind of understand the command, but I wonder how many commands
are out there I've never heard of.

So my question: Is it possible to have a complete list of all commands
used in ConTeXt?


commands come in layers:

- general low level  : you can find a list of them in mult-low.lua (i 
sometimes add to them)


- specific low level : like the one you mention, these are normally 
quite stable (read: you can use them as they will stay around), there 
are quite some \doif* ones (no list, one needs to look into the source 
code re;ated to it) ... i have no time to make a list but if someone ...


- frequently used high level commands with low level fast callers : 
\framed sits in this category


- high level commands : lots of \setup, \define, \start and so ... we 
share the systematics as much as possible (also options)


- then there are defined commands (and users can add to them) : specific 
instances of section heads, verbatim, fonts etc


(some of the more obscure commands are described in articles and 
dedicated manuals)


Hans

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

Re: [NTG-context] Can \getmarking take more than one argument?

2015-08-09 Thread Hans Hagen

On 8/9/2015 2:42 AM, tala...@fastmail.fm wrote:

Hello,

I currently use the following to define my even and odd page headers.

—
\startsetups[header]
   {\doifoddpageelse
{\getmarking[section]}
{\getmarking[chapter]}
}
   \doiftextelse
{\getmarking[chapter]}
\stopsetups
—

The problem is that some of my ‘section’s are not sections, but ‘subject’s 
(because I don’t want that section heading to appear in the TOC). As a result, 
my header is blank on the ‘subject’ pages.

Is it possible to define getmarking to take either a section or a subject, 
somehow? Listing them both separated by a coma (\getmarking[section,subject]) 
produced no result. I also tried:
—
   {\doifoddpageelse
{\getmarking[section]}
{\getmarking[subject]}
{\getmarking[chapter]}
—
…but that caused the subject and the chapter to both be printed in the header.

Many thanks for any help.


\setupheadertexts[{\getmarking[section]}]
\definehead[suction][section][number=no]

\starttext
\placelist[section] \page
\section{foo} \page
\suction{bar} \page
\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
___

[NTG-context] Documentation: full list of commands

2015-08-09 Thread juh
Hello,

even though the commands in the autogenerated command list
(http://www.pragma-ade.com/general/qrcs/setup-en.pdf) are not commented
the document is useful to me.

In a MWE on this list I saw the command \doifoddpage which is not in the
list.

Wiki and even Google does not find anything about this command. I think
that I kind of understand the command, but I wonder how many commands
are out there I've never heard of.

So my question: Is it possible to have a complete list of all commands
used in ConTeXt?


juh


-- 
Software-Dokumentation mit Sphinx
http://www.amazon.de/dp/1497448689/
Paperback: 224 Seiten
___
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] Text around a figure in a framedtext

2015-08-09 Thread Fabrice Couvreur
Hi Wolfgang,
Thank you for all these explanations that make me progress in the use of
Context.
Fabrice

2015-08-08 10:40 GMT+02:00 Wolfgang Schuster schuster.wolfg...@gmail.com:

 Fabrice Couvreur fabrice1.couvr...@gmail.com
 8. August 2015 00:49
 Hi,
 Why the text does not move in the first framedtext like the second
 framedtext ?

 You have to use \starthanging instead of \placefgure when you’re in a
 frame.

 \starttext

 \startframedtext[width=max]
 \starthanging[location=right]
 {\startMPcode
  draw unitsquare scaled 2cm ;
  \stopMPcode}
 \input tufte
 \stophanging
 \stopframedtext

 \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

 ___

___
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] issues with typeface selection

2015-08-09 Thread Wolfgang Schuster

Hans Hagen mailto:pra...@wxs.nl
9. August 2015 19:02


hm, hard to catch (esp if we want to do that everywhere it will be a 
slow downer) ... i'll do it for cells but so far other mechanisms were 
less sensitive for this (we'd need an extension to luatex for handling 
such cases ... maybe i'll look into that later)
Shouldn’t be something like this enough (even though a better solution 
to prevent expension here would be nice):


\unexpanded\def\tabl_x_start_cell_delayed_one[#tag]%
% {\ifcsname\namedxtablehash{#tag}\s!parent\endcsname
- {\ifcsname\??xtablecheck#tag\endcsname
+ {\ifcsname\??xtablecheck\detokenize\expandafter{#tag}\endcsname
 \expandafter\tabl_x_start_cell_delayed_two
   \else
 \expandafter\tabl_x_start_cell_yes
   \fi[#tag]}

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] Command that does not give the expected result (Metafun)

2015-08-09 Thread Hans Hagen

On 8/9/2015 1:27 PM, Fabrice Couvreur wrote:

Hi Hans,
In the document Metafun, you use commands that I like, and I try to
understand the definition and operation, which is not always easy with
TeX commands.
Also, in the following code, this does not give the expected result.
Thank you.
Fabrice

\showframe

\setupcolors
   [state=start]

\setuppagenumbering[location=,alternative]

\startuniqueMPgraphic{titled}
path p ;
p := unitsquare xscaled OverlayWidth yscaled OverlayHeight ;
pickup pencircle scaled 1mm ;
drawoptions(withcolor .625yellow) ;
draw llcorner p--lrcorner p ;
setbounds currentpicture to p ;
\stopuniqueMPgraphic

\defineoverlay[titled][\uniqueMPgraphic{titled}]

\def\ChapterCommand#1#2%
   {\setbox0=\hbox to \leftmarginwidth{#1\hss}%
\hskip-\leftmarginwidth
\hskip-\leftmargindistance
\framed
  [background=titled,frame=off,offset=0pt]
  {\box0
   \hskip\leftmargindistance
   #2}}

\setuphead
   [chapter,section,subsection]
   [command=\ChapterCommand,
color=darkred]

\starttext
\chapter{First}
\section{First}
\subsection{First}
\stoptext


\unexpanded\def\ChapterCommand#1#2%

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

Re: [NTG-context] Text around a figure in a framedtext

2015-08-09 Thread Jeong Dal
Dear Otared and Wolfgang,

It works fine after replacing the text itself.
Thank you for the info.

Best regards,

Dalyoung

___
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] issues with typeface selection

2015-08-09 Thread Hans Hagen

On 8/9/2015 8:24 PM, Wolfgang Schuster wrote:

Hans Hagen mailto:pra...@wxs.nl
9. August 2015 19:02


hm, hard to catch (esp if we want to do that everywhere it will be a
slow downer) ... i'll do it for cells but so far other mechanisms were
less sensitive for this (we'd need an extension to luatex for handling
such cases ... maybe i'll look into that later)

Shouldn’t be something like this enough (even though a better solution
to prevent expension here would be nice):

\unexpanded\def\tabl_x_start_cell_delayed_one[#tag]%
% {\ifcsname\namedxtablehash{#tag}\s!parent\endcsname
- {\ifcsname\??xtablecheck#tag\endcsname
+ {\ifcsname\??xtablecheck\detokenize\expandafter{#tag}\endcsname
  \expandafter\tabl_x_start_cell_delayed_two
\else
  \expandafter\tabl_x_start_cell_yes
\fi[#tag]}


you're close, the catch i referred to is:


{\ifcsname\??xtablecheck\detokenize\expandafter{\normalexpanded{#tag}}\endcsname

because we need at least some expansion

Hans


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

Re: [NTG-context] issues with typeface selection

2015-08-09 Thread Pablo Rodriguez
On 08/08/2015 04:18 PM, Wolfgang Schuster wrote:
 [...]
 All I can tell at the moment is that the problem is related to the “x”
 font size.
 
 \starttext
 
 \startxtable
 \startxrow
 \startxcell[foregroundstyle=\txx] % this fails: foregroundstyle=\tx
 \CONTEXT
 \stopxcell
 \stopxrow
 \stopxtable
 
 \stoptext

Wolfgang,

I’m afraid that compilation also crashes with font commands in
foregroundstyle:

\definefontfamily[newtimes][serif][TeX Gyre Termes]
\setupbodyfont[palatino, 12pt]
\setuphead[section][style=\newtimes\tfx]
\starttext
\section{Comparision}
\startxtable
\startxrow
\startxcell[foregroundstyle=\newtimes] \ConTeXt\stopxcell
\stopxrow
\stopxtable
\stoptext


Pablo
-- 
http://www.ousia.tk
___
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] issues with typeface selection

2015-08-09 Thread Hans Hagen

On 8/9/2015 4:06 PM, Pablo Rodriguez wrote:

On 08/08/2015 04:18 PM, Wolfgang Schuster wrote:

[...]
All I can tell at the moment is that the problem is related to the “x”
font size.

\starttext

\startxtable
 \startxrow
 \startxcell[foregroundstyle=\txx] % this fails: foregroundstyle=\tx
 \CONTEXT
 \stopxcell
 \stopxrow
\stopxtable

\stoptext


Wolfgang,

I’m afraid that compilation also crashes with font commands in
foregroundstyle:

 \definefontfamily[newtimes][serif][TeX Gyre Termes]
 \setupbodyfont[palatino, 12pt]
 \setuphead[section][style=\newtimes\tfx]
 \starttext
 \section{Comparision}
 \startxtable
 \startxrow
 \startxcell[foregroundstyle=\newtimes] \ConTeXt\stopxcell
 \stopxrow
 \stopxtable
 \stoptext


hm, hard to catch (esp if we want to do that everywhere it will be a 
slow downer) ... i'll do it for cells but so far other mechanisms were 
less sensitive for this (we'd need an extension to luatex for handling 
such cases ... maybe i'll look into that later)


as i don't upload today you can test

\setupxtable[newtimes][foregroundstyle=\newtimes]
\startxcell[newtimes]  ...\stopxcell



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