ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: making horizontal space in luacode.
       [not found] <mailman.590.1350896809.2084.ntg-context@ntg.nl>
@ 2012-10-22 11:56 ` Jeong Dal
  0 siblings, 0 replies; 4+ messages in thread
From: Jeong Dal @ 2012-10-22 11:56 UTC (permalink / raw)
  To: ntg-context

Dear Aditya, Hans

Both solutions work well.

It is really efficient to write matrix in ConTeXt + lua.
I am enjoying the benefit of lua in ConTeXt.

Thank you.

Best regards,

Dalyoung

> 
> \definehspace[skip][3em]
> \starttext
> \startluacode
>   context("Some text")
>   context.hspace{"skip"}
>   context("More text")
> \stopluacode
> \stoptext
> 
> 
> Aditya
> 
> 
> ------------------------------
> 
> Message: 5
> Date: Mon, 22 Oct 2012 09:40:01 +0200
> From: Hans Hagen <pragma@wxs.nl>
> To: mailing list for ConTeXt users <ntg-context@ntg.nl>
> Subject: Re: [NTG-context] making horizontal space in luacode.
> Message-ID: <5084F851.7050203@wxs.nl>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> On 22-10-2012 07:15, Aditya Mahajan wrote:
>> On Mon, 22 Oct 2012, Jeong Dal wrote:
>> 
>>> Dear all,
>>> 
>>> 1. I'd like to make a horizontal space using \hspace[3em] inside luacode.
>>> 
>>> But  context.hspace({3em}), context.hspace({"3em"}),
>>> context.hspace("3em") don't work.
>>> And print("   ") doesn't work either.
>>> 
>>> How to make some horizontal space in luacode?
>> 
>> 
>> \hspace does not accept dimensions. The syntax for hspace is
>> 
>> \definehspace[whatever][3em]
>> 
>> \hspace[whatever].
>> 
>> So, you need:
>> 
>> \definehspace[skip][3em]
>> \starttext
>> \startluacode
>>   context("Some text")
>>   context.hspace{"skip"}
>>   context("More text")
>> \stopluacode
>> \stoptext
> 
> Indeed this is the best way. At some point I'll wrap primitives (maybe 
> in another namespace). If you really want to use context.hskip, you can 
> say context.hskip(false,"10pt plus 5pt") etc as a first false argument 
> will signal a drop of {}.
> 
> Hans

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


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

* Re: making horizontal space in luacode.
  2012-10-22  5:15 ` Aditya Mahajan
@ 2012-10-22  7:40   ` Hans Hagen
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2012-10-22  7:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 22-10-2012 07:15, Aditya Mahajan wrote:
> On Mon, 22 Oct 2012, Jeong Dal wrote:
>
>> Dear all,
>>
>> 1. I'd like to make a horizontal space using \hspace[3em] inside luacode.
>>
>> But  context.hspace({3em}), context.hspace({"3em"}),
>> context.hspace("3em") don't work.
>> And print("   ") doesn't work either.
>>
>> How to make some horizontal space in luacode?
>
>
> \hspace does not accept dimensions. The syntax for hspace is
>
> \definehspace[whatever][3em]
>
> \hspace[whatever].
>
> So, you need:
>
> \definehspace[skip][3em]
> \starttext
> \startluacode
>    context("Some text")
>    context.hspace{"skip"}
>    context("More text")
> \stopluacode
> \stoptext

Indeed this is the best way. At some point I'll wrap primitives (maybe 
in another namespace). If you really want to use context.hskip, you can 
say context.hskip(false,"10pt plus 5pt") etc as a first false argument 
will signal a drop of {}.

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
___________________________________________________________________________________


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

* Re: making horizontal space in luacode.
  2012-10-22  4:25 Jeong Dal
@ 2012-10-22  5:15 ` Aditya Mahajan
  2012-10-22  7:40   ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Aditya Mahajan @ 2012-10-22  5:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Mon, 22 Oct 2012, Jeong Dal wrote:

> Dear all,
>
> 1. I'd like to make a horizontal space using \hspace[3em] inside luacode.
>
> But  context.hspace({3em}), context.hspace({"3em"}), context.hspace("3em") don't work.
> And print("   ") doesn't work either.
>
> How to make some horizontal space in luacode?


\hspace does not accept dimensions. The syntax for hspace is

\definehspace[whatever][3em]

\hspace[whatever].

So, you need:

\definehspace[skip][3em]
\starttext
\startluacode
   context("Some text")
   context.hspace{"skip"}
   context("More text")
\stopluacode
\stoptext


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


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

* making horizontal space in luacode.
@ 2012-10-22  4:25 Jeong Dal
  2012-10-22  5:15 ` Aditya Mahajan
  0 siblings, 1 reply; 4+ messages in thread
From: Jeong Dal @ 2012-10-22  4:25 UTC (permalink / raw)
  To: ntg-context

Dear all,

1. I'd like to make a horizontal space using \hspace[3em] inside luacode.

But  context.hspace({3em}), context.hspace({"3em"}), context.hspace("3em") don't work.
And print("   ") doesn't work either. 

How to make some horizontal space in luacode?

2. There is no white line even though I put "\blank[big]" between Frame(bring it from MetaFun) and text as in the following example.

\starttext

%%%%%%%% framed Text
\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 .425green;%.85white ;
draw b ;
draw p withcolor black ;
setbounds currentpicture to a ;
\stopuseMPgraphic

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

This is a test line file for blank spaces.
\blank[big]  % white line is wanted
{\FrameTitle{Test}
\StartFrame
\startitemize[n]
\item the first line.
\item the second line.
\item the third line.
\stopitemize
\StopFrame
}
\blank[big]  % white line is wanted
Here is another test line.

\stoptext

What should I do to make a blank line before and after 

Thank you.

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
___________________________________________________________________________________


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

end of thread, other threads:[~2012-10-22 11:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.590.1350896809.2084.ntg-context@ntg.nl>
2012-10-22 11:56 ` making horizontal space in luacode Jeong Dal
2012-10-22  4:25 Jeong Dal
2012-10-22  5:15 ` Aditya Mahajan
2012-10-22  7:40   ` Hans Hagen

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).