Re: [NTG-context] \definemeasure / \dimexpr

2022-11-13 Thread Henning Hraban Ramm via ntg-context

Yes! Finally! Thank you, Wolfgang!

Am 13.11.22 um 13:17 schrieb Wolfgang Schuster via ntg-context:

Henning Hraban Ramm via ntg-context schrieb am 13.11.2022 um 11:37:

\definemeasure[SpineWidth][2mm + (0.135mm * \noffigurepages/2)]


You can try
     \expanded{\definemeasure[SpineWidth][...]}


Yes, that works. I could have thought of that myself.


\definemeasure[SpineWidth][2mm + (0.09mm * 1.5 * 90)]
doesn’t work:


You can use integers to multiply or divide a length, a float is only 
allowed

before a length. e.g. 1.5\scratchdimen or 1.5\dimexpr ...\relax

In your case you have to use

     \definemeasure[SpineWidth][2mm + (0.09mm * 3 * 90 / 2)]

or

     \definemeasure[SpineWidth][2mm + (0.09mm * 135)]


Ah, the float/int usage was the missing link.

Now I can document my calculated cover for wiki, CG journal, my book, DTK...

Hraban
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Page break with placement of a figure at the bottom of the page

2022-11-13 Thread Pablo Rodriguez via ntg-context
On 11/13/22 11:32, Fabrice Couvreur via ntg-context wrote:
> Hi Pablo,
> Indeed but I posted these two files in a previous post.

Hi Fabrice,

the output from your ie_3.tex is too big for the list, so
https://pdf.ousia.tk/ie_3.pdf contains it.

I see no problem there, but I think that the output from
https://mailman.ntg.nl/pipermail/ntg-context/2022/107191.html may come
from a different source.

BTW, I couldn’t find "ie_3.tex" in
https://mailman.ntg.nl/pipermail/ntg-context/2022.txt.gz (which seems to
be generated with messages previous to current date).

If you sent the files before, it is fine to include a link to the
relevant message in the list (such as the first link included in this
message).

BTW, it might be worth considering a GitHub or GitLab repository for not
minimal samples. There files may be stored (and the whole repository
might be deleted when not needed).

I hope it helps,

Pablo
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \definemeasure / \dimexpr

2022-11-13 Thread Wolfgang Schuster via ntg-context

Henning Hraban Ramm via ntg-context schrieb am 13.11.2022 um 11:37:
One problem left with dimensions that I can’t reproduce in a minimal 
example:


I want to calculate the spine width of the cover from the number of 
content pages:


\useexternalfigure[CONTENT][book.pdf]
\getfiguredimensions[CONTENT]
\definemeasure[SpineWidth][2mm + (0.135mm * \noffigurepages/2)]


You can try

    \expanded{\definemeasure[SpineWidth][...]}

That works so far, if I output \measure{SpineWidth} it shows the right 
size (~42pt).


But if I use this measure in
\setlayer[width=\measure{SpineWidth}]{...}
it’s very small.
I guess \noffigurepages is 1 at that point (from another image) and 
I’d need to expand it first.


Am I right that the expansion happens only at the “execution” of 
\measure? How would I do that? \expanded\noffigurepages doesn’t work.



Another issue:

0.135mm is the paper thickness of 90 g/m² (= 0.09mm per sheet) with 
1.5 bulk. But

\definemeasure[SpineWidth][2mm + (0.09mm * 1.5 * 90)]
doesn’t work:


You can use integers to multiply or divide a length, a float is only allowed
before a length. e.g. 1.5\scratchdimen or 1.5\dimexpr ...\relax

In your case you have to use

    \definemeasure[SpineWidth][2mm + (0.09mm * 3 * 90 / 2)]

or

    \definemeasure[SpineWidth][2mm + (0.09mm * 135)]


Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \definemeasure / \dimexpr

2022-11-13 Thread Henning Hraban Ramm via ntg-context
One problem left with dimensions that I can’t reproduce in a minimal 
example:


I want to calculate the spine width of the cover from the number of 
content pages:


\useexternalfigure[CONTENT][book.pdf]
\getfiguredimensions[CONTENT]
\definemeasure[SpineWidth][2mm + (0.135mm * \noffigurepages/2)]

That works so far, if I output \measure{SpineWidth} it shows the right 
size (~42pt).


But if I use this measure in
\setlayer[width=\measure{SpineWidth}]{...}
it’s very small.
I guess \noffigurepages is 1 at that point (from another image) and I’d 
need to expand it first.


Am I right that the expansion happens only at the “execution” of 
\measure? How would I do that? \expanded\noffigurepages doesn’t work.



Another issue:

0.135mm is the paper thickness of 90 g/m² (= 0.09mm per sheet) with 1.5 
bulk. But

\definemeasure[SpineWidth][2mm + (0.09mm * 1.5 * 90)]
doesn’t work:

"""
Missing ) inserted for expression



.
 \commalistcommand
2mm + (0.09mm * 1.
5 * \noffigurepages /2)
 \measured
#1->\dimexpr \ifcsname \??measure #1\endcsname \lastnamedcs
\else \zeropoint \fi \relax
...
"""

I also tried 1.5sp since sp should be 1, but it didn’t help.


Hraban
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Page break with placement of a figure at the bottom of the page

2022-11-13 Thread Fabrice Couvreur via ntg-context
Hi Pablo,
Indeed but I posted these two files in a previous post.
Fabrice

Le dim. 13 nov. 2022 à 09:24, Pablo Rodriguez via ntg-context <
ntg-context@ntg.nl> a écrit :

> On 11/12/22 15:09, Fabrice Couvreur via ntg-context wrote:
> > Hi Pablo and Bruce,
> > Please try to figure out what is not working.
> > I'm sorry but I forgot in my previous post files.
>
> Hi Fabrice,
>
> I get empty files when compiling premiere-modules.tex and
> premiere-macros.tex and error message with tikz-style.tex.
>
> I guess a fourth file invoking the other three files may be missing here.
>
> Pablo
>
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
>
> ___
>
\environment[template.mkiv]

\definemargindata[marginfigure][inright]

\useMPlibrary[dum]

\setupmargindata [marginfigure][command=\vbox,align=middle,stack=yes]

\setvariables
[headertext]
[title={Interrogation écrite},
 number={3},
 day={8},
 month={11},
 year={2022},
 location={Premières},
 time={55 minutes}]

\showgrid
\startcomponent[ie_3]
  \startex
Nous considérons la suite \u définie sur \N par son premier terme \m{u_0=-2} et la relation de récurrence
\startformula
  \text{pour tout} \; n \in \N, \; u_{n+1}=\sqrt{3+u_n}.
\stopformula
Les termes de cette suite sont itérés par la fonction \m{f\,\colon x \longmapsto \sqrt{x+3}} qui est définie sur \intervalfo{-3}{+\infty}, et dont la représentation graphique \m{C_f} est donnée ci-après.
\startlinecorrection[blank]
  \startmidaligned
\externalfigure[spirale.pdf]
  \stopmidaligned
\stoplinecorrection
Représenter graphiquement les cinq premiers termes de cette suite.
  \stopex
  \startex
La suite \u est arithmétique de raison \m{r=-7} et de premier terme \m{u_0=5}.
\startitemize[n]
  \startitem
Calculer \m{u_{16}}.
  \stopitem
  \startitem
Calculer la somme
\startformula
  \sum_{k=0}^{k=16}u_k=u_0+u_1+u_2+\cdots + u_{15}+u_{16}.
\stopformula
  \stopitem
\stopitemize
  \stopex
  \startex
  On considère la suite arithmétique \u, définie sur \N, telle que \m{u_{12}=52} et \m{u_{23}=107}.
  \startitemize[n]
\startitem
  Calculer la raison \m{r} de la suite.
\stopitem
\startitem
  Déterminer le terme initial \m{u_0}.
\stopitem
\startitem
  Déterminer \m{u_n} en fonction de \m{n}, puis calculer \m{u_{55}}.
\stopitem
\startitem
  Donner le sens de variation de \u.
\stopitem
\startitem
  Conjecturer la limite éventuelle de la suite \u.
\stopitem
  \stopitemize
  \stopex
  \startex
   On s'intéresse à des pyramides construites avec des allumettes comme ci-après .

  En poursuivant ainsi, on obtient des pyramides à autant d'étages que l'on souhaite à condition, bien sûr, d'avoir assez d'allumettes.
\startlinecorrection[blank]
  \startmidaligned
\startcombination[3*1]
  {\externalfigure[pyramide_1.pdf]}{\tfx 1 étage}
  {\externalfigure[pyramide_2.pdf]}{\tfx 2 étages}
  {\externalfigure[pyramide_3.pdf]}{\tfx 3 étages}
\stopcombination
  \stopmidaligned
\stoplinecorrection
Le 1\high{\tfxx er} étage est formé de 3 allumettes, le 2\high{\tfxx e} de 7 allumettes, et le 3\high{\tfxx e} de 11 allumettes.
\startitemize[n]
  \startitem
   De combien d'allumettes est formé le 4\high{\tfxx e} étage ? Le 5\high{\tfxx e} ?
  \stopitem
  \startitem
Pour tout entier naturel \m{n\geqslant 1}, on note \m{u_n} le nombre d'allumettes du \m{n-\text{ième}} étage. Ainsi, nous avons \m{u_1=3}.

Justifier que la suite \u est arithmétique en précisant sa raison.
  \stopitem
  \startitem
Déterminer le calcul explicite de \m{u_n} en fonction de \m{n}, \m{u_1} et \m{r}.
  \stopitem
  \placerecipe{}{ \externalfigure[pyramide.png][scale=850]}
  \startitem
Déterminer le nombre d'allumettes du 10\high{\tfxx e} étage.
  \stopitem
  \startitem
Combien d'allumettes au total ont été nécessaires pour réaliser la construction jusqu'au 10\high{\tfxx e} étage ?
  \stopitem
   
  \startitem
On considère la fonction {\tt \darkred pyramide()} ci-contre programmée en langage Python.

À quoi correspond le nombre renvoyé par {\tt \darkred pyramide(3)} ?
  \stopitem
\stopitemize
  \stopex
\stopcomponent

% Local Variables:
% mode: context
% TeX-command-default: "lmtx"

Re: [NTG-context] Page break with placement of a figure at the bottom of the page

2022-11-13 Thread Pablo Rodriguez via ntg-context
On 11/12/22 15:09, Fabrice Couvreur via ntg-context wrote:
> Hi Pablo and Bruce,
> Please try to figure out what is not working.
> I'm sorry but I forgot in my previous post files.

Hi Fabrice,

I get empty files when compiling premiere-modules.tex and
premiere-macros.tex and error message with tikz-style.tex.

I guess a fourth file invoking the other three files may be missing here.

Pablo

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___