Re: [NTG-context] Use \unit for value and uncertainty

2016-10-31 Thread Florian Leupold
Hello!

There does not seem to be a simple solution to using \unit with uncertainties, 
see below.

Could someone maybe point me to the relevant source code for the parser for 
\unit in MKIV? Then I would try to modify/improve the code myself.

Thanks a lot and best regards,
Florian


> On 25.09.16, at 20:11, Florian Leupold <fleup...@posteo.net> wrote:
> 
> Dear list
> 
> Is it possible to use the units module (in MKIV) for value plusminus 
> uncertainty in a way similar to the \SI command in LaTeX, like
>  \unit{(1.59\pm2)e-19 coulomb} or
>  \unit{1.59(2)e-19 coulomb}?
> 
> Thanks and best regards,
> Florian
> ___
> 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
> ___

___
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] Reduced whitespace when nesting different itemgroups

2016-10-20 Thread Florian Leupold
Dear list,

I have noticed a strange behavior when nesting different itemgroups: The 
whitespace before the lower-level group is reduced. This does not happen when 
nesting itemgroups of the same kind. And this can somehow be circumvented by 
setting [columns, one], see MWE below.

Is this expected behavior, or a bug?

Best regards,
Florian


MWE:

\starttext

\startitemize
\item Itemize 1.
\startitemize[columns, one]
\item Itemize 1.1
\item Itemize 1.2
\stopitemize
\stopitemize

\defineitemgroup[it]
\startitemize
\item Itemize 1.
\startit
\item It 1.1 (reduced whitespace above)
\item It 1.2
\stopit
\stopitemize

\startitemize
\item Itemize 1.
\startit[columns, one]
\item It 1.1
\item It 1.2
\stopit
\stopitemize

\stoptext


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
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] How to clone \underbar?

2016-10-19 Thread Florian Leupold
Dear list,

how can I clone \underbar (for the purpose of changing settings for the clone 
afterwards)?

Just using \definebar to inherit \underbar’s properties does not entirely work, 
see MWE:

\definebar[myBar][underbar]
\starttext
underbar text mode: \underbar{$a^b$}\crlf
underbar math mode: $\underbar{a^b}$\crlf
myBar text mode:\myBar{$a^b$}   \crlf
myBar math mode:$\myBar{a^b}$
\stoptext

Thanks and best regards,
Florian






signature.asc
Description: Message signed with OpenPGP using GPGMail
___
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] Side effect of leftmargin for formulas on \inright

2016-10-19 Thread Florian Leupold
Dear list,

I have noticed that the key leftmargin for formulas has a side effect on 
\inright, see MWE below.

Assuming that is unwanted behavior, is there a way to circumvent the horizontal 
misplacement of the margin note?

Thanks and best regards,
Florian


MWE:

\setupformulas[align=right]
\starttext

\inright{Text}
Text

\inright{0em}
\placeformula[-]\startformula a^2+b^2=c^2 \stopformula

\setupformulas[leftmargin=2em]
\inright{2em}
\placeformula[-]\startformula a^2+b^2=c^2 \stopformula

\setupformulas[leftmargin=4em]
\inright{4em}
\placeformula[-]\startformula a^2+b^2=c^2 \stopformula

\stoptext


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
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] Bug in \usetikzlibrary{datavisualization}?

2016-10-07 Thread Florian Leupold

> On 06.10.16, at 00:27, Hans Hagen <pra...@wxs.nl> wrote:
> 
> On 10/5/2016 9:51 PM, Florian Leupold wrote:
>> Dear list,
>> 
>> Sorry for posting a duplicate, but I guess my previous post got lost during 
>> the conference...
>> 
>> When one tries to load the TikZ data visualization library, the documents 
>> does not compile anymore. The error is 
>> “.../tikzlibrarydatavisualization.code.tex: ! Missing number, treated as 
>> zero”.
>> 
>> I have also tried this using ConTeXt online, to the same end:
>> http://live.contextgarden.net/cgi-bin/output.cgi?id=jSjLZO
>> 
>> \usemodule[tikz]
>> \usetikzlibrary{datavisualization}
>> \starttext
>> Hello world!
>> \stoptext
>> 
>> Is this a known bug or could I somehow fix this to get data visualization to 
>> work?
> 
> \unprotect
> \usetikzlibrary{datavisualization}
> \protect
> 
> 
>> Best,
>> Florian
>> 
>> 
>> 
>> ___
>> 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
>> ___
>> 
> 
> 
> --
> 
> -
>  Hans Hagen | PRAGMA ADE
>  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>   tel: 038 477 53 69 | www.pragma-ade.nl | 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
> ___


The \unprotect\protect changes something, but does not do the whole trick. 
Please see the error messages below.


### Start: without \unprotect\protect
tex error   > tex error on line 682 in file 
/Users/Florian/context/tex/texmf-modules/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.code.tex:
 ! Missing number, treated as zero


^
l.682 {\catcode`\^^
 M=\active%

672   padding/.style={padding min={-#1},padding max={#1}},
673   label/.code={%
674 \def\pgf@temp{#1}%
675 \ifx\pgf@temp\tikz@lib@dv@auto@attribute%
676   
\tikzdatavisualizationset{\tikz@dv@axis/label/.expanded=$\noexpand\mathit{\pgfkeysvalueof{\tikz@dv@axis/attribute}}$}%
677 \else
678   \tikzdatavisualizationset{\tikz@dv@axis/label={#1}}%
679 \fi
680   },
681   label/.default=\tikz@lib@dv@auto@attribute,
682 >>%
683   % Strategies
684   %
685   tick placement strategy/.style={\tikz@dv@axis/@compute at 
positions={#1}},
686   linear steps/.style={tick placement 
strategy=\tikz@lib@dv@compute@at@linear},
687   %
688   % Attribute setter
689   %
690   goto/.code={\tikz@dv@goto{\tikz@dv@axis}{#1}},
691   goto pos/.code={\tikz@dv@goto@pos{\tikz@dv@axis}{#1}},
692   anchor at 
min/.code={\tikz@lib@dv@special@at{\tikz@dv@axis}{\tikz@dv@min@anchor}},
### Stop: without \unprotect\protect


### Start: with \unprotect\protect
tex error   > tex error on line 2410 in file 
/Users/Florian/context/tex/texmf-modules/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.code.tex:
 ! Undefined control sequence


\tikzdvdeclarestylesheetcolorseries ...olorseries
  {tikzdvcolorseries#1}{#2}{...
l.2410 ...eries{vary hue}{hsb}{.4,0.9,0.8}{.213,0,0}


2400   \resetcolorseries{tikzdvcolorseries#1}
2401   \pgfdvdeclarestylesheet{#1}
2402   {
2403 default style/.style={
2404   
/utils/exec=\colorlet{tikz@dv@temp}[rgb]{tikzdvcolorseries#1!![##1]},
2405   visualizer color=tikz@dv@temp
2406 }
2407   }
2408 }
2409
2410 >>  \tikzdvdeclarestylesheetcolorseries{vary 
hue}{hsb}{.4,0.9,0.8}{.213,0,0}
2411 \tikzdvdeclarestylesheetcolorseries{shades of 
blue}{hsb}{.65,1.4,1}{0,-.4,-.0}
2412 \tikzdvdeclare

[NTG-context] Underlining formulas and units

2016-10-05 Thread Florian Leupold
Dear list,

underbar behaves weirdly when it comes to indexes, exponents, and units:

\starttext
\underbar{$F_C=\unit{1e2 newton}$} or \underbar{\unit{1e2 newton}}
\stoptext

Am I doing something wrong? Is there maybe a setting to correct for this?

Thanks,
Florian


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
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] Bug in \usetikzlibrary{datavisualization}?

2016-10-05 Thread Florian Leupold
Dear list,

Sorry for posting a duplicate, but I guess my previous post got lost during the 
conference...

When one tries to load the TikZ data visualization library, the documents does 
not compile anymore. The error is “.../tikzlibrarydatavisualization.code.tex: ! 
Missing number, treated as zero”.

I have also tried this using ConTeXt online, to the same end:
http://live.contextgarden.net/cgi-bin/output.cgi?id=jSjLZO

\usemodule[tikz]
\usetikzlibrary{datavisualization}
\starttext
Hello world!
\stoptext

Is this a known bug or could I somehow fix this to get data visualization to 
work?

Best,
Florian


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
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] text–formula separation inside a frame

2016-10-05 Thread Florian Leupold
Dear list,

Sorry for posting a duplicate, but I guess my previous post got lost during the 
conference...

I have got a problem with spacing before a formula inside a frame. The 
text–formula separation somehow is bigger when it occurs in a frame (see MWE 
below). Is there an explanation, and/or (even better) a possible fix?

Thanks a lot!
Florian

MWE:

\defineframed[Framed][width=\textwidth, height=5cm, align=normal]
\starttext
This formula is preceded by normal spacing:
\placeformula[-]\startformula
1+1=2
\stopformula
\Framed{
This formula somehow is preceded by too much spacing:
\placeformula[-]\startformula
1+1=2
\stopformula
}
\stoptext


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
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] Bug in \usetikzlibrary{datavisualization}?

2016-09-28 Thread Florian Leupold
Dear list,

when one tries to load the TikZ data visualization library, the documents does 
not compile anymore. The error is “.../tikzlibrarydatavisualization.code.tex: ! 
Missing number, treated as zero”.

I have also tried this using ConTeXt online, to the same end:
http://live.contextgarden.net/cgi-bin/output.cgi?id=jSjLZO

\usemodule[tikz]
\usetikzlibrary{datavisualization}
\starttext
Hello world!
\stoptext

Is this a known bug?

Best,
Florian


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
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] Tabulation in itemize list

2016-09-26 Thread Florian Leupold

> On 26.09.16, at 17:07, Wolfgang Schuster <schuster.wolfg...@gmail.com> wrote:
> 
>> Florian Leupold 26. September 2016 um 16:30
>> 
>> Dear Wolfgang,
>> 
>> thank you for your suggestion!
>> 
>> However, it seems the code does not compile properly. Both, frame and 
>> tabulate compile without the other, but not together. The error I get is 
>> “Missing } inserted” on the line “\stoptabulate”.
>> 
>> Could this be a bug?
> The example works for me.
> 
> mtx-context | current version: 2016.09.24 12:40
> 
> 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
> ___

Okay, is this something that got fixed since May then?

Using ConTeXt online (ConTeXt  ver: 2016.05.19 13:43 MKIV current  fmt: 
2016.8.24), it also does not work.
http://live.contextgarden.net/cgi-bin/output.cgi?id=dpiqSe

That would mean I am in trouble because I am running the MacTeX version of 
ConTeXt since I could not get the standalone version to work with TeXShop.

Best,
Florian


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
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] Tabulation in itemize list

2016-09-26 Thread Florian Leupold

> On 26.09.16, at 14:08, Wolfgang Schuster <schuster.wolfg...@gmail.com> wrote:
> 
>> Florian Leupold  26. September 2016 um 12:53
>> Dear list,
>> 
>> is there a clever way to put a tabulation into an itemize list? I would like 
>> to have it on the first line of an item, see MWE. However, when I just 
>> insert the tabulation after \item, the table is shifted down. A naive fix 
>> using \blank[overlay], on the other hand, places the tabulation too high.
>> 
>> Could you help me or indicate a better solution to achieve this?
>> 
>> \starttext
>> \startitemize
>> \item
>> %\blank[overlay]\blank[overlay]
>> \starttabulate[|r|p|r|p|]
>> \NC given:   \NC $a=1$\\$b=2$\NC sought: \NC $c$ \NC\NR
>> \stoptabulate
>> \stopitemize
>> \stoptext
> \starttext
> 
> \startitemize
> \startitem
> \startframed[frame=off,location=top]
> \starttabulate[|r|p|r|p|]
> \NCgiven:\NC $a=1$\par $b=2$\NC sought:\NC $c$
> \NC\NR
> \NCgiven:\NC $a=1$\par $b=2$\NC sought:\NC $c$
> \NC\NR
> \NCgiven:\NC $a=1$\par $b=2$\NC sought:\NC $c$
> \NC\NR
> \stoptabulate
> \stopframed
> \stopitem
> \stopitemize
> 
> \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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki : http://contextgarden.net
> ___

Dear Wolfgang,

thank you for your suggestion!

However, it seems the code does not compile properly. Both, frame and tabulate 
compile without the other, but not together. The error I get is “Missing } 
inserted” on the line “\stoptabulate”.

Could this be a bug?

– Florian


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
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] Tabulation in itemize list

2016-09-26 Thread Florian Leupold
Dear list,

is there a clever way to put a tabulation into an itemize list? I would like to 
have it on the first line of an item, see MWE. However, when I just insert the 
tabulation after \item, the table is shifted down. A naive fix using 
\blank[overlay], on the other hand, places the tabulation too high.

Could you help me or indicate a better solution to achieve this?

\starttext
\startitemize
\item
%\blank[overlay]\blank[overlay]
\starttabulate[|r|p|r|p|]
\NC given:  \NC $a=1$\\$b=2$\NC sought: \NC $c$ \NC\NR
\stoptabulate
\stopitemize
\stoptext

Thanks a lot and best regards,
Florian


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
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] text–formula separation inside a frame

2016-09-25 Thread Florian Leupold
Dear list,

I have got a problem with spacing before a formula inside a frame. The 
text–formula separation somehow is bigger when it occurs in a frame (see MWE 
below). Is there an explanation, and/or (even better) a possible fix?

Thanks a lot!
Florian

MWE:

\defineframed[Framed][width=\textwidth, height=5cm, align=normal]
\starttext
This formula is preceded by normal spacing:
\placeformula[-]\startformula
1+1=2
\stopformula
\Framed{
This formula somehow is preceded by too much spacing:
\placeformula[-]\startformula
1+1=2
\stopformula
}
\stoptext


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
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] Use \unit for value and uncertainty

2016-09-25 Thread Florian Leupold
Dear list

Is it possible to use the units module (in MKIV) for value plusminus 
uncertainty in a way similar to the \SI command in LaTeX, like
  \unit{(1.59\pm2)e-19 coulomb} or
  \unit{1.59(2)e-19 coulomb}?

Thanks and best regards,
Florian


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
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] Bug: \registerunit is not case sensitive

2016-09-14 Thread Florian Leupold
Dear list,

I would like to point out the following bug: \registerunit is not case 
sensitive. This means that if I register “N” for Newton, “n” for nano is 
overwritten.

MWE:

\registerunit[unit][N=newton]
\starttext
Newton: \unit{1N}, nano meter: \unit{1nm}
\stoptext

Best regards,
Florian


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
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] Nonbreaking, non-vanishing horizontal spaces above underbar

2016-09-14 Thread Florian Leupold
Dear all,

I would like to create cloze texts with solutions, but I have problems with 
horizontal spaces above the underbar, namely:
1) After a linebreak, horizontal space is cut off despite the \zwj.
2) I cannot find a way of scaling the leading and trailing space to equal 0.2 
times the width of the text above the underbar.

MNWE:

\definebar[ClozedBar][underbar][continue=yes, color=black, offset=-0.5]
\unexpanded\def\Clozed#1{\startbar[ClozedBar]
\zwj\hskip\widthofstring{#1}#1\hskip\widthofstring{#1}\zwj\stopbar}
\starttext
\Clozed{\color[red]{CLOZE 1}} text text text text text
\Clozed{\color[red]{CLOZE 2}} <- This one is cut at the beginning.
\stoptext

Could someone help me? Thanks a lot in advance!

Best regards,
Florian



signature.asc
Description: Message signed with OpenPGP using GPGMail
___
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] Bug with \underbar and \placefigure[right]

2016-09-08 Thread Florian Leupold
Dear list,

I would like to report a bug: When \underbar is used for the first word of a 
paragraph in conjunction with \placefigure[right], the text overwrites the 
figure.

MNWE:

\setupexternalfigures[order={pdf,png,jpg}, location={local,global,default}]
\starttext
\placefigure[right, none]{}{\externalfigure[mill]}
This paragraph is okay.
\input{tufte}
\placefigure[right, none]{}{\externalfigure[mill]}
\underbar{This paragraph has a problem.}
\input{ward}
\stoptext

Best regards,
Florian


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
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] Enumeration: chapter in counter, problem next to placefigure, and documentation issues

2016-09-06 Thread Florian Leupold

> On 06.09.16, at 02:55, Aditya Mahajan <adit...@umich.edu> wrote:
> 
> On Mon, 5 Sep 2016, Florian Leupold wrote:
> 
>> One problem, however, persists: The theorem environment gets misplaced when 
>> a figure is placed to its left:
>> 
>> \setupexternalfigures[location=default]
>> \setupenumerations[
>>  alternative=left,
>>  text=Theorem,
>>  title=no,
>>  stopper={:},
>>  distance=0ex,
>>  width=fit,
>>  right={~},
>>  style=normal,
>>  hang=fit]
> 
> I am not sure what visual layout you want, but how about using:
> 
> \setupenumerations[
>alternative=serried,
>text=Theorem,
>title=no,
>stopper={:},
>distance=0ex,
>width=fit,
>right={~},
>style=normal,
>  ]
> \defineenumeration[theorem]
> 
> 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
> ___

Dear Aditya,

thanks, that is indeed what I wanted to achieve. I don’t know why I got hung up 
with “alternative=left”.

Best,
Florian


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
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] Enumeration: chapter in counter, problem next to placefigure, and documentation issues

2016-09-05 Thread Florian Leupold
> On 04.09.16, at 21:54, Otared Kavian <ota...@gmail.com> wrote:
> 
> Hi Florian,
> 
> The following setup works fine here, I wonder whether this is what you want:
> 
> \defineenumeration[theorem]
>   [text={Theorem},
>   style=slanted,
>   title=yes,
>   alternative=hanging,
> % hang=2,
>   width=fit,
>   right={~},
>   way=bychapter,
> % way=bysection,
>   prefix=yes,
> % prefixsegments={chapter:section},
>   prefixsegments={chapter},
>   ]
> 
> Another more versatile solution is to define an enumeration like the 
> \proclaim definition of plain TeX, as follows:
> 
> \defineenumeration[proclaim]
>   [text=,
>   style=slanted,
>   title=yes,
>   titleleft=,
>   titleright={.},
>   alternative=hanging,
> % hang=2,
>   width=fit,
>   right={~},
>   way=bychapter,
> % way=bysection,
>   prefix=yes,
> % prefixsegments={chapter:section},
>   prefixsegments={chapter},
>   ]
> 
> and the use it as in the following example:
> 
> \startproclaim{Pythagoras Theorem}
> The square on the hypotenuse is equal to the sum of the squares on the other 
> two sides.
> \stopproclaim
> 
> You can play with other options in the setups above and tune them to your 
> taste.
> 
> Best regards: OK
> 
>> On 4 Sep 2016, at 19:37, Florian Leupold <fleup...@posteo.net> wrote:
>> 
>> Dear list,
>> 
>> I am trying to use enumerations with MKIV I am a bit at a loss when it comes 
>> to the documentation (see below for a few issues).
>> 
>> Working on a concrete example, I have come pretty close to what I want for 
>> my enumeration ‘theorem’:
>> 
>> \setupexternalfigures[location=default]
>> \setupenumerations[
>>  alternative=left,
>>  text=Theorem,
>>  headstyle=bold,
>>  title=no,
>>  way=bychapter,
>>  stopper={:},
>>  distance=1ex,
>>  width=fit,
>>  style=normal,
>>  hang=fit]
>> \defineenumeration[theorem]
>> \starttext
>> \chapter{First chapter}
>> \starttheorem
>> The square on the hypotenuse is equal to the sum of the squares on the other 
>> two sides.
>> \stoptheorem
>> \chapter{Second chapter}
>> \placefigure[right, none]{}{\externalfigure[mill]}
>> \starttheorem
>> The square on the hypotenuse is equal to the sum of the squares on the other 
>> two sides.
>> \stoptheorem
>> \stoptext
>> 
>> QUESTIONS:
>> 1) I would like to prefix the theorem counter with the chapter number, such 
>> that the number of the second theorem becomes 2.1. Can this be done?
>> 2) Is it possible to circumvent the misplacement of the second theorem due 
>> to the placed figure? Ideally, the theorem would just use the space to the 
>> left it.
>> 
>> Issues with the documentation:
>> - In “ConTeXt Commands”, it says on page 224 that \setupenumeration inherits 
>> from \setupcounter; but in “ConTEXt reference manual", it says on page 246 
>> that \setupenumerations inherits from \setupdescriptions.
>> - In “ConTEXt reference manual”, the key “location” for \defineenumeration 
>> should probably replaced by “alternative”. Right now, all examples on page 
>> 247 are unaffected by this setting and hence look the same.
>> - The wiki seems to use MKII, which makes a difference for the example on 
>> http://wiki.contextgarden.net/Command/enumeration, which compiles 
>> differently under ConTeXT online.
>> 
>> Thanks for your help!
>> 
>> Best regards,
>> Florian
>> ___
>> 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
>> ___
> 
> ___
> 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] Enumeration: chapter in counter, problem next to placefigure, and documentation issues

2016-09-04 Thread Florian Leupold
Dear list,

I am trying to use enumerations with MKIV I am a bit at a loss when it comes to 
the documentation (see below for a few issues).

Working on a concrete example, I have come pretty close to what I want for my 
enumeration ‘theorem’:

\setupexternalfigures[location=default]
\setupenumerations[
alternative=left,
text=Theorem,
headstyle=bold,
title=no,
way=bychapter,
stopper={:},
distance=1ex,
width=fit,
style=normal,
hang=fit]
\defineenumeration[theorem]
\starttext
\chapter{First chapter}
\starttheorem
The square on the hypotenuse is equal to the sum of the squares on the other 
two sides.
\stoptheorem
\chapter{Second chapter}
\placefigure[right, none]{}{\externalfigure[mill]}
\starttheorem
The square on the hypotenuse is equal to the sum of the squares on the other 
two sides.
\stoptheorem
\stoptext

QUESTIONS:
1) I would like to prefix the theorem counter with the chapter number, such 
that the number of the second theorem becomes 2.1. Can this be done?
2) Is it possible to circumvent the misplacement of the second theorem due to 
the placed figure? Ideally, the theorem would just use the space to the left it.

Issues with the documentation:
- In “ConTeXt Commands”, it says on page 224 that \setupenumeration inherits 
from \setupcounter; but in “ConTEXt reference manual", it says on page 246 that 
\setupenumerations inherits from \setupdescriptions.
- In “ConTEXt reference manual”, the key “location” for \defineenumeration 
should probably replaced by “alternative”. Right now, all examples on page 247 
are unaffected by this setting and hence look the same.
- The wiki seems to use MKII, which makes a difference for the example on 
http://wiki.contextgarden.net/Command/enumeration, which compiles differently 
under ConTeXT online.

Thanks for your help!

Best regards,
Florian


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
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] Creating cloze texts

2016-09-04 Thread Florian Leupold

> On 04.09.16, at 16:28, Florian Leupold <fleup...@posteo.net> wrote:
> 
> 
>> On 04.09.16, at 14:14, Hans Hagen <pra...@wxs.nl> wrote:
>> 
>> On 9/4/2016 12:03 PM, Hans Hagen wrote:
>> 
>>> \definebar[ClozedBar][underbar][continue=yes]
>>> 
>>> \unexpanded\def\Clozed#1{\ClozedBar{\zwj#1\zwj}}
>>> 
>>> \starttext
>>> 
>>> \input ward
>>> \Clozed{\color[red]{CLOZE 1}}
>>> \input ward
>>> \Clozed{\quad\color[red]{CLOZE 2}\quad}
>>> \input ward
>>> \Clozed{\color[white]{x}\quad\color[red]{CLOZE 3}\quad\color[white]{x}}
>>> \input ward
>>> \Clozed{\color[green]{x}\quad\color[red]{CLOZE 4}\quad\color[white]{x}}
>>> \input ward
>>> space \Clozed{\color[red]{CLOZE 5}\qquad\color[white]{x}} space
>>> \input ward
>>> 
>>> \stoptext
>> 
>> in next beta you can specify an empty option which will remove the text 
>> (otherwise one can still copy it from the pdf):
>> 
>> \definebar[ClozedBar][underbar][continue=yes,empty=yes]
>> 
>> 
>> -
>> Hans Hagen | PRAGMA ADE
>> Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>>  tel: 038 477 53 69 | www.pragma-ade.nl | 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
>> ___
> 
> Dear Hans,
> 
> thanks a lot for your solution!
> 
> I have added "color=black” to \definebar to prevent the bar’s color from 
> changing at a line break, which happens otherwise:
> 
> \definebar[ClozedBar][underbar][continue=yes]
> %\definebar[ClozedBar][underbar][continue=yes, color=black]
> \unexpanded\def\Clozed#1{\ClozedBar{\zwj\quad#1\quad\zwj}}
> \starttext
> \Clozed{\color[red]{CLOZE 1}} text text text text text text text text text 
> text text
> \Clozed{\color[red]{CLOZE 2 CLOZE 2}}
> \stoptext
> 
> Now the extra space is hardcoded by \quad. I guess it’s not so easy then to 
> make the underbar’s width a factor times the input text width? Or, 
> alternatively, an explicitly given width?
> 
> Cheers,
> Florian
> ___
> 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
> ___

ADDENDUM:

There is still another problem: The fixed leading space may be eaten away by a 
line break.

\definebar[ClozedBar][underbar][continue=yes, color=black]
\unexpanded\def\Clozed#1{\ClozedBar{\zwj\quad#1\quad\zwj}}

\starttext
\Clozed{\color[red]{CLOZE 1}} text text text text text text text text text text 
text text text
\Clozed{\color[red]{CLOZE 2 CLOZE 2}}
\stoptext




signature.asc
Description: Message signed with OpenPGP using GPGMail
___
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] Creating cloze texts

2016-09-04 Thread Florian Leupold

> On 04.09.16, at 14:14, Hans Hagen  wrote:
> 
> On 9/4/2016 12:03 PM, Hans Hagen wrote:
> 
>> \definebar[ClozedBar][underbar][continue=yes]
>> 
>> \unexpanded\def\Clozed#1{\ClozedBar{\zwj#1\zwj}}
>> 
>> \starttext
>> 
>> \input ward
>> \Clozed{\color[red]{CLOZE 1}}
>> \input ward
>> \Clozed{\quad\color[red]{CLOZE 2}\quad}
>> \input ward
>> \Clozed{\color[white]{x}\quad\color[red]{CLOZE 3}\quad\color[white]{x}}
>> \input ward
>> \Clozed{\color[green]{x}\quad\color[red]{CLOZE 4}\quad\color[white]{x}}
>> \input ward
>> space \Clozed{\color[red]{CLOZE 5}\qquad\color[white]{x}} space
>> \input ward
>> 
>> \stoptext
> 
> in next beta you can specify an empty option which will remove the text 
> (otherwise one can still copy it from the pdf):
> 
> \definebar[ClozedBar][underbar][continue=yes,empty=yes]
> 
> 
> -
>  Hans Hagen | PRAGMA ADE
>  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>   tel: 038 477 53 69 | www.pragma-ade.nl | 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
> ___

Dear Hans,

thanks a lot for your solution!

I have added "color=black” to \definebar to prevent the bar’s color from 
changing at a line break, which happens otherwise:

\definebar[ClozedBar][underbar][continue=yes]
%\definebar[ClozedBar][underbar][continue=yes, color=black]
\unexpanded\def\Clozed#1{\ClozedBar{\zwj\quad#1\quad\zwj}}
\starttext
\Clozed{\color[red]{CLOZE 1}} text text text text text text text text text text 
text
\Clozed{\color[red]{CLOZE 2 CLOZE 2}}
\stoptext

Now the extra space is hardcoded by \quad. I guess it’s not so easy then to 
make the underbar’s width a factor times the input text width? Or, 
alternatively, an explicitly given width?

Cheers,
Florian


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
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] Creating cloze texts

2016-09-02 Thread Florian Leupold
Dear list,

I would like to create cloze texts for my students with ConTeXt.

Ideally, I would have a command \cloze[]{} with the following 
functionality:

1) \cloze{} would insert an underlined gap in the text with a width 
of (say) 1.3 times the width of solution and puts the solution on top of it 
with centered alignment. I will then color the text read if the mode is 
‘teacher’ and in white if not.
2) \cloze[]{} would do the same, but with a fixed width of the 
underline. The solution should then be flush left, maybe with a horizontal 
space of \quad.
3) The underline should allow for line breaks and hyphenation, but not such 
that only empty space is broken into the next line of left in the previous (see 
MNWE).

In this way, the student’s and teacher’s versions of the script will look 
exactly the same, except for the visible solution in the teacher’s version.

The macro \underbar does a good job in terms of line breaks and hyphenation. 
But it is "too smart" in the sense that it does not underline horizontal 
spaces. The MNWE below showcases problems with my naive attempts to achieve 
underlining:
- CLOZE 1 does not have any extra space.
- CLOZE 2 does not underline the horizontal spaces.
- CLOZE 3 does not show the underline, supposedly because the first text 
elements in it are white.
- CLOZE 4 shows that introducing fake characters is not a good idea anyways 
because the cloze is broken without any “real” solution in the first line.
- CLOZE 5 shows the same for trailing space.

MNWE:
\starttext
\input ward
\underbar{\color[red]{CLOZE 1}}
\input ward
\underbar{\quad\color[red]{CLOZE 2}\quad}
\input ward
\underbar{\color[white]{x}\quad\color[red]{CLOZE 3}\quad\color[white]{x}}
\input ward
\underbar{\color[green]{x}\quad\color[red]{CLOZE 4}\quad\color[white]{x}}
\input ward
space \underbar{\color[red]{CLOZE 5}\qquad\color[white]{x}} space
\input ward
\stoptext

I would greatly appreciate help with this problem.

Thanks so much in advance!
Florian



signature.asc
Description: Message signed with OpenPGP using GPGMail
___
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] Figure-text alignment and wrapping text more tightly

2016-09-01 Thread Florian Leupold
Dear list,

I am interested in placing a figure on the right-hand side of the page and wrap 
text around it, see MWE below. This works mostly nicely. But I have got three 
questions:

1) Is it possible to top-align the figure with the first line of the paragraph 
to its left?

2) Is there a way to reduce the vertical gap between the first and second 
figures?

3) The keyword “low” for \placefigure seems to have an effect. But I don’t know 
why and could not find a reference to that in contextref.pdf. Is this the 
correct way to wrap text “more tightly” below the figure (compare second and 
third figures).

Thanks a lot for your input.

Best regards,
Florian


MWE:

\setupexternalfigures[order={pdf,png,jpg}, location={local,global,default}]
\starttext
\useexternalfigure[figure][mill]
\placefigure[right, none]{}{\externalfigure[figure]}
\input ward
\placefigure[right, none]{}{\externalfigure[figure]}
\input ward
\input ward
\input ward
\placefigure[right, low, none]{}{\externalfigure[figure]}
\input ward
\input ward
\input ward
\stoptext



signature.asc
Description: Message signed with OpenPGP using GPGMail
___
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
___