Re: [NTG-context] Dynamic headings query heading information

2014-02-08 Thread Andreas Schneider
Title: Re: [NTG-context] Dynamic headings  query heading information


On Friday, February 7, 2014, at 18:12 Wolfgang Schuster wrote:





Am 07.02.2014 um 15:45 schrieb Andreas Schneider ak...@gmx.de:

Dynamic headings  query heading information 
2) another macro should build an index at the end of the document. I use Lua to keep a list of all database tables referenced within the document (together with some metadata) and save it in the jobpasses struct. Now I also want to track the chapters, sections, etc where these references are, to be able to see, where a database table is used.

To solve these two problems, I'm looking for information about the current heading. The level and the associated reference name.
If I have the level, I can keep my own list of necessary heading types (subject, subsubject, ...) and just get the one at level+1 to write the heading using lua (tex.sprint()).
With the reference name I can obviously solve 2), since I then can simply keep a list for each db table in the jobpasses structure.
You can try the \currentstrcuture… commands but I don’t know if the are meant as user level commands.

\starttext

\chapter{Chapter}

\starttabulate
\NC Name \EQ \currentstructurename \NC\NR
\NC Level \EQ \currentstructurelevel \NC\NR
\stoptabulate

\section{Section}

\starttabulate
\NC Name \EQ \currentstructurename \NC\NR
\NC Level \EQ \currentstructurelevel \NC\NR
\stoptabulate

\stoptext

Wolfgang




In case I haven't told you before: you are awesome!

This is exactly what I was looking for. Due to this I also found \currentstructurereference and a bunch of other commands :)
Once you know that "structure" is the keyword, "strc-sec.*" is just around the corner.

Regarding your earlier mail (\definesectionlevels ...):
Wow, there is really a lot of "hidden" functionality in ConTeXt. If you lay out the document with these commands from the beginning, that really eases restructuring tasks. However the readability (of the source code) slightly falls off. I will evaluate this further. Thanks for this too :-)

-- 
Best Regards,
Andreas

___
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] Centering the last line in combination subcaptions

2014-02-08 Thread Jan Tosovsky
On 2014-02-08 Wolfgang Schuster wrote:
 
  I haven't find any better way to extend the caption width than that
  negative value for narrowed text. It works, but that empty space above 
  looks weird
 
 You have to force a certain width for your images because the width
 of the text space depends on the width of the images. You can use
 \framed (instead of loffset/roffset you can also set a fixed width) or
 \simplealignedbox to set the width of the images.
 
 \setupexternalfigures[location=default]
 
 \defineframed[CombinationBox][frame=off,offset=none,loffset=3cm,roffset
 =3cm]
 
 \starttext
 
 \startplacefigure[location={force,none}]
   \startcombination[nx=1,ny=2,align={last,hz,hanging},style=\itx]
 % first image
 \startcontent
 
 %\simplealignedbox{11cm}{middle}{\externalfigure[cow][width=5cm]}
 \CombinationBox{\externalfigure[cow][width=5cm]}
   \stopcontent
   \startcaption
 \input{ward}
   \stopcaption
   % second image
 \startcontent
 
 %\simplealignedbox{11cm}{middle}{\externalfigure[cow][width=5cm]}
 \CombinationBox{\externalfigure[cow][width=5cm]}
   \stopcontent
   \startcaption
 \input{ward}
   \stopcaption
   \stopcombination
 \stopplacefigure
 
 \stoptext

Thanks a lot, it is much simpler! I also like that \start \stop structure
which makes the code more clear.

Just for future reference: CombinationBox extends the current image width
with the fixed value. When different image widths are used in your document,
the caption width varies as well. To keep the consistency within the
document I've chosen that simplealignedbox instead. 

Jan

___
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] [***SPAM***] RE: Footnote line position

2014-02-08 Thread Jan Tosovsky
On 2013-12-01 Jan Tosovsky wrote:
 On 2013-11-22 Jan Tosovsky wrote:
 
  when a single line footnote is used, the footnote divider is
  rendered in larger distance than for footnotes with two or
  more lines (I mean a gap between the line and the footnote text).
 
  It can be tested easily:
 
  \chapter{Chapter}Foo\footnote{Bar}.
  \chapter{Chapter}Foo\footnote{Bar
 
  Bar}.
 
 
 This behaviour seems to be driven by this code in strc-not.mkvi:
 
 \unexpanded\def\normalnoterule
   {\ifvmode
  \dontleavehmode \blackrule
[\c!color=\noteparameter\c!rulecolor,
 \c!width=.2\hsize,
 \c!height=\noteparameter\c!rulethickness,
 \c!depth=\zeropoint]%
  \endgraf
  \kern\strutdepth
\fi}
 
 When e.g. \endgraf or \kern\strutdepth lines are commented, the gap is
 smaller, but still different.
 
 Changing the depth from \zeropoint to a bigger value (1cm) makes the
 gap same, but it leads to extreme thick rule.
 

After couple of weeks I've updated my Beta and I cannot reproduce the
original behaviour any more!

Thanks for fixing, 

Jan

___
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] Divider in grid environment

2014-02-08 Thread Jan Tosovsky
Dear All,

I'd like to use a divider between certain paragraphs. As I want to keep all
the lines on the grid so it should have a height = N x line height.

As \hl renders the line on baseline, I have to tweek the space before/after
using the 'blank' command to keep the horizontal line in the +/- middle:

\setuplayout[grid=yes]
\showgrid
\showlayoutcomponents

\starttext
\input{ward}
\blank[4mm]\middlealigned{\hl[4]}\blank[6mm]
\input{ward}
\stoptext

But this solution requires adjustments for different fonts or font sizes...

Is there a more efficient way how to accomplish this?

Thanks, Jan

___
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] Centering the last line in combination subcaptions

2014-02-08 Thread Wolfgang Schuster

Am 08.02.2014 um 12:22 schrieb Jan Tosovsky j.tosov...@email.cz:

 On 2014-02-08 Wolfgang Schuster wrote:
 
 I haven't find any better way to extend the caption width than that
 negative value for narrowed text. It works, but that empty space above 
 looks weird
 
 You have to force a certain width for your images because the width
 of the text space depends on the width of the images. You can use
 \framed (instead of loffset/roffset you can also set a fixed width) or
 \simplealignedbox to set the width of the images.
 
 \setupexternalfigures[location=default]
 
 \defineframed[CombinationBox][frame=off,offset=none,loffset=3cm,roffset
 =3cm]
 
 \starttext
 
 \startplacefigure[location={force,none}]
  \startcombination[nx=1,ny=2,align={last,hz,hanging},style=\itx]
% first image
\startcontent
 
 %\simplealignedbox{11cm}{middle}{\externalfigure[cow][width=5cm]}
\CombinationBox{\externalfigure[cow][width=5cm]}
  \stopcontent
  \startcaption
\input{ward}
  \stopcaption
  % second image
\startcontent
 
 %\simplealignedbox{11cm}{middle}{\externalfigure[cow][width=5cm]}
\CombinationBox{\externalfigure[cow][width=5cm]}
  \stopcontent
  \startcaption
\input{ward}
  \stopcaption
  \stopcombination
 \stopplacefigure
 
 \stoptext
 
 Thanks a lot, it is much simpler! I also like that \start \stop structure
 which makes the code more clear.
 
 Just for future reference: CombinationBox extends the current image width
 with the fixed value. When different image widths are used in your document,
 the caption width varies as well. To keep the consistency within the
 document I've chosen that simplealignedbox instead. 

When you want a fixed width for \CombinationBox you have to change the 
definition to

  \defineframed[CombinationBox][frame=off,offset=none,width=11cm]

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] Divider in grid environment

2014-02-08 Thread Jan Tosovsky
On 2014-02-08 Jan Tosovsky wrote:
 I'd like to use a divider between certain paragraphs. As I want to keep
 all the lines on the grid so it should have a height = N x line height.
 
 As \hl renders the line on baseline, I have to tweak the space
 before/after using the 'blank' command to keep the horizontal line 
 in the +/- middle:
 
 \setuplayout[grid=yes]
 \showgrid
 \showlayoutcomponents
 
 \starttext
 \input{ward}
 \blank[4mm]\middlealigned{\hl[4]}\blank[6mm]
 \input{ward}
 \stoptext
 
 But this solution requires adjustments for different fonts or font
 sizes...
 
 Is there a more efficient way how to accomplish this?

Additionally, I'd like to keep that divider with the previous content
(paragraph).

In this case AFAIK \testpage[n] cannot be used directly in the divider
definition as it breaks the page at position of this command.

I'd like to express rather: If there is no space for three lines, break the
page, but grab few previous lines (at least 2) together with me (according
to orphan/widow settings).

The current behaviour can be demonstrated using this example:

\startsetups[grid][mypenalties]
\setdefaultpenalties
\setpenalties\widowpenalties{2}{1}
\setpenalties\clubpenalties {2}{1}
\stopsetups

\setuplayout[grid=yes, setups=mypenalties]
\showgrid
\showlayoutcomponents

\starttext
\blank[force, 30*line]
\input{tufte}
\blank[4mm]\middlealigned{\hl[4]}\blank[6mm]
\stoptext

In my case the divider is used also to emphasise Chapter ends - so it is
very often the last element one the page and there is no need to check also
the space which follows (whether next lines will fit or not). So
'keep-with-previous' is enough for me.

Jan

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