[NTG-context] Re: imposition: getting to the last page of a booklet
Hans Hagen schrieb am 06.03.2024 um 21:38: On 3/6/2024 7:50 PM, Wolfgang Schuster wrote: The semicolon is a undocumented extension (I noticed it in the definition of \page[quadruple]) of \numexpr in Luametatex for the modulus operator. One of these days I have to write the pending section in th elow level manual and also explain this: \starttext \ifnum 10 = 11 wrong \else okay \fi \ifnum 10 != 11 okay \else wrong \fi \ifnum 10 !> 11 okay \else wrong \fi \ifnum 10 !< 11 wrong \else okay \fi \ifnum 10 ≤ 11 okay \else wrong \fi \ifnum 10 ≥ 11 wrong \else okay \fi \ifnum 10 ≰ 11 okay \else wrong \fi \ifnum 10 ≱ 11 wrong \else okay \fi \ifnum "F0 ∈ "F0 okay \else wrong \fi \ifnum "F0 ∉ "F0 wrong \else okay \fi \stoptext These new features are mentioned in the Luametatex manual but not the additions to \numexpr (I checked and : is mentioned but ; is missing). \starttext \startlines \number\numexpr 5 + 2 \relax \number\numexpr 5 - 2 \relax \number\numexpr 5 * 2 \relax \number\numexpr 5 / 2 \relax \number\numexpr 5 : 2 \relax % new! \number\numexpr 5 ; 2 \relax % new! \stoplines \stoptext Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___
[NTG-context] Re: imposition: getting to the last page of a booklet
On 3/6/2024 7:50 PM, Wolfgang Schuster wrote: The semicolon is a undocumented extension (I noticed it in the definition of \page[quadruple]) of \numexpr in Luametatex for the modulus operator. One of these days I have to write the pending section in th elow level manual and also explain this: \starttext \ifnum 10 = 11 wrong \else okay \fi \ifnum 10 != 11 okay \else wrong \fi \ifnum 10 !> 11 okay \else wrong \fi \ifnum 10 !< 11 wrong \else okay \fi \ifnum 10 ≤ 11 okay \else wrong \fi \ifnum 10 ≥ 11 wrong \else okay \fi \ifnum 10 ≰ 11 okay \else wrong \fi \ifnum 10 ≱ 11 wrong \else okay \fi \ifnum "F0 ∈ "F0 okay \else wrong \fi \ifnum "F0 ∉ "F0 wrong \else okay \fi \stoptext Hans - 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 / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___
[NTG-context] Re: missing metadata in LMTX
Pablo Rodriguez via ntg-context schrieb am 06.03.2024 um 20:11: [...] \startxmlsetupsxml:meta %\aftergrouped{\setupinteraction% \setupmetadata [author={\xmlconcat{#1}{/h2[contains(@class,'author')]}{, }}] %} \stopxmlsetups Use \expanded. \startxmlsetups xml:meta \expanded{\setupmetadata[author={\xmlconcat{#1}{/h2[contains(@class,'author')]}{, }}]} \stopxmlsetups Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___
[NTG-context] Re: missing metadata in LMTX
Pablo Rodriguez via ntg-context schrieb am 06.03.2024 um 20:11: On 3/6/24 17:35, Wolfgang Schuster wrote: Pablo Rodriguez via ntg-context schrieb am 06.03.2024 um 16:52: [...] I wonder whether this requires a minimal sample to be fixed. Yes, a minimal example would help because \setupmetadata works in your previous example. Many thanks for your reply, Wolfgang. Now I have the minimal sample: [...] \startxmlsetups xml:meta %\aftergrouped{\setupinteraction% \setupmetadata [author={\xmlconcat{#1}{/h2[contains(@class,'author')]}{, }}] %} \stopxmlsetups Use \expanded. \startxmlsetups xml:meta \expanded{\setupmetadata[author={\xmlconcat{#1}{/h2[contains(@class,'author')]}{, }}]} \stopxmlsetups Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___
[NTG-context] Re: imposition: getting to the last page of a booklet
On 3/6/24 19:50, Wolfgang Schuster wrote: >> [...] >> Could you write the first line in plain language? > > Look at the second example of the Lua code in the example below for each > command (the first example is your version), the third example is just a > condensed version of example 2. Many thanks for your extended explanation, Wolfgang. Now it is clearer to me (although I need some time to learn from it). Many thanks for your help, Pablo ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___
[NTG-context] Re: missing metadata in LMTX
On 3/6/24 17:35, Wolfgang Schuster wrote: > Pablo Rodriguez via ntg-context schrieb am 06.03.2024 um 16:52: >> [...] >> I wonder whether this requires a minimal sample to be fixed. > > Yes, a minimal example would help because \setupmetadata works in your > previous example. Many thanks for your reply, Wolfgang. Now I have the minimal sample: \startbuffer[demo] author text \stopbuffer \starttext \startxmlsetups xml:initialize \xmlsetsetup{#1}{doc}{xml:*} \xmlsetsetup{\xmldocument} {(div|section)[@id='header']} {xml:meta} \xmlsetsetup{\xmldocument} {(h2|p)[contains(@class,'author')]} {xml:title:author} \stopxmlsetups \xmlregistersetup{xml:initialize} \startxmlsetups xml:doc \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:text \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:meta %\aftergrouped{\setupinteraction% \setupmetadata [author={\xmlconcat{#1}{/h2[contains(@class,'author')]}{, }}] %} \stopxmlsetups \startxmlsetups xml:title:author \xmlflush{#1} \stopxmlsetups \setupinteraction[state=start] \xmlprocessbuffer{main}{demo}{} \stoptext With \setupmetadata it breaks compilation. I know it is not the most elegant code, but in my real environment xml:title:author outputs text. Many thanks for your help, Pablo ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___
[NTG-context] Re: imposition: getting to the last page of a booklet
Pablo Rodriguez via ntg-context schrieb am 04.03.2024 um 20:00: On 2/28/24 19:28, Wolfgang Schuster wrote: [...] \def\beforequadruplenumber#1% {\ifcase\numexpr#1+1;4\relax \number\numexpr#1+4\relax \else \number\numexpr#1+3-#1;4\relax \fi} Sorry for not having answered before, Wolfgang. I’m afraid I don’t get how \ifcase is deployed with as conditional (being \ifcase used to give numbers for weekdays or months). The \ifcase command is the TeX version of a switch statement from other programming languages. The first case in \ifcase checks against zero which is shorter than writing "\ifnum ... = 0". The semicolon is also mysterious to me, I don’t know what it does there in plain language. The semicolon is a undocumented extension (I noticed it in the definition of \page[quadruple]) of \numexpr in Luametatex for the modulus operator. Sorry, I know it has to be simple, but the syntax is too cryptic for me. Could you write the first line in plain language? Look at the second example of the Lua code in the example below for each command (the first example is your version), the third example is just a condensed version of example 2. Sorry for asking that. I’m afraid this would be the only way I could get what \ifcase is doing there. As was mentioned above I used it as a check when the remainder was 0. begin example \startluacode --~ interfaces.implement { --~ name = "beforequadruplenumber", --~ arguments = "integer", --~ actions = function(n) --~ if n % 4 == 0 then --~ context(n + 3) --~ elseif n % 4 == 1 then --~ context(n + 2) --~ elseif n % 4 == 2 then --~ context(n + 1) --~ elseif n % 4 == 3 then --~ context(n + 4) --~ end --~ end --~ } --~ interfaces.implement { --~ name = "beforequadruplenumber", --~ arguments = "integer", --~ actions = function(n) --~ if (n + 1) % 4 == 0 then --~ context(n + 4) --~ else --~ context(n + 3 - n % 4) --~ end --~ end --~ } interfaces.implement { name = "beforequadruplenumber", arguments = "integer", actions = function(n) context(n + (((n + 1) % 4 == 0) and 4 or (3 - n % 4))) end } --~ interfaces.implement { --~ name = "afterquadruplenumber", --~ arguments = "integer", --~ actions = function(n) --~ if n % 4 == 0 then --~ context(n + 1) --~ elseif n % 4 == 1 then --~ context(n + 4) --~ elseif n % 4 == 2 then --~ context(n + 3) --~ elseif n % 4 == 3 then --~ context(n + 2) --~ end --~ end --~ } --~ interfaces.implement { --~ name = "afterquadruplenumber", --~ arguments = "integer", --~ actions = function(n) --~ if n % 4 == 0 then --~ context(n + 1) --~ else --~ context(n + 5 - n % 4) --~ end --~ end --~ } interfaces.implement { name = "afterquadruplenumber", arguments = "integer", actions = function(n) context(n + ((n % 4 == 0) and 1 or (5 - n % 4))) end } \stopluacode \unprotect \def\beforequadruplenumber#1{\clf_beforequadruplenumber\numexpr#1\relax} \def\afterquadruplenumber #1{\clf_afterquadruplenumber \numexpr#1\relax} \protect \starttext \dorecurse{20}{\recurselevel\space = \beforequadruplenumber{\recurselevel}\par}\page \dorecurse{20}{\recurselevel\space = \afterquadruplenumber {\recurselevel}\par} \stoptext end example Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___
[NTG-context] Re: missing metadata in LMTX
Pablo Rodriguez via ntg-context schrieb am 06.03.2024 um 16:52: On 3/6/24 15:54, Hans Hagen wrote: [...] \setupmetadata [title=FooBar] that's for those who go global Many thanks for the new command, Hans. I‘m afraid this new command breaks my compilation. The error message isn’t very helpful for me (see below). I wonder whether this requires a minimal sample to be fixed. Yes, a minimal example would help because \setupmetadata works in your previous example. Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___
[NTG-context] Re: missing metadata in LMTX
On 3/6/24 15:54, Hans Hagen wrote: > [...] >> \setupmetadata >>[title=FooBar] > > that's for those who go global Many thanks for the new command, Hans. I‘m afraid this new command breaks my compilation. The error message isn’t very helpful for me (see below). I wonder whether this requires a minimal sample to be fixed. Many thanks for your help, Pablo tex error > tex error on line 0 in file : Argument of \D9>:title has an extra } \par } \prerolltostring #1->\beginlocalcontrol \setbox \b_syst_boxes \hbox {\expand \everypreroll #1} \normalexpanded {\setbox \b_syst_boxes \emptybox \endlocalcontrol \boxtostring \b_syst_boxes } \scrn_identity_get #1->\setidentityvariable {#1}{\prerolltostring {\interactionparameter {#1}} } [[special cmd: end local call]] I've run across a '}' that doesn't seem to match anything. For example, '\def\a#1{...}' and '\a}' would produce this error. The '\par' that I've just inserted will cause me to report a runaway argument that might be the root of the problem. mtx-context | fatal error: return code: 1 > exit status: 256 ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___
[NTG-context] Re: missing metadata in LMTX
On 3/6/2024 11:18 AM, Marco Patzer wrote: On Tue, 5 Mar 2024 23:14:04 +0100 Wolfgang Schuster wrote: Here is the official solution: \startxmlsetups xml:meta \setupmetadata [author={\xmltext{#1}{/author}}, title={\xmltext{#1}{/title}}] \stopxmlsetups So now we have: \setupinteraction [title=FooBar] \setupdocument [metadata:title=FooBar] that just sets defaults for \setupinteraction so that they inherit from document \setupmetadata [title=FooBar] that's for those who go global Are any of those deprecated or the preferred way? I'm starting to get confused. even if we would use \setupmetadata we'd still have \setupinteraction because we remain compatible Hans - 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 / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___
[NTG-context] How can I do this?
Dear List, I need a tip how to do this: In the command \definepapersize[Mybook] the height should be not 24 cm, but a little bit longer. My Problem is, as you can see on the PDF, that there are troubles with the Gray Background. The Gray Background should begin with : Mitunter. . I think it should be the topoffset, and the bottomoffset, but how many .\bodyfontsize should I try? Many thanks Uschi \mainlanguage[de] \definepapersize[MyBook][width=19cm,height=24cm] \setuppapersize[MyBook][MyBook] % Prints on paper the size of MyBook %\setuppapersize[MyBook][A4] %Would print MyBook-size pages on A4 paper \setupbodyfont[Times New Roman,12.55pt] \definemargindata [MyInMargin][inright] \definemarginframed[MyInMargin][topframe=on,bottomframe=on,rulethickness=1pt,width=1.90cm] \defineenumeration [theorem] [ text=Theorem, title=yes, width=fit, distance=0.2em, alternative=serried, ] \definetextbackground[GrayBackground][ location=paragraph, background=color, backgroundcolor=lightgray, leftoffset=.8\bodyfontsize, rightoffset=.8\bodyfontsize, topoffset=.5\bodyfontsize, bottomoffset=.5\bodyfontsize, frame=off,] \margintext{\blackrule[color=black, height=0.10ex, width=1cm]\\} \blackrule[color=black, height=0.10ex, width=13.50cm] \starttext \margintext {1.1.1} {\bf Beispiel 3.2.17 (Vertauschung von All- und Existenzquantor).} \par {\it Sei M die Menge aller Männer und F die Menge aller Frauen. Die Aus-\par sage h(m, f) sei ”m ist verliebt in f“. Unter diesen Voraussetzungen machen Sie sich die Bedeutung der beiden Aussagen klar.} \par \startitemize[n,packed,broad] \item \m{\forall m ∈ M : ∃f ∈ F : h(m, f)} \item ∃f ∈ F : ∀m ∈ M : h(m, f). \stopitemize \startGrayBackground \tf Mitunter ist es aus der Formulierung nur schwer zu erkennen, dass ein \m ∃\forall∀ oder ein \m \forall∀\m∃ versteckt ist. Dann ist es besonders wichtig, die Formulierung sehr lange zu prüfen und eventuell auch formalisiert noch einmal aufzuschreiben.” \blank \setupnarrower [left=0.80cm, right=0.80cm] \startnarrower[left, right] \definehspace[oneem][0.5em] Der\hspace[oneem] Wert\hspace[oneem] von\hspace[oneem] \m{y = f(x)} ist unabhängig von der Wahl\\ von \m{x\doubleprime} ist gleichbedeutend mit \m{∃y : ∀x : f(x) = y} \\ (Beutelspacher [10, S.54])\par \blank \stopnarrower \stopGrayBackground \blank \blackrule[color=black, height=0.10ex, width=13.50cm] \setupinteraction [state=start, color=blue] \reference[Regel:1]{3.1}\par {\bf Aufgabe 3.2.18} Formulieren Sie gemäß der Regel (\goto{3.1}[Regel:1]) äquivalent \startitemize[n,packed,broad] \item \m{\forall n \in \naturalnumbers\mtp{:} n^2 > n \implies n > 1},\item \m{\forall n \in \naturalnumbers\mtp{:} 3\divides n \implies 4 \divides n},\item \m{\forall n \in \naturalnumbers\mtp{:} n^3 \mtext{ ungerade }\nospace \implies n \mtext{ ungerade}}. \stopitemize \blackrule[color=black, height=0.10ex, width=13.50cm]\par {\bf Aufgabe 3.2.19} Bilden Sie die Verneinung der folgenden Aussagen: \startitemize[n,packed,broad] \item Alle Rosen sind verwelkt oder teuer. \item Alle rosen sind entweder verwelkt oder teuer. \stopitemize \par \usecolors[svg] \setupinteraction [state=start, contrastcolor=cornflowerblue] \reference[Abschnitt:1]{3.2.1.1} {\it Hinweis: Beachten Sie die Konvention aus Abschnitt \goto {3.2.1.1}[Abschnitt:1]die For-\par mulierung \quotation {entweder ... oder} entspricht dem ausschließenden Oder\par und die Formulierung \quotation{oder} dem (mathematischen) einschließenden\par Oder.\par \blackrule[color=black, height=0.10ex, width=13.50cm] Bruce.pdf Description: Bruce.pdf ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___
[NTG-context] Re: missing metadata in LMTX
Am 06.03.24 um 11:18 schrieb Marco Patzer: On Tue, 5 Mar 2024 23:14:04 +0100 Wolfgang Schuster wrote: Here is the official solution: \startxmlsetups xml:meta \setupmetadata [author={\xmltext{#1}{/author}}, title={\xmltext{#1}{/title}}] \stopxmlsetups So now we have: \setupinteraction [title=FooBar] \setupdocument [metadata:title=FooBar] \setupmetadata [title=FooBar] Are any of those deprecated or the preferred way? I'm starting to get confused. There’s also \settaggedmetadata; I actually didn’t know \setupmetadata. Both are missing in the wiki yet. Also https://wiki.contextgarden.net/Command/setupinteraction doesn’t talk about metadata. Sigh. AFAIK the metadata from \setupinteraction is used for everything, as long as you don’t overwrite it elsewhere. Hraban ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___
[NTG-context] Re: missing metadata in LMTX
On Tue, 5 Mar 2024 23:14:04 +0100 Wolfgang Schuster wrote: > Here is the official solution: > > \startxmlsetups xml:meta >\setupmetadata > [author={\xmltext{#1}{/author}}, > title={\xmltext{#1}{/title}}] > \stopxmlsetups So now we have: \setupinteraction [title=FooBar] \setupdocument [metadata:title=FooBar] \setupmetadata [title=FooBar] Are any of those deprecated or the preferred way? I'm starting to get confused. Marco ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___