Re: [NTG-context] How to define a new environment / function?

2015-06-20 Thread Wolfgang Schuster



Dr. Thomas Möbius mailto:kont...@thomasmoebius.de
17. Juni 2015 15:23
Dear list,

having used ConTeXt for years now, I am the first time in need
to, well, programming something. And I realised, I am a little bit
lost. I have a rather long list of variable descriptions that I would
like to typeset in a usable and readable way. It should look something
like this:

---snip: minimal example---
\starttext
\setupdelimitedtext[blockquote]

{{\bf Geschlecht} \qquad Geschlecht \hfill $0,1$}

\startblockquote
Das Geschlecht des Probanden.
\stopblockquote

\blank
{{\bf SoB} \qquad Geburtssaison \hfill $1,\dots,4$}

\startblockquote
Jahreszeit der Geburt. Kodierung: 1 = Winter, 2 = Frühling, 3 = Sommer,
4 = Herbst.
\stopblockquote

\blank
{{\bf BildungV} \qquad Bildung Vater \hfill $1,\dots,6$}

\startblockquote
Ordinale Beschreibung der Bildung des Vaters zum Zeitpunkt der Erhebung.
Kodierung: 0 = kein Abschluss, 1 = Volksschule, 2 = Hauptschule, 3 =
Realschule, 4 = Fachabitur, 5 = Abitur, 6 = Studium.
\stopblockquote

\blank
{{\bf BildungM} \qquad Bildung Mutter \hfill $1,\dots,6$}

\startblockquote
Ordinale Beschreibung der Bildung der Mutter zum Zeitpunkt der Erhebung.
Kodierung siehe {\bf BildungV}.
\stopblockquote

\blank
{{\bf Urb15} \qquad Urbanität \hfill $\naturalnumbers$}

\startblockquote
Beschreibung der Urbanität des Umfelds in den ersten 15 Lebensjahren.
Kodierung: $\sum_{i=1}^{15} u_i$ mit $u_i=$ ein Punkt für eine Stadt bis
10.000 Einwohner, 2 Punkte für bis 100.000 Einwohner, 3 Punkte über
100.000 Einwohner im Jahr $i$.
\stopblockquote

\blank
{{\bf LQ} \qquad Händigkeit \hfill $(0,1)$}

\startblockquote
Lateralisierungsquotient, wobei -1 = perfekt linkshändig und +1 =
perfekt rechtshändig.
\stopblockquote

\stoptext
---end snip---

What I would like to have is a function/environment/something that would
allow me to write the above text in the following way:

---snip: want to example---
\starttext

\startvariable [alias=Geschlecht, name=Geschlecht, range={$0,1$}]
Das Geschlecht des Probanden.
\stopvariable

\startvariable [alias=SoB, name=Geburtssaison, range={$1,\dots,4$}]
Jahreszeit der Geburt. Kodierung: 1 = Winter, 2 = Frühling, 3 = Sommer,
4 = Herbst.
\stopvariable

\startvariable [alias=BildungV, name={Bildung Vater},
range={$1,\dots,6$}, reference=bildungDesVater]
Ordinale Beschreibung der Bildung des Vaters zum Zeitpunkt der Erhebung.
Kodierung: 0 = kein Abschluss, 1 = Volksschule, 2 = Hauptschule, 3 =
Realschule, 4 = Fachabitur, 5 = Abitur, 6 = Studium.
\stopvariable

\startvariable [alias=BildungM, name={Bildung Mutter},
range={$1,\dots,6$}]
Ordinale Beschreibung der Bildung der Mutter zum Zeitpunkt der Erhebung.
Kodierung siehe \in[bildungDesVater].
\stopvariable

\startvariable [alias=Urb15, name=Urbanität, range={$\naturalnumbers$}]
Beschreibung der Urbanität des Umfelds in den ersten 15 Lebensjahren.
Kodierung: $\sum_{i=1}^{15} u_i$ mit $u_i=$ ein Punkt für eine Stadt bis
10.000 Einwohner, 2 Punkte für bis 100.000 Einwohner, 3 Punkte über
100.000 Einwohner im Jahr $i$.

\startvariable [alias=LQ, name=Händigkeit, range={$(0,1)$}]
Lateralisierungsquotient, wobei -1 = perfekt linkshändig und +1 =
perfekt rechtshändig.
\stopvariable

\stoptext
---end snip---

Could someone point me in the right direction, or get me started
somehow? Is this difficult to accomplish? Or is it super easy and I 
just don't know it?


The code below does what you want.

\def\startvariable
  {\begingroup
   \dosingleempty\dostartvariable}

\def\dostartvariable[#1]%
  {\getrawparameters[variable][alias=,name=,range=,reference=,#1]%
   \grabbufferdata[variable][startvariable][stopvariable]}

\def\stopvariable
  {\directsetup{variable:content}%
   \endgroup}

\startsetups[variable:content]

\startlinealignment[middle]
\variablealias
\qquad
\variablename
\hfill
\variablerange

\doifsomething{\variablereference}{\expanded{\reference[\variablereference]{\variablealias}}}

\stoplinealignment

\startblockquote
\getbufferdata[variable]
\stopblockquote

\stopsetups

\starttext

\startvariable [alias=Geschlecht, name=Geschlecht, range={$0,1$}]
Das Geschlecht des Probanden.
\stopvariable

\startvariable [alias=SoB, name=Geburtssaison, range={$1,\dots,4$}]
Jahreszeit der Geburt. Kodierung: 1 = Winter, 2 = Frühling, 3 = Sommer, 
4 = Herbst.

\stopvariable

\startvariable [alias=BildungV, name={Bildung Vater}, 
range={$1,\dots,6$},reference=bildungDesVater]

Ordinale Beschreibung der Bildung des Vaters zum Zeitpunkt der Erhebung.
Kodierung: 0 = kein Abschluss, 1 = Volksschule, 2 = Hauptschule, 3 =
Realschule, 4 = Fachabitur, 5 = Abitur, 6 = Studium.
\stopvariable

\startvariable [alias=BildungM, name={Bildung Mutter}, range={$1,\dots,6$}]
Ordinale Beschreibung der Bildung der Mutter zum Zeitpunkt der Erhebung.
Kodierung siehe \in[bildungDesVater].
\stopvariable

\startvariable [alias=Urb15, name=Urbanität, range={$\naturalnumbers$}]
Beschreibung der 

[NTG-context] How to limit level of sections in TOC?

2015-06-20 Thread Procházka Lukáš Ing . - Pontex s . r . o .

Hello,

I'm not able to limit level of sections in TOC so to not show \subsubsection:


%\setuplist[content][level=subsection] % Doesn't work
%\setuplist[content][section,subsection] % Doesn't work

\starttext
  \placecontent[level=subsection] % Doesn't work
  \hairline
  \placecontent[level=3] % Doesn't work
  \hairline

  \section{Sec}
\subsection{SSec}
  \subsubsection{SSSec}
\stoptext


I studied wiki (http://wiki.contextgarden.net/Command/setuplist) and also 
contextref.pdf (pg. 218) but without success.

What am I doing wrong?

Best regards,

Lukas


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

Tel: +420 241 096 751
Fax: +420 244 461 038

TOC.mkiv
Description: Binary data


TOC.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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] How to limit level of sections in TOC?

2015-06-20 Thread Wolfgang Schuster



Procházka Lukáš Ing. - Pontex s. r. o. mailto:l...@pontex.cz
20. Juni 2015 11:30
Hello,

I'm not able to limit level of sections in TOC so to not show 
\subsubsection:



%\setuplist[content][level=subsection] % Doesn't work
%\setuplist[content][section,subsection] % Doesn't work

\starttext
  \placecontent[level=subsection] % Doesn't work
  \hairline
  \placecontent[level=3] % Doesn't work
  \hairline

  \section{Sec}
\subsection{SSec}
  \subsubsection{SSSec}
\stoptext


I studied wiki (http://wiki.contextgarden.net/Command/setuplist) and 
also contextref.pdf (pg. 218) but without success.
The level key doesn't work with MkIV but you can use the following two 
methods.


1. Use the \placelist command and list the sections you want to show, e.g.

\placelist[chapter,section,subsection]

2. Use the list key for \placecontent to show only the listed entries, e.g.

\placecontent[list={chapter,section,subsection}]

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] How to limit level of sections in TOC?

2015-06-20 Thread Procházka Lukáš Ing . - Pontex s . r . o .

Thank you,

it works perfectly.

Lukas


On Sat, 20 Jun 2015 11:40:47 +0200, Wolfgang Schuster 
schuster.wolfg...@gmail.com wrote:




Procházka Lukáš Ing. - Pontex s. r. o. mailto:l...@pontex.cz
20. Juni 2015 11:30
Hello,

I'm not able to limit level of sections in TOC so to not show
\subsubsection:


%\setuplist[content][level=subsection] % Doesn't work
%\setuplist[content][section,subsection] % Doesn't work

\starttext
  \placecontent[level=subsection] % Doesn't work
  \hairline
  \placecontent[level=3] % Doesn't work
  \hairline

  \section{Sec}
\subsection{SSec}
  \subsubsection{SSSec}
\stoptext


I studied wiki (http://wiki.contextgarden.net/Command/setuplist) and
also contextref.pdf (pg. 218) but without success.

The level key doesn't work with MkIV but you can use the following two
methods.

1. Use the \placelist command and list the sections you want to show, e.g.

 \placelist[chapter,section,subsection]

2. Use the list key for \placecontent to show only the listed entries, e.g.

 \placecontent[list={chapter,section,subsection}]

Wolfgang




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

Tel: +420 241 096 751
Fax: +420 244 461 038

___
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] Wiki broken: “internal error: pdfcrop failed” for new context/

2015-06-20 Thread Philipp A.
Hi, as you see with the second example here:
http://wiki.contextgarden.net/Multiline_equations#Working_with_equation_numbering

perfectly valid code that isn’t already rendered and cached fails to be
shown.

Someone needs to fix the wiki!

cheers, p
___
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] definereferencestructureprefix for floats

2015-06-20 Thread Aditya Mahajan

Hi,

How does one control the referenceprefix for floats. I want to refer to 
the figures as only Fig 1, Fig 2, etc, even when they are numbered 1.1, 
1.2, etc.


The example from strc-ref.mkvi does not work (I get 1.I-A.1 and 1.I-A.2)

\defineconversionset[default][Character,number,Romannumerals,Character][number]
\defineseparatorset [default][.,.,--][.]
\setuphead[subsection][sectionstopper=),sectionsegments=4:4]
\setupreferencestructureprefix[default][prefixsegments=2:4]
\setupreferencestructureprefix[figure][default][prefixsegments=3:4]

\starttext
\chapter {One}
\section {One}
\subsection[sec:test]{Two}
See \in[sec:test] and \in[fig:xx] and \in[fig:yy]
\placefigure[here][fig:xx]{}{}
\placefigure[here][fig:yy]{}{}

\stoptext

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

Re: [NTG-context] definereferencestructureprefix for floats

2015-06-20 Thread Wolfgang Schuster



Aditya Mahajan mailto:adit...@umich.edu
20. Juni 2015 18:22
Hi,

How does one control the referenceprefix for floats. I want to refer 
to the figures as only Fig 1, Fig 2, etc, even when they are numbered 
1.1, 1.2, etc.

There is a typo in strc-ref.lua which can by fixed by the following changes.

local function getcurrentprefixspec(default)
local data = currentreference and currentreference.i
local metadata = data and data.metadata
print(metatadata and metadata.kind or ?)
return
-   metatadata and metadata.kind or ?,
-   metatadata and metadata.name or ?,
-   default  or ?
+   metadata and metadata.kind or ?,
+   metadata and metadata.name or ?,
+   defaultor ?
end

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
___