ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: framed with titles
       [not found] <mailman.1.1509879601.14103.ntg-context@ntg.nl>
@ 2017-11-05 12:23 ` Jeong Dal
  0 siblings, 0 replies; 10+ messages in thread
From: Jeong Dal @ 2017-11-05 12:23 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 1300 bytes --]

Dear Javier,

There is a nice sample (‘FunnyFrame’ and ‘\FrameTitle’) which you can find in metafun manual.(metafun-p.pdf or metafun-s.pdf)
I used it a lot with a little modification.

I hope that is what you want.

cheers,

Dalyoung

> 2017. 11. 5. 오후 8:00, ntg-context-request@ntg.nl 작성:
> 
> Subject: [NTG-context] framed with titles
> Message-ID: <bb2fd6ca-0f8b-6955-9b17-a765ba489f8f@us.es <mailto:bb2fd6ca-0f8b-6955-9b17-a765ba489f8f@us.es>>
> Content-Type: text/plain; charset=utf-8; format=flowed
> 
> Hi,
> 
> I'm trying to generate a frame with a title.
> 
> My first idea is something like (ASCII Art):
> 
> +- Title  -------------+
> |  Text text text text |
> |  more and more text  |
> +----------------------+
> 
> A frame with title breaking the top line .
> 
> But I am not picky and something like beamer floating boxes (theorem, 
> proof, ...) for latex is good for me too.
> 
> In wiki, the frames doesn't have title and I'm not sure about if I have 
> to fight with overlays, with MP and this is out of my league.
> 
> Questions:
> 
> * what is the way for implement a title in the frame?
> 
> * Could you write a minimal example witch allows me to complete it for 
> my needs?
> 
> Thanks.
> 
> Javier M. Mora
> 


[-- Attachment #1.2: Type: text/html, Size: 20080 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

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

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

* Re: framed with titles
       [not found] <mailman.1513.1512287889.1988.ntg-context@ntg.nl>
@ 2017-12-03 14:42 ` Jeong Dal
  0 siblings, 0 replies; 10+ messages in thread
From: Jeong Dal @ 2017-12-03 14:42 UTC (permalink / raw)
  To: list ntg-context@ntg.nl ntg-context@ntg.nl ntg-context@ntg.nl
	ntg-context@ntg.nl

Dear Pablo,

I also think that it is good to collect styles for math people in the wiki.
However, I have no experience to add something to the wiki, so I don’t know how.
I may try first and if I can’t, I’ll may ask your help.

I should mention again that these examples are not possible without Wolfgang’s solution.

Thank you.

Best regards,

Dalyoung

> 
> would it be possible that you add both samples to the wiki?
> 
> This is the best way to have a reference for future needs.
> 
___________________________________________________________________________________
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
___________________________________________________________________________________

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

* Re: framed with titles
  2017-12-02 23:11 ` Jeong Dal
@ 2017-12-03  7:27   ` Pablo Rodriguez
  0 siblings, 0 replies; 10+ messages in thread
From: Pablo Rodriguez @ 2017-12-03  7:27 UTC (permalink / raw)
  To: ntg-context

Hi Dalyoung,

would it be possible that you add both samples to the wiki?

This is the best way to have a reference for future needs.

Pablo


On 12/03/2017 12:11 AM, Jeong Dal wrote:
> Hi,
> 
> Some days ago, I asked a method to put theorem numbers in a framed title.
> Recently, Wolfgang gave me a solution which worked very well.
> 
> Although the first one is much simpler than the second, I’d like to show
> two samples made by his suggestion. 
> I hope that it may help someone who has the similar problem.
> 
> Thanks Wolfgang again.
> 
> Best regards,
> 
> Dalyoung
> 
> %%%%%%%%%% first method
> %1. use \enumerationparameter{text} and add “text=Theorem” in
> \defineenumeration.
> %%%%%%%%%%%
> \defineframed
>   [FunnyFramed]
>   [frame=off,
>    loffset=1ex,
>    roffset=1ex,
>    foregroundstyle=\ssbf]
> 
> \startuseMPgraphic{FunnyFrame}
>     picture p ; numeric o ; path a, b ; pair c ;
>     p := textext.rt("\FunnyFramed{\enumerationparameter{text}
> \convertedcounter[Theorem]}") ;
>     o := BodyFontSize ;
>     a := unitsquare xyscaled (OverlayWidth,OverlayHeight) ;
>     p := p shifted (2o,OverlayHeight-ypart center p) ;
>     drawoptions (withpen pencircle scaled 1pt withcolor .625red) ;
>     b := a superellipsed .95 ;
>     draw b ;
>     b := (boundingbox p) superellipsed .95 ;
>     fill b withcolor .85white ;
>     draw b ;
>     draw p withcolor black ;
>     setbounds currentpicture to a ;
> \stopuseMPgraphic 
> 
> 
> \defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}] 
> 
> \defineframedtext
>   [FunnyText]
>   [frame=off,
>    background=FunnyFrame,
>    before={\blank[line,halfline]},
>    after={\blank[line]},
>    offset=\bodyfontsize,
>    width=\textwidth]
> 
> \defineenumeration[Theorem]
>   [title=no,
>   text=Theorem,
>    prefix=yes,
>    prefixsegments=chapter,
>    way=bychapter,
>    alternative=command,
>    headcommand=\gobbleoneargument,
>    before=\startFunnyText,
>    after=\stopFunnyText]
> 
> \defineenumeration[Lemma]
>   [title=no,
>   text=Lemma,
>    prefix=yes,
>    prefixsegments=chapter,
>    way=bychapter,
>    alternative=command,
>    counter=Theorem,
>    headcommand=\gobbleoneargument,
>    before=\startFunnyText,
>    after=\stopFunnyText]
>    
> \defineenumeration[Coro]
>   [title=no,
>   text=Corollary,
>    prefix=yes,
>    prefixsegments=chapter,
>    way=bychapter,
>    alternative=command,
>    counter=Theorem,
>    headcommand=\gobbleoneargument,
>    before=\startFunnyText,
>    after=\stopFunnyText]
> \starttext
> 
> \dorecurse{3}
> {\chapter{Chapter Title}
>     
> 
> \startLemma
>     Fort's space is a compact and Hausdorff topological space.
> \stopLemma
> 
> \startTheorem
>     Fort's space is a compact and Hausdorff topological space.
> \stopTheorem
> 
> 
> \startTheorem
> Let $X$ be a uncountable set. Let $\infty$ is a fixed point of $X$. Let
> $\mathcal T$ be the family of subsets $G$ such that either (i) $\infty
> \notin G$ or (ii) $\infty \in G \text{ and } G^c$ is finite. The space
> $(X, {\mathcal T} )$ is called {\bf Fort's space}.
> \stopTheorem
> 
> \startLemma
>     Fort's space is a compact and Hausdorff topological space.
> \stopLemma
> 
> \startCoro
>     Fort's space is a compact and Hausdorff topological space.
> \stopCoro
> }
> 
> \stoptext
>     
> %%%%% 2nd method
> %2. use \MPvar{} and define 3 different backgrounds, 3 different
> framedtexts like
> %\defineoverlay[FunnyFrameT][\useMPgraphic{FunnyFrame}{what=Theorem}] 
> %%%%%
> 
> \defineframed
>   [FunnyFramed]
>   [frame=off,
>    loffset=1ex,
>    roffset=1ex,
>    foregroundstyle=\ssbf]
> 
> \startuseMPgraphic{FunnyFrame}
>     picture p ; numeric o ; path a, b ; pair c ;
>     p := textext.rt("\FunnyFramed{\MPvar{what}
> \convertedcounter[Theorem]}") ;                   
>     o := BodyFontSize ;
>     a := unitsquare xyscaled (OverlayWidth,OverlayHeight) ;
>     p := p shifted (2o,OverlayHeight-ypart center p) ;
>     drawoptions (withpen pencircle scaled 1pt withcolor .625red) ;
>     b := a superellipsed .95 ;
>     draw b ;
>     b := (boundingbox p) superellipsed .95 ;
>     fill b withcolor .85white ;
>     draw b ;
>     draw p withcolor black ;
>     setbounds currentpicture to a ;
> \stopuseMPgraphic 
> 
> \defineoverlay[FunnyFrameT][\useMPgraphic{FunnyFrame}{what=Theorem}] 
> \defineoverlay[FunnyFrameL][\useMPgraphic{FunnyFrame}{what=Lemma}] 
> \defineoverlay[FunnyFrameC][\useMPgraphic{FunnyFrame}{what=Corollary}] 
> 
> \defineframedtext
>   [FunnyTheorem]
>   [frame=off,
>    background=FunnyFrameT,
>    before={\blank[line,halfline]},
>    after={\blank[line]},
>    offset=\bodyfontsize,
>    width=\textwidth]
> 
> \defineframedtext
>   [FunnyLemma]
>   [frame=off,
>    background=FunnyFrameL,
>    before={\blank[line,halfline]},
>    after={\blank[line]},
>    offset=\bodyfontsize,
>    width=\textwidth]
> 
> \defineframedtext
>   [FunnyCoro]
>   [frame=off,
>    background=FunnyFrameC,
>    before={\blank[line,halfline]},
>    after={\blank[line]},
>    offset=\bodyfontsize,
>    width=\textwidth]
> 
> \defineenumeration[Theorem]
>   [title=no,
>    prefix=yes,
>    prefixsegments=chapter,
>    way=bychapter,
>    alternative=command,
>    headcommand=\gobbleoneargument,
>    before=\startFunnyTheorem,
>    after=\stopFunnyTheorem]
> 
> \defineenumeration[Lemma]
>   [title=no,
>    prefix=yes,
>    prefixsegments=chapter,
>    way=bychapter,
>    alternative=command,
>    counter=Theorem,
>    headcommand=\gobbleoneargument,
>    before=\startFunnyLemma,
>    after=\stopFunnyLemma]
> 
> \defineenumeration[Coro]
>   [title=no,
>    prefix=yes,
>    prefixsegments=chapter,
>    way=bychapter,
>    alternative=command,
>    counter=Theorem,
>    headcommand=\gobbleoneargument,
>    before=\startFunnyCoro,
>    after=\stopFunnyCoro]
> 
> \starttext
> 
> \dorecurse{3}
> {\chapter{Chapter Title}
>     
> 
> \startLemma
>     Fort's space is a compact and Hausdorff topological space.
> \stopLemma
> 
> \startTheorem
>     Fort's space is a compact and Hausdorff topological space.
> \stopTheorem
> 
> 
> \startTheorem
> Let $X$ be a uncountable set. Let $\infty$ is a fixed point of $X$. Let
> $\mathcal T$ be the family of subsets $G$ such that either (i) $\infty
> \notin G$ or (ii) $\infty \in G \text{ and } G^c$ is finite. The space
> $(X, {\mathcal T} )$ is called {\bf Fort's space}.
> \stopTheorem
> 
> \startLemma
>     Fort's space is a compact and Hausdorff topological space.
> \stopLemma
> 
> \startCoro
>     Fort's space is a compact and Hausdorff topological space.
> \stopCoro
> }
> 
> \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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
> 


-- 
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: framed with titles
       [not found] <mailman.976.1509919382.1988.ntg-context@ntg.nl>
  2017-11-14  7:29 ` Jeong Dal
@ 2017-12-02 23:11 ` Jeong Dal
  2017-12-03  7:27   ` Pablo Rodriguez
  1 sibling, 1 reply; 10+ messages in thread
From: Jeong Dal @ 2017-12-02 23:11 UTC (permalink / raw)
  To: list ntg-context@ntg.nl ntg-context@ntg.nl ntg-context@ntg.nl
	ntg-context@ntg.nl


[-- Attachment #1.1: Type: text/plain, Size: 6154 bytes --]

Hi,

Some days ago, I asked a method to put theorem numbers in a framed title.
Recently, Wolfgang gave me a solution which worked very well.

Although the first one is much simpler than the second, I’d like to show two samples made by his suggestion. 
I hope that it may help someone who has the similar problem.

Thanks Wolfgang again.

Best regards,

Dalyoung

%%%%%%%%%% first method
%1. use \enumerationparameter{text} and add “text=Theorem” in \defineenumeration.
%%%%%%%%%%%
\defineframed
  [FunnyFramed]
  [frame=off,
   loffset=1ex,
   roffset=1ex,
   foregroundstyle=\ssbf]

\startuseMPgraphic{FunnyFrame}
    picture p ; numeric o ; path a, b ; pair c ;
    p := textext.rt("\FunnyFramed{\enumerationparameter{text} \convertedcounter[Theorem]}") ;
    o := BodyFontSize ;
    a := unitsquare xyscaled (OverlayWidth,OverlayHeight) ;
    p := p shifted (2o,OverlayHeight-ypart center p) ;
    drawoptions (withpen pencircle scaled 1pt withcolor .625red) ;
    b := a superellipsed .95 ;
    draw b ;
    b := (boundingbox p) superellipsed .95 ;
    fill b withcolor .85white ;
    draw b ;
    draw p withcolor black ;
    setbounds currentpicture to a ;
\stopuseMPgraphic 


\defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}] 

\defineframedtext
  [FunnyText]
  [frame=off,
   background=FunnyFrame,
   before={\blank[line,halfline]},
   after={\blank[line]},
   offset=\bodyfontsize,
   width=\textwidth]

\defineenumeration[Theorem]
  [title=no,
  text=Theorem,
   prefix=yes,
   prefixsegments=chapter,
   way=bychapter,
   alternative=command,
   headcommand=\gobbleoneargument,
   before=\startFunnyText,
   after=\stopFunnyText]

\defineenumeration[Lemma]
  [title=no,
  text=Lemma,
   prefix=yes,
   prefixsegments=chapter,
   way=bychapter,
   alternative=command,
   counter=Theorem,
   headcommand=\gobbleoneargument,
   before=\startFunnyText,
   after=\stopFunnyText]
   
\defineenumeration[Coro]
  [title=no,
  text=Corollary,
   prefix=yes,
   prefixsegments=chapter,
   way=bychapter,
   alternative=command,
   counter=Theorem,
   headcommand=\gobbleoneargument,
   before=\startFunnyText,
   after=\stopFunnyText]
\starttext

\dorecurse{3}
{\chapter{Chapter Title}
    

\startLemma
    Fort's space is a compact and Hausdorff topological space.
\stopLemma

\startTheorem
    Fort's space is a compact and Hausdorff topological space.
\stopTheorem


\startTheorem
Let $X$ be a uncountable set. Let $\infty$ is a fixed point of $X$. Let $\mathcal T$ be the family of subsets $G$ such that either (i) $\infty \notin G$ or (ii) $\infty \in G \text{ and } G^c$ is finite. The space $(X, {\mathcal T} )$ is called {\bf Fort's space}.
\stopTheorem

\startLemma
    Fort's space is a compact and Hausdorff topological space.
\stopLemma

\startCoro
    Fort's space is a compact and Hausdorff topological space.
\stopCoro
}

\stoptext
    
%%%%% 2nd method
%2. use \MPvar{} and define 3 different backgrounds, 3 different framedtexts like
%	\defineoverlay[FunnyFrameT][\useMPgraphic{FunnyFrame}{what=Theorem}] 	
%%%%%

\defineframed
  [FunnyFramed]
  [frame=off,
   loffset=1ex,
   roffset=1ex,
   foregroundstyle=\ssbf]

\startuseMPgraphic{FunnyFrame}
    picture p ; numeric o ; path a, b ; pair c ;
    p := textext.rt("\FunnyFramed{\MPvar{what} \convertedcounter[Theorem]}") ;                   
    o := BodyFontSize ;
    a := unitsquare xyscaled (OverlayWidth,OverlayHeight) ;
    p := p shifted (2o,OverlayHeight-ypart center p) ;
    drawoptions (withpen pencircle scaled 1pt withcolor .625red) ;
    b := a superellipsed .95 ;
    draw b ;
    b := (boundingbox p) superellipsed .95 ;
    fill b withcolor .85white ;
    draw b ;
    draw p withcolor black ;
    setbounds currentpicture to a ;
\stopuseMPgraphic 

\defineoverlay[FunnyFrameT][\useMPgraphic{FunnyFrame}{what=Theorem}] 
\defineoverlay[FunnyFrameL][\useMPgraphic{FunnyFrame}{what=Lemma}] 
\defineoverlay[FunnyFrameC][\useMPgraphic{FunnyFrame}{what=Corollary}] 

\defineframedtext
  [FunnyTheorem]
  [frame=off,
   background=FunnyFrameT,
   before={\blank[line,halfline]},
   after={\blank[line]},
   offset=\bodyfontsize,
   width=\textwidth]

\defineframedtext
  [FunnyLemma]
  [frame=off,
   background=FunnyFrameL,
   before={\blank[line,halfline]},
   after={\blank[line]},
   offset=\bodyfontsize,
   width=\textwidth]

\defineframedtext
  [FunnyCoro]
  [frame=off,
   background=FunnyFrameC,
   before={\blank[line,halfline]},
   after={\blank[line]},
   offset=\bodyfontsize,
   width=\textwidth]

\defineenumeration[Theorem]
  [title=no,
   prefix=yes,
   prefixsegments=chapter,
   way=bychapter,
   alternative=command,
   headcommand=\gobbleoneargument,
   before=\startFunnyTheorem,
   after=\stopFunnyTheorem]

\defineenumeration[Lemma]
  [title=no,
   prefix=yes,
   prefixsegments=chapter,
   way=bychapter,
   alternative=command,
   counter=Theorem,
   headcommand=\gobbleoneargument,
   before=\startFunnyLemma,
   after=\stopFunnyLemma]

\defineenumeration[Coro]
  [title=no,
   prefix=yes,
   prefixsegments=chapter,
   way=bychapter,
   alternative=command,
   counter=Theorem,
   headcommand=\gobbleoneargument,
   before=\startFunnyCoro,
   after=\stopFunnyCoro]

\starttext

\dorecurse{3}
{\chapter{Chapter Title}
    

\startLemma
    Fort's space is a compact and Hausdorff topological space.
\stopLemma

\startTheorem
    Fort's space is a compact and Hausdorff topological space.
\stopTheorem


\startTheorem
Let $X$ be a uncountable set. Let $\infty$ is a fixed point of $X$. Let $\mathcal T$ be the family of subsets $G$ such that either (i) $\infty \notin G$ or (ii) $\infty \in G \text{ and } G^c$ is finite. The space $(X, {\mathcal T} )$ is called {\bf Fort's space}.
\stopTheorem

\startLemma
    Fort's space is a compact and Hausdorff topological space.
\stopLemma

\startCoro
    Fort's space is a compact and Hausdorff topological space.
\stopCoro
}

\stoptext
    
    
    

[-- Attachment #1.2: Type: text/html, Size: 23879 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

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

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

* Re: framed with titles
       [not found] <mailman.1.1510657201.29599.ntg-context@ntg.nl>
@ 2017-11-14 14:13 ` Jeong Dal
  0 siblings, 0 replies; 10+ messages in thread
From: Jeong Dal @ 2017-11-14 14:13 UTC (permalink / raw)
  To: list ntg-context@ntg.nl ntg-context@ntg.nl ntg-context@ntg.nl
	ntg-context@ntg.nl

Hi, 

I got a partial solution to suppress the automatic display by changing “text=theorem,” to “text=,” and “number=yes” to “number=no”.
But, I couldn’t remove a blank line before the main text.
So it is a partial solution.

> 1. to put “Theorem #.#” inside the FrameTitle?(#.# means that chapter number.theorem number)
> 2. to suppress the automatically display of “Thm #” inside the text?

The command
\FrameTitle{Theorem \getmarking[chapternumber].\recurselevel}
shows “Theorem 1.1”, but the it shows the chapternumber -1 not the real chapternumber.
Also I don’t know how to put the theorem counter after chapternumber instead of \recurselevel.

Here is a sample code.

Thank you for reading.

Best regards,

Dalyoung

%%%%%%%% framed Text copied from MetaFun manual
\startuseMPgraphic{FunnyFrame} 
picture p ; numeric o ; path a, b ; pair c ; 
p := textext.rt(\MPstring{FunnyFrame}) ; 
o := BodyFontSize ; 
a := unitsquare xyscaled (OverlayWidth,OverlayHeight) ; 
p := p shifted (2o,OverlayHeight-ypart center p) ; 
drawoptions (withpen pencircle scaled 1pt withcolor .625red) ; 
b := a superellipsed .95 ; 
%fill b withcolor .85white ; 
draw b ; 
b := (boundingbox p) superellipsed .95 ; 
fill b withcolor .85white ;  %.425green;%.
draw b ; 
draw p withcolor black ;
setbounds currentpicture to a ; 
\stopuseMPgraphic 

\defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}] 
\defineframedtext[FunnyText][frame=off,background=FunnyFrame, offset=\bodyfontsize, width=\textwidth]%\overlaywidth]%
\def\FrameTitle #1% 
{\setMPtext{FunnyFrame}{\hbox spread 1em{\hss\strut\ss\bf #1\hss}}} 

\defineenumeration[Thm]
   [text=,
    style=,
    title=no,
    prefix=yes,
    prefixsegments={chapter},
    way=bychapter,
    number=no,
    before={\FrameTitle {Theorem \getmarking[chapternumber].\recurselevel} \startFunnyText},
    after={\stopFunnyText\blank}]

%\define[2]\thm{\FrameTitle{#1}
%\startFunnyText #2 \stopFunnyText}

\starttext

\dorecurse{3}
{\chapter{Chapter Title}
    
{\FrameTitle{Fort's space test}
\startFunnyText
Let $X$ be a uncountable set. Let $\infty$ is a fixed point of $X$. Let $\mathcal T$ be the family of subsets $G$ such that either (i) $\infty \notin G$ or (ii) $\infty \in G \text{ and } G^c$ is finite. The space $(X, {\mathcal T} )$ is called {\bf Fort's space}.
\stopFunnyText}

{\getmarking[chapternumber]}.\recurselevel}%

\startThm
    Fort's space is a compact and Hausdorff topological space.
\stopThm

\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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: framed with titles
       [not found] <mailman.976.1509919382.1988.ntg-context@ntg.nl>
@ 2017-11-14  7:29 ` Jeong Dal
  2017-12-02 23:11 ` Jeong Dal
  1 sibling, 0 replies; 10+ messages in thread
From: Jeong Dal @ 2017-11-14  7:29 UTC (permalink / raw)
  To: ntg-context

Hi,

Here is a sample code of framed text with titles using FunnyFrame.

I tried to use it to display theorems “Theorem #.#” inside the FrameTitle, and the text in FunnyFrame.
So, I defined “\defineenumeration[Thm]”.
But I couldn’t make it.
Is it possible to do that? If so, please let me know how to do the following two things.

1. to put “Theorem #.#” inside the FrameTitle?(#.# means that chapter number.theorem number)
2. to suppress the automatically display of “Thm #” inside the text?

Thanks for reading.

Best regards,

Dalyoung

%%%%%%%% framed Text copied from MetaFun book.
\startuseMPgraphic{FunnyFrame} 
picture p ; numeric o ; path a, b ; pair c ; 
p := textext.rt(\MPstring{FunnyFrame}) ; 
o := BodyFontSize ; 
a := unitsquare xyscaled (OverlayWidth,OverlayHeight) ; 
p := p shifted (2o,OverlayHeight-ypart center p) ; 
drawoptions (withpen pencircle scaled 1pt withcolor .625red) ; 
b := a superellipsed .95 ; 
%fill b withcolor .85white ; 
draw b ; 
b := (boundingbox p) superellipsed .95 ; 
fill b withcolor .85white ;  %.425green;%.
draw b ; 
draw p withcolor black ;
setbounds currentpicture to a ; 
\stopuseMPgraphic 

\defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}] 
\defineframedtext[FunnyText][frame=off,background=FunnyFrame, offset=\bodyfontsize, width=\textwidth]%\overlaywidth]%
\def\FrameTitle #1% 
{\setMPtext{FunnyFrame}{\hbox spread 1em{\hss\strut\ss\bf #1\hss}}} 

\defineenumeration[Thm]
   [%text=\thm,
    style=,
    title=yes,
    prefix=yes,
    prefixsegments=chapter,
    way=bychapter,
    number=yes,
    before={\blank[big]\FrameTitle{Theorem} \startFunnyText},
    after={\stopFunnyText\blank}]
    
\starttext
    
{\FrameTitle{Fort's space}
\startFunnyText{Fort's space}
Let $X$ be a uncountable set. Let $\infty$ is a fixed point of $X$. Let $\mathcal T$ be the family of subsets $G$ such that either (i) $\infty \notin G$ or (ii) $\infty \in G \text{ and } G^c$ is finite. The space $(X, {\mathcal T} )$ is called {\bf Fort's space}.
\stopFunnyText}

\startThm
    Fort's space is a compact and Hausdorff topological space.
\stopThm
\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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: framed with titles
  2017-11-05 10:40 ` Jean-Pierre Delange
@ 2017-11-05 10:49   ` Jean-Pierre Delange
  0 siblings, 0 replies; 10+ messages in thread
From: Jean-Pierre Delange @ 2017-11-05 10:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Oups !

There is a little error in the sample I've given : Don't read "\knuth" but "\input knuth" below !

\startMyFrame[Title=Knuth Text]

\input knuth

\stopMyFrame

\stoptext


----- Mail original -----
De: "Jean-Pierre Delange" <adeimantos@free.fr>
À: "mailing list for ConTeXt users" <ntg-context@ntg.nl>
Envoyé: Dimanche 5 Novembre 2017 11:40:03
Objet: Re: [NTG-context] framed with titles

Hi Javier,

As Thomas put it, it is beter to provide a minimal sample, even if it doesn't work correctly.
Given that, you can dig in this list archives, which contain few questions on the topic you are dealing with.

I am afraid that you can't achieve your goal (which is more or less a text within a frame with a title), without MP, which seems to me a good tool to draw such frame.
I remember that Fabrice Couvreur once has asked in 2016 a similar question, in order to draw a frame for a "summary" at the end of a chapter.

You need to populate the preamble of your file with something like below (you have to test it and modify it to your needs). 

Pay attention ! You have to give a \start command, after the \starttext command, inside the body of your text, when you want \startMyFrame[Title=A Title], and when to stop the frame with the \stopMyFrame command.
Have a look to the code below and test it (note that the frame is red in this sample).

% Début de la définition d'un texte encadré en rouge

% Defining a framed text
\defineframedtext
        [MyFrame]
        [before={\blank[3*big]},
         after={\blank[5*big]},
          frame=off,
          background=MyFrame,
  %width=\textwidth,
        width=max,
        height=fit,
        style={\setupbodyfont[9pt]}]

% Defining a label
\definelabel
 [Definition]
 [headstyle=\bf\smallcaps]


\startuseMPgraphic{MyFrame}
path b;
picture p;
%p := textext.rt("\white\Definition");
p := textext.rt("\white\framedtextparameter{Title}");
%p := textext.rt("\white\getvariable{text}{text1}");
p := p shifted (2BodyFontSize,OverlayHeight-ypart center p+.25ExHeight);
b := boundingbox p leftenlarged .5EmWidth rightenlarged .5EmWidth;
fill OverlayBox withcolor lightgray;  %\MPcolor{
fill b withcolor darkred;
draw bottomboundary OverlayBox withpen pencircle scaled 1pt  withcolor
darkred;
draw topboundary OverlayBox withpen pencircle scaled 1pt  withcolor
darkred;
draw p;
setbounds currentpicture to boundingbox currentpicture enlarged 2mm;
\stopuseMPgraphic

\defineoverlay
 [MyFrame]
 [\useMPgraphic{MyFrame}]
% Fin de la définition d'un texte encadré en rouge

\starttext

\startMyFrame[Title=Knuth Text]

\knuth

\stopMyFrame
\stoptext

Hope it helps !
JP

----- Mail original -----
De: "Javier M Mora" <jmmora@us.es>
À: ntg-context@ntg.nl
Envoyé: Dimanche 5 Novembre 2017 10:14:47
Objet: [NTG-context] framed with titles

Hi,

I'm trying to generate a frame with a title.

My first idea is something like (ASCII Art):

+- Title  -------------+
|  Text text text text |
|  more and more text  |
+----------------------+

A frame with title breaking the top line .

But I am not picky and something like beamer floating boxes (theorem, 
proof, ...) for latex is good for me too.

In wiki, the frames doesn't have title and I'm not sure about if I have 
to fight with overlays, with MP and this is out of my league.

Questions:

* what is the way for implement a title in the frame?

* Could you write a minimal example witch allows me to complete it for 
my needs?

Thanks.

Javier M. Mora



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

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

* Re: framed with titles
  2017-11-05  9:14 Javier M Mora
  2017-11-05  9:32 ` Schmitz Thomas A.
@ 2017-11-05 10:40 ` Jean-Pierre Delange
  2017-11-05 10:49   ` Jean-Pierre Delange
  1 sibling, 1 reply; 10+ messages in thread
From: Jean-Pierre Delange @ 2017-11-05 10:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Javier,

As Thomas put it, it is beter to provide a minimal sample, even if it doesn't work correctly.
Given that, you can dig in this list archives, which contain few questions on the topic you are dealing with.

I am afraid that you can't achieve your goal (which is more or less a text within a frame with a title), without MP, which seems to me a good tool to draw such frame.
I remember that Fabrice Couvreur once has asked in 2016 a similar question, in order to draw a frame for a "summary" at the end of a chapter.

You need to populate the preamble of your file with something like below (you have to test it and modify it to your needs). 

Pay attention ! You have to give a \start command, after the \starttext command, inside the body of your text, when you want \startMyFrame[Title=A Title], and when to stop the frame with the \stopMyFrame command.
Have a look to the code below and test it (note that the frame is red in this sample).

% Début de la définition d'un texte encadré en rouge

% Defining a framed text
\defineframedtext
        [MyFrame]
        [before={\blank[3*big]},
         after={\blank[5*big]},
          frame=off,
          background=MyFrame,
  %width=\textwidth,
        width=max,
        height=fit,
        style={\setupbodyfont[9pt]}]

% Defining a label
\definelabel
 [Definition]
 [headstyle=\bf\smallcaps]


\startuseMPgraphic{MyFrame}
path b;
picture p;
%p := textext.rt("\white\Definition");
p := textext.rt("\white\framedtextparameter{Title}");
%p := textext.rt("\white\getvariable{text}{text1}");
p := p shifted (2BodyFontSize,OverlayHeight-ypart center p+.25ExHeight);
b := boundingbox p leftenlarged .5EmWidth rightenlarged .5EmWidth;
fill OverlayBox withcolor lightgray;  %\MPcolor{
fill b withcolor darkred;
draw bottomboundary OverlayBox withpen pencircle scaled 1pt  withcolor
darkred;
draw topboundary OverlayBox withpen pencircle scaled 1pt  withcolor
darkred;
draw p;
setbounds currentpicture to boundingbox currentpicture enlarged 2mm;
\stopuseMPgraphic

\defineoverlay
 [MyFrame]
 [\useMPgraphic{MyFrame}]
% Fin de la définition d'un texte encadré en rouge

\starttext

\startMyFrame[Title=Knuth Text]

\knuth

\stopMyFrame
\stoptext

Hope it helps !
JP

----- Mail original -----
De: "Javier M Mora" <jmmora@us.es>
À: ntg-context@ntg.nl
Envoyé: Dimanche 5 Novembre 2017 10:14:47
Objet: [NTG-context] framed with titles

Hi,

I'm trying to generate a frame with a title.

My first idea is something like (ASCII Art):

+- Title  -------------+
|  Text text text text |
|  more and more text  |
+----------------------+

A frame with title breaking the top line .

But I am not picky and something like beamer floating boxes (theorem, 
proof, ...) for latex is good for me too.

In wiki, the frames doesn't have title and I'm not sure about if I have 
to fight with overlays, with MP and this is out of my league.

Questions:

* what is the way for implement a title in the frame?

* Could you write a minimal example witch allows me to complete it for 
my needs?

Thanks.

Javier M. Mora



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

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

* Re: framed with titles
  2017-11-05  9:14 Javier M Mora
@ 2017-11-05  9:32 ` Schmitz Thomas A.
  2017-11-05 10:40 ` Jean-Pierre Delange
  1 sibling, 0 replies; 10+ messages in thread
From: Schmitz Thomas A. @ 2017-11-05  9:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users



> On 5. Nov 2017, at 10:14, Javier M Mora <jmmora@us.es> wrote:
> 
> Questions:
> 
> * what is the way for implement a title in the frame?

There are examples for titles in frames at http://wiki.contextgarden.net/Titles#Chapter_titles_in_new_line

> 
> * Could you write a minimal example witch allows me to complete it for my needs?

In general, it behooves the OP to provide a minimal example.

HTH

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* framed with titles
@ 2017-11-05  9:14 Javier M Mora
  2017-11-05  9:32 ` Schmitz Thomas A.
  2017-11-05 10:40 ` Jean-Pierre Delange
  0 siblings, 2 replies; 10+ messages in thread
From: Javier M Mora @ 2017-11-05  9:14 UTC (permalink / raw)
  To: ntg-context

Hi,

I'm trying to generate a frame with a title.

My first idea is something like (ASCII Art):

+- Title  -------------+
|  Text text text text |
|  more and more text  |
+----------------------+

A frame with title breaking the top line .

But I am not picky and something like beamer floating boxes (theorem, 
proof, ...) for latex is good for me too.

In wiki, the frames doesn't have title and I'm not sure about if I have 
to fight with overlays, with MP and this is out of my league.

Questions:

* what is the way for implement a title in the frame?

* Could you write a minimal example witch allows me to complete it for 
my needs?

Thanks.

Javier M. Mora



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

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

end of thread, other threads:[~2017-12-03 14:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.1.1509879601.14103.ntg-context@ntg.nl>
2017-11-05 12:23 ` framed with titles Jeong Dal
     [not found] <mailman.1513.1512287889.1988.ntg-context@ntg.nl>
2017-12-03 14:42 ` Jeong Dal
     [not found] <mailman.1.1510657201.29599.ntg-context@ntg.nl>
2017-11-14 14:13 ` Jeong Dal
     [not found] <mailman.976.1509919382.1988.ntg-context@ntg.nl>
2017-11-14  7:29 ` Jeong Dal
2017-12-02 23:11 ` Jeong Dal
2017-12-03  7:27   ` Pablo Rodriguez
2017-11-05  9:14 Javier M Mora
2017-11-05  9:32 ` Schmitz Thomas A.
2017-11-05 10:40 ` Jean-Pierre Delange
2017-11-05 10:49   ` Jean-Pierre Delange

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).