Re: [NTG-context] Maximum width of a caption

2015-01-05 Thread Hans Hagen

On 1/5/2015 11:22 AM, Mojca Miklavec wrote:

On Sun, Jan 4, 2015 at 12:30 PM, Hans Hagen wrote:

On 1/3/2015 11:11 AM, Mojca Miklavec wrote:


Hi,

Is there any way to set the maximum width of a caption? I would like
to make sure that no figure caption exceeds, say, 75% of text width.

Here's an example of bad behaviour in the second figure:

\starttext

\reservefigure
[width=5cm,height=2cm,frame=on][force]
{Some very small figure with not too much text: OK}

\input tufte

This can hardly be distinguished from the main text:

\reservefigure
[width=\textwidth,height=.2\textwidth,frame=on][force]
{\input tufte}

\input tufte

Desired behaviour:

\placefigure[force]{\input tufte}
{\hbox to
.75\textwidth{\hss\framed[width=\textwidth,height=.2\textwidth]{}\hss}}

\input tufte

\stoptext

I've seen an option maxwidth, but only in connection to
\externalfigure[...][maxwidth=...].

I can cheat as on the third figure above, but that seems like an ugly
approach to me.



can you test this a bit:

\unprotect

\setupcaptions
   [\c!maxwidth=.75\hsize]


Thank you very much. The patch that you sent me for strc-flt.mkvi
seems to work as expected on a long document with many figures.

The only exception are one-liners. The following creates a caption
that extends to almost the whole text width:

 \placefigure
   % Why are there two spaces between dummy and text?
   {Some \dorecurse{7}{dummy } text}
   {\externalfigure[dummy][width=\textwidth,height=.2\textwidth]}

As soon as slightly more text is added, it shrinks to the desired text width.


oneliners have a separate branch



(But then again I'm not sure if that is a bug or a feature ;)

Mojca
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___




--

-
  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] Maximum width of a caption

2015-01-05 Thread Mojca Miklavec
On Sun, Jan 4, 2015 at 12:30 PM, Hans Hagen wrote:
 On 1/3/2015 11:11 AM, Mojca Miklavec wrote:

 Hi,

 Is there any way to set the maximum width of a caption? I would like
 to make sure that no figure caption exceeds, say, 75% of text width.

 Here's an example of bad behaviour in the second figure:

 \starttext

 \reservefigure
 [width=5cm,height=2cm,frame=on][force]
 {Some very small figure with not too much text: OK}

 \input tufte

 This can hardly be distinguished from the main text:

 \reservefigure
 [width=\textwidth,height=.2\textwidth,frame=on][force]
 {\input tufte}

 \input tufte

 Desired behaviour:

 \placefigure[force]{\input tufte}
 {\hbox to
 .75\textwidth{\hss\framed[width=\textwidth,height=.2\textwidth]{}\hss}}

 \input tufte

 \stoptext

 I've seen an option maxwidth, but only in connection to
 \externalfigure[...][maxwidth=...].

 I can cheat as on the third figure above, but that seems like an ugly
 approach to me.


 can you test this a bit:

 \unprotect

 \setupcaptions
   [\c!maxwidth=.75\hsize]

Thank you very much. The patch that you sent me for strc-flt.mkvi
seems to work as expected on a long document with many figures.

The only exception are one-liners. The following creates a caption
that extends to almost the whole text width:

\placefigure
  % Why are there two spaces between dummy and text?
  {Some \dorecurse{7}{dummy } text}
  {\externalfigure[dummy][width=\textwidth,height=.2\textwidth]}

As soon as slightly more text is added, it shrinks to the desired text width.

(But then again I'm not sure if that is a bug or a feature ;)

Mojca
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Using Euler with simplefonts

2015-01-05 Thread Kumar Appaiah
On Thu, Jan 01, 2015 at 03:52:53PM +0100, Wolfgang Schuster wrote:
You don’t have the opentype version [1] of the euler math font on your
system which is needed when you either the \definefontfamily command
or the pagellaovereuler typescript.
When you install the font on your system you can use it as shown
in the following example.
\definefontfamily [myfamily] [serif] [Linux Libertine O]
\definefontfamily [myfamily] [math]  [Neo Euler]
\setupbodyfont [myfamily]
\starttext
\m{c^2 = a^2 + b^2}
\stoptext
[1] [2]https://github.com/khaledhosny/euler-otf

Indeed, getting the OTF fixed all the issues. Thanks Wolfgang and John!

Kumar
-- 
Kumar Appaiah
___
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] Define a new command from the command \periods[n]

2015-01-05 Thread Hans Hagen

On 1/5/2015 6:58 PM, Fabrice wrote:

Hi,
How to make the dotted lines stop at the edge of the frame?


\definefiller[dots][left=\dontleavehmode,right=\hskip\zeropoint]
\definecolor[H1prime][c=0.50, m=0.00, y=1.00, k=0.00]
\definecolor[H4][c=0.07, m=0.00, y=0.15, k=0.00]
\starttext
\startitemize[n][stopper={.},style=bold]
\placefigure[right,none]{}{
\startframedtext[
width=6cm,
frame=on,
framecolor=H1prime,
location=middle,
background=color,
backgroundcolor=H4]
\switchtobodyfont[10pt]
Ingrédients (pour 4 personnes)
\startitemize[1]
\item \unit{1 kg} de pommes de terre
\item \unit{60 g} de fromage râpé
\item \unit{25 Centiliter} de crème fraîche
\stopitemize
\stopframedtext
}
\item
\filler[dots]

\filler[dots]

\filler[dots]

\filler[dots]

\stopitemize
\stoptext

Best regards,
Fabrice


\definefiller[dots][left=\dontleavehmode,right=\hskip\zeropoint\par]

\definefloat
  [recipe]
  [figure]

\setupfloat
  [recipe]
  [default={right,none}]

\defineframed
  [myframed]
  [width=6cm,
   foregroundstyle={\switchtobodyfont[10pt]},
   align={high,flushleft},
   frame=on,
   framecolor=red,
   background=color,
   backgroundcolor=lightgray]

\starttext

\startbuffer
Ingrédients (pour 4 personnes)
\startitemize[1]
\startitem \unit{1 kg} de pommes de terre \stopitem
\startitem \unit{60 g} de fromage râpé \stopitem
\startitem \unit{25 Centiliter} de crème fraîche \stopitem
\stopitemize
\stopbuffer

\placerecipe
  {}
  {\myframed{\getbuffer}}

\startitemize[n][stopper={.},style=bold]
\startitem
\dorecurse{5}{\filler[dots]}
\stopitem
\stopitemize

\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] pgfplots.revision.tex is missing in the last ContextMinimals

2015-01-05 Thread DesdeChaves
Dear Sirs

In the last ContextMinimals the file pgfplots.revision.tex is missing.
This file is required by the pgfplots module.

Happy New Year 2015 to all members

Jorge
___
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] plot data from file: cld

2015-01-05 Thread John Kitzmiller
On Jan 5, 2015, at 5:51 AM, Hans Hagen pra...@wxs.nl mailto:pra...@wxs.nl 
wrote:

 On 1/4/2015 6:04 AM, Akira Kakuto wrote:
 Dear John,
 
 How to make this a polygon?
 
 An example:
 
 \starttext
 \startluacode
 local metafun = context.metafun
 metafun.start()
 io.input(DATA)
 local i, j
 local x, y, s, t1, t2
 i = 1
 x={}
 y={}
 s=draw 
 while true do
  x[i], y[i] = io.read(*n, *n)
  if not x[i] then break end
  metafun(filldraw fullcircle scaled 2mm shifted(%dcm,%dcm);,x[i],y[i])
  i = i + 1
 end
 i = i - 1
 for j = 1, i do
  t1 = tostring(x[j])
  t2 = tostring(y[j])
  s = s..(..t1..cm,..t2..cm)--
 end
 t1 = tostring(x[1])
 t2 = tostring(y[1])
 s = s..(..t1..cm,..t2..cm)
 s = s.. withpen pencircle scaled 1bp;
 metafun(s)
 metafun.stop()
 \stopluacode
 \stoptext
 
 Here is a bit more compact version. A path can normally nicely be concat 
 using -- or .. and we have a metafun helper drawpoints.
 
 \starttext
 \startluacode
 context.metafun.start()
 local split = utilities.parsers.csvsplitter { separator =   }
 local data = split(io.loaddata(data.txt))
 for i=1,#data do
 data[i] = string.formatters[(%s,%s)](unpack(data[i]))
 end
 context.metafun(path p ; p := (%s -- cycle) scaled cm 
 ;,table.concat(data,--))
 context.metafun(draw   p withpen pencircle scaled 0.25mm ;)
 context.metafun(drawpoints p withpen pencircle scaled 2.00mm ;)
 context.metafun.stop()
 \stopluacode
 \stoptext

Thank you Hans. A few tools new to me in there!

I am wondering (and will try to find) if multiple paths could be contained in 
the external file— a marker and test structure?

Thanks again,

John




___
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] Define a new command from the command \periods[n]

2015-01-05 Thread Fabrice

Hi,
How to make the dotted lines stop at the edge of the frame?


\definefiller[dots][left=\dontleavehmode,right=\hskip\zeropoint]
\definecolor[H1prime][c=0.50, m=0.00, y=1.00, k=0.00]
\definecolor[H4][c=0.07, m=0.00, y=0.15, k=0.00]
\starttext
\startitemize[n][stopper={.},style=bold]
\placefigure[right,none]{}{
\startframedtext[
width=6cm,
frame=on,
framecolor=H1prime,
location=middle,
background=color,
backgroundcolor=H4]
\switchtobodyfont[10pt]
Ingrédients (pour 4 personnes)
\startitemize[1]
\item \unit{1 kg} de pommes de terre
\item \unit{60 g} de fromage râpé
\item \unit{25 Centiliter} de crème fraîche
\stopitemize
\stopframedtext
}
\item
\filler[dots]

\filler[dots]

\filler[dots]

\filler[dots]

\stopitemize
\stoptext

Best regards,
Fabrice
___
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
___