Re: [NTG-context] (again) issues with typing

2017-08-16 Thread Alan Braslau
On Wed, 16 Aug 2017 23:45:30 +0200
Pablo Rodriguez  wrote:

> I have to explain to newcomers (in my Spanish introduction to ConTeXt)
> what comments are and multiple lines don’t affect the final PDF
> document.

For such a document, it can be very useful to put code snippets into
buffers and then use
\typeTEXbuffer
or
\typeLUAbuffer
and then
\getbuffer

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

Re: [NTG-context] (again) issues with typing

2017-08-16 Thread Aditya Mahajan

On Wed, 16 Aug 2017, Pablo Rodriguez wrote:


sorry for insisting, but I need to solve this.


I don't know how to answer your questions with the default syntax 
highlighting in ConTeXt, but are you willing to consider t-vim module for 
typesetting code. The output for your example is attached.


All you need to do is add the following in the document preamble:

\usemodule[vim]
\definevimtyping[TEX][syntax=context]
\definevimtyping[XML][syntax=xml]
\definevimtyping[LUA][syntax=lua]

If you have lot of code snippets, you may want to create a directory to 
store temporary files. You can do this using


\setupvimtyping[directory=output]

and then create a directory called "output" in the folder from which you 
run ConTeXt.


Aditya

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

[NTG-context] (again) issues with typing

2017-08-16 Thread Pablo Rodriguez
Dear list,

sorry for insisting, but I need to solve this.

I have to explain to newcomers (in my Spanish introduction to ConTeXt)
what comments are and multiple lines don’t affect the final PDF document.

I have the following sample:

\setuptyping[lines=yes]
\starttext
\startTEXpage[offset=1em]
\startTEX
This is text. % and this is a comment
\stopTEX

\startXML
This is text.
\stopXML

\startLUA
if code=="code" then --this is a comment

--[[
this is a

multiline comment
--]]

---[[
this isn’t a


multiline comment
--]]
\stopLUA
\stopTEXpage
\stoptext

I have three questions:

1. How do I enable that multiple blank lines are displayed as more than
a single one?

The Lua code contains one, two and three blank lines and they are
displayed always as separation from single lines.

I thought lines=yes should do that, but it doesn’t.

2. I accidentally discovered that the block comment opening (--[[)
removes break with next line. I think it should be fixed.

3. The most important issue is that the whole comment (both markers and
content) is displayed with \darkyellow.

I wonder why comments aren’t display in typing as in any other editor.
All comment characters should be displayed the same, since none of them
would affect to the final output.

How can I get the same color for the whole comment (again, both markers
and content)?

Many thanks for your help,

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

Re: [NTG-context] avoid space after title

2017-08-16 Thread Wolfgang Schuster

Play with the grid key for \setuphead.

\setuphead[section][page=no,before=,after=,grid=box]

Wolfgang

Henning Hraban Ramm 
15. August 2017 um 18:18
I’d like to get rid of the blank line after section titles in grid 
mode. How?


\setuplayout[grid=yes,]
\setuphead[section][page=no,before={},after={}]

\starttext

\startchapter[title={Authors}]

\startsection[title={Knuth}]
\input knuth
\stopsection

\startsection[title={Tufte}]
\input tufte
\stopsection

\startsection[title={Hawking}]
\input hawking
\stopsection

\startsection[title={Zapf}]
\input zapf
\stopsection

\stopchapter

\stoptext



Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
GPG Key ID 1C9B22FD

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

Re: [NTG-context] avoid space after title

2017-08-16 Thread Peter Münster
On Wed, Aug 16 2017, Henning Hraban Ramm wrote:

>> I’d like to get rid of the blank line after section titles in grid mode. How?
>> 
>> \setuplayout[grid=yes,]
>> \setuphead[section][page=no,before={},after={}]

Sorry, no real solution, just a workaround:

\setuphead[section][page=no,before={},after=\vskip-\lineheight]

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

Re: [NTG-context] avoid space after title

2017-08-16 Thread Rik Kabel

On 2017-08-16 12:20, Pablo Rodriguez wrote:

On 08/16/2017 05:48 PM, Henning Hraban Ramm wrote:

Please, this is quite urgent. No hints?

Am 2017-08-15 um 18:18 schrieb Henning Hraban Ramm:

I’d like to get rid of the blank line after section titles in grid
mode. How?

Hi Hraban,

I checked it yesterday, but I didn’t found a solution.

All I can say is that if grid is enabled, (at least) a blank line before
and after \section is added. See yourself:

 \showgrid
 \setuplayout[grid=yes,]
 \setuphead[section][page=no,before=,after=]

 \starttext

 \startchapter[title={Authors}]

 \startsection[title={Knuth}]
 \input knuth
 \stopsection

 \startsection[title={Tufte}]
 \input tufte
 \stopsection

 \setuphead[section]
 [before={\blackrule[width=\textwidth,color=green,
   height=\lineheight]},
 after={\blackrule[width=\textwidth,color=red, height=\lineheight]}]

 \startsection[title={Hawking}]
 \input hawking
 \stopsection

 \startsection[title={Zapf}]
 \input zapf
 \stopsection

 \stopchapter

 \stoptext

I would say this might be a bug. But someone with more ConTeXt knowledge
should confirm my assumption.

Sorry for not providing actual help,

Pablo


Well, for this example you can do it with a simple hack:

   \setuphead[section][page=no,before={},after={\blank[-1*line]}]

You will have to test how that works for you in a more complex document.

--
Rik

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

Re: [NTG-context] avoid space after title

2017-08-16 Thread Pablo Rodriguez
On 08/16/2017 05:48 PM, Henning Hraban Ramm wrote:
> Please, this is quite urgent. No hints?
> 
> Am 2017-08-15 um 18:18 schrieb Henning Hraban Ramm:
>> I’d like to get rid of the blank line after section titles in grid
>> mode. How?

Hi Hraban,

I checked it yesterday, but I didn’t found a solution.

All I can say is that if grid is enabled, (at least) a blank line before
and after \section is added. See yourself:

\showgrid
\setuplayout[grid=yes,]
\setuphead[section][page=no,before=,after=]

\starttext

\startchapter[title={Authors}]

\startsection[title={Knuth}]
\input knuth
\stopsection

\startsection[title={Tufte}]
\input tufte
\stopsection

\setuphead[section]
[before={\blackrule[width=\textwidth,color=green,
  height=\lineheight]},
after={\blackrule[width=\textwidth,color=red, height=\lineheight]}]

\startsection[title={Hawking}]
\input hawking
\stopsection

\startsection[title={Zapf}]
\input zapf
\stopsection

\stopchapter

\stoptext

I would say this might be a bug. But someone with more ConTeXt knowledge
should confirm my assumption.

Sorry for not providing actual help,

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

Re: [NTG-context] context sensitive highlight styles

2017-08-16 Thread Pablo Rodriguez
On 08/16/2017 05:47 PM, Henning Hraban Ramm wrote:
> In my current project, section titles are typeset in SansBold while
> the body text (and that of the ToC) is roman.
> 
> How can I define \definehighlight[emph], so that I get
> SansBoldItalic in titles and SerifItalic in body text and ToC? (Body
> text is not a problem.)

Hi Hraban,

if I get your question, the reply would be:

  \definehighlight[emph][style=\em]
  \setupbodyfontenvironment[default][em=italic]

Was this what you needed?

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

Re: [NTG-context] avoid space after title

2017-08-16 Thread Henning Hraban Ramm
Please, this is quite urgent. No hints?

Am 2017-08-15 um 18:18 schrieb Henning Hraban Ramm :

> I’d like to get rid of the blank line after section titles in grid mode. How?
> 
> \setuplayout[grid=yes,]
> \setuphead[section][page=no,before={},after={}]
> 
> \starttext
> 
> \startchapter[title={Authors}]
> 
> \startsection[title={Knuth}]
> \input knuth
> \stopsection
> 
> \startsection[title={Tufte}]
> \input tufte
> \stopsection
> 
> \startsection[title={Hawking}]
> \input hawking
> \stopsection
> 
> \startsection[title={Zapf}]
> \input zapf
> \stopsection
> 
> \stopchapter
> 
> \stoptext
> 
> 
> 
> Greetlings, Hraban
> ---
> http://www.fiee.net
> http://wiki.contextgarden.net
> GPG Key ID 1C9B22FD

___
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] context sensitive highlight styles

2017-08-16 Thread Henning Hraban Ramm
In my current project, section titles are typeset in SansBold while the body 
text (and that of the ToC) is roman.

How can I define \definehighlight[emph], so that I get SansBoldItalic in titles 
and SerifItalic in body text and ToC? (Body text is not a problem.)

MNWE:

\setuphead[chapter][page=yes,style={\ss\bfc}]
\setuphead[section][page=no,style={\ss\bfa}]
\definehighlight[emph][style=\it]

\starttext

\completecontent

\startchapter[title={My book \emph{\ConTeXt\ for Runaways}}]

\startsection[title={Knuth, \emph{the professor}}]
\input knuth
\stopsection

\stopchapter

\stoptext


Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
GPG Key ID 1C9B22FD

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

Re: [NTG-context] Pdf info with Lua/Ctx API

2017-08-16 Thread Wolfgang Schuster



Procházka Lukáš Ing. 
16. August 2017 um 12:11
Hello Hans,

thank you for implementation 'figures.getinfo()'; two points:

1. Code:


\startluacode

local n = 
"x:/Users/MMi/Akce/I-6_Krusovice.DSP-ZDS/Admin/Jednani/2017-07-07-SU-Rakovnik/ZJ.pdf" 


local d = figures.getinfo(n)
...


prints (probably to-string converted) resulting table:

"
close source > level 3, order 8, name 
'd://Lukas/ConTeXt/Styles/PxLetter.sty'

table={
 ["request"]={
  ["arguments"]=false,
  ["cache"]=false,
  ["color"]=false,
  ["controls"]=false,
  ["conversion"]=false,
  ["display"]=false,
  ["format"]=false,
  ["height"]=false,
  ["label"]=false,
  ["mask"]=false,
  
["name"]="x:/Users/MMi/Akce/I-6_Krusovice.DSP-ZDS/Admin/Jednani/2017-07-07-SU-Rakovnik/ZJ.pdf", 


...
 },
 ["status"]={
...
 },
 ["used"]={
  ["colordepth"]=0,
  ["depth"]=0,
  ["format"]="pdf",
  
["fullname"]="x:/Users/MMi/Akce/I-6_Krusovice.DSP-ZDS/Admin/Jednani/2017-07-07-SU-Rakovnik/ZJ.pdf", 


  ["height"]=55380991,
...
 },
}
"

- Is it intend? Or residual debugging status?


2. Is there a Ctx built-in converter which would convert width and 
height (e.g. here: ["height"]=55380991) from "height units" to 
milimeters?

\starttext

\startluacode

local length = "55380991"

context(number.topoints(length))

context.par()

context(number.todimen(length,"pt"))

\stopluacode

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

Re: [NTG-context] Pdf info with Lua/Ctx API

2017-08-16 Thread Procházka Lukáš Ing .

Hello Hans,

thank you for implementation 'figures.getinfo()'; two points:

1. Code:


\startluacode

local n = 
"x:/Users/MMi/Akce/I-6_Krusovice.DSP-ZDS/Admin/Jednani/2017-07-07-SU-Rakovnik/ZJ.pdf"
local d = figures.getinfo(n)
...


prints (probably to-string converted) resulting table:

"
close source> level 3, order 8, name 'd://Lukas/ConTeXt/Styles/PxLetter.sty'
table={
 ["request"]={
  ["arguments"]=false,
  ["cache"]=false,
  ["color"]=false,
  ["controls"]=false,
  ["conversion"]=false,
  ["display"]=false,
  ["format"]=false,
  ["height"]=false,
  ["label"]=false,
  ["mask"]=false,
  
["name"]="x:/Users/MMi/Akce/I-6_Krusovice.DSP-ZDS/Admin/Jednani/2017-07-07-SU-Rakovnik/ZJ.pdf",
...
 },
 ["status"]={
...
 },
 ["used"]={
  ["colordepth"]=0,
  ["depth"]=0,
  ["format"]="pdf",
  
["fullname"]="x:/Users/MMi/Akce/I-6_Krusovice.DSP-ZDS/Admin/Jednani/2017-07-07-SU-Rakovnik/ZJ.pdf",
  ["height"]=55380991,
...
 },
}
"

- Is it intend? Or residual debugging status?


2. Is there a Ctx built-in converter which would convert width and height (e.g. here: 
["height"]=55380991) from "height units" to milimeters?

Best regards,

Lukas


On Mon, 14 Aug 2017 16:55:09 +0200, Hans Hagen  wrote:


On 8/14/2017 1:08 PM, Procházka Lukáš Ing. wrote:

Hello,

is there a way how to get the following info from a PDF file via Lua/Ctx
API?:

- first: number of pages of the PDF,

- next: for each page: get width, height and orientation
(portrait/landscape) or rotation (+90,+ 180, +270 or so) of i-th page.


this probably has come up several times now, anyway


\getfiguredimensions[test.pdf]
\dorecurse {\noffigurepages} {
 \getfiguredimensions[test.pdf][page=#1]
 \figurenaturalwidth
,\figurenaturalheight,\figureorientation,\figurerotation\par
}

in lua you can either use the img library (see luatex manual) or context
helpers

 local data = figures.push("foo.pdf")
 figures.identify()
 figures.check()
 figures.pop()
inspect(data)

i'll add:

function figures.getinfo(name,page)
 if type(name) == "string" then
 name = { name = name, page = page }
 end
 if name.name then
 local data = figures.push(name)
 figures.identify()
 figures.check()
 figures.pop()
 return data
 end
end

so that one can do

local n = "ms.pdf"
local d = figures.getinfo(n)

if d then
 for i=1,d.used.pages do
 local p = figures.getinfo(n,i)
 if p then
 local u = p.used
 print(u.width,u.height,u.orientation)
 end
 end
end

etc etc





--
Ing. Lukáš Procházka | mailto:l...@pontex.cz
Pontex s. r. o.  | mailto:pon...@pontex.cz | http://www.pontex.cz | 
IDDS:nrpt3sn
Bezová 1658
147 14 Praha 4

Mob.: +420 702 033 396

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

Re: [NTG-context] About formatting the "Fonts out of ConTEXT" manual

2017-08-16 Thread Fabrice Couvreur
Hi Henri,
Thanks for the information.
Fabrice


2017-08-16 2:16 GMT+02:00 Henri :

> On Tue, 2017-08-15 at 12:35 +0200, Fabrice Couvreur wrote:
> > Hi Hans,
> > I love the style used for this manual. I tried to do the same thing, but
> it's a long way off !
> > I tried to find the source code to inspire me :-)
>
> The source for the fonts manual is distributed with minimals.  It can be
> found in
>
> tex/texmf-context/doc/context/sources/general/fonts/
>
> or online on GitHub
>
> https://github.com/contextgarden/context-mirror/
> tree/beta/doc/context/sources/general/fonts
>
> > I did this :
> >
> > \startuniqueMPgraphic{titled}
> >   path p ;
> >   p := unitsquare xscaled \overlaywidth yscaled \overlayheight ;
> >   pickup pencircle scaled 1mm ;
> >   linecap := squared ;
> >   drawoptions(withcolor \MPcolor{darkred}) ;
> >   draw ulcorner p -- urcorner p ;
> >   setbounds currentpicture to p ;
> > \stopuniqueMPgraphic
> >
> > \defineoverlay[titled][\uniqueMPgraphic{titled}]
> >
> > \startuseMPgraphic{triangledone}
> > fill lltriangle scaled 4cm withcolor darkred;
> > \stopuseMPgraphic
> >
> > \defineoverlay[triangledone][\useMPgraphic{triangledone}]
> >
> > \def\Triangledone#1%
> >   {\framed
> >   [background=triangledone,frame=off,offset=overlay]
> >   {\tfb\color[white]{\bf#1}}}
> >
> > \startuseMPgraphic{triangledtwo}
> > fill lrtriangle scaled 4cm withcolor darkred;
> > \stopuseMPgraphic
> >
> > \defineoverlay[triangledtwo][\useMPgraphic{triangledtwo}]
> >
> > \def\Triangledtwo#1%
> >   {\framed
> >   [background=triangledtwo,frame=off,offset=overlay]
> >   {\tfb\color[white]{\bf#1}}}
> >
> > \setupheadertexts[margin][][\Triangledone\pagenumber][\
> Triangledtwo\pagenumber][]
> >
> > \setupfootertexts[margin][]
> >  [{\framed
> >  [background=titled,frame=off,offset=8pt,align=left,
> >   width=\dimexpr\leftmarginwidth-\
> leftedgewidth\relax]
> >   {\darkred\getmarking[section]}}]
> >
> > \setuppagenumbering[alternative=doublesided,location=]
> >
> > \setuphead
> >[section]
> >[color=darkred]
> >
> > \starttext
> >
> > \startchapter[title={First Chapter}]
> > \startsection[title={First section}]
> > \dorecurse{5}{\input knuth}
> > \stoptext
> >
> > Thank you
> > 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://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
___