Re: [NTG-context] Struggling with startuseMPgraphic and string argument!
Hi ConTeXt users, That's indeed magic and it works! Hans, thanks for your prompt answer! But I would like to take this a step further, by introducing a macro within the start/stopuseMPgraphic structure like so: \startuseMPgraphic{name}{s::lbl} def mymacro (text lb) = pair a ; a := (3cm,3cm) ;label.top("String: " & str lb,a) ; enddef ; mymacro(\MPvariable{lbl}) ; \stopuseMPgraphic and this works too, but what if I introduce another text argument like: \startuseMPgraphic{name}{s::lbl,s::label} def mymacro (text lb,lbx) = pair a ; a := (3cm,3cm) ;label.top("String: " & str lb & ", " & str lbx,a) ; enddef ; mymacro(\MPvariable{lbl},\MPvariable{label}) ; \stopuseMPgraphic However this doesn't work! It gives the following error: ! Missing argument to mymacro. Isn't that weird? But perhaps it has to do with me not understanding argument passing properly within METAPOST macros! Can someone please explain why this 2 argument example doesn't work? (But maybe this isn't the proper list to ask questions like these. If so, I'm sorry for bothering you!) Regards, Gerard On 16-09-2020 16:32, Geert Verhaag wrote: Hi, I'm trying to pass a string argument value to an MPgraphic but it doesn't seem to work: Tried the following: \startuseMPgraphic{name}{lbl} pair a ; a := (3cm,3cm) ;label.top("\MPvariable{lbl}",a) ; \stopuseMPgraphic \starttext \useMPgraphic{name}{lbl=1} \stoptext The above works as expected! But the following doesn't: \startuseMPgraphic{name}{lbl} pair a ; a := (3cm,3cm) ;label.top("\MPvariable{lbl}",a) ; \stopuseMPgraphic \starttext \useMPgraphic{name}{lbl=abc} \stoptext It yields: 1 \startuseMPgraphic{name}{lbl} 2 pair a ; a := (3cm,3cm) ;label.top("\MPvariable{lbl}",a) ; 3 \stopuseMPgraphic 4 5 %\startuseMPgraphic{name}fill fullcircle scaled 200pt withcolor .625yellow ;\stopuseMPgraphic 6 7 \starttext 8 Example: 9 >> \useMPgraphic{name}{lbl=abc} 10 \stoptext 11 a \m_meta_current_variable a-a bc ... \hbox {\scratchdimen \m_meta_current_variable sp}\ifzeropt \wd \b_meta_v... \secondoftwoarguments #1#2b-#2 \9>>1 #1,2-\meta_prepare_instance_variable {#1} \syst_helpers_do_process_comm... \syst_helpers_do_process_comma_list ...rgument #1, ]\relax \global \advance \... ... l.9 \useMPgraphic{name}{lbl=abc} So it seems that only numbers can be passed not character strings! Why is that? Is there a possibility to achieve this functionality? Regards, Gerard ___ 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 ___ -- Sender:G.C.H.M. Verhaag St. Jorisstraat 29 5954 AN Beesel NETHERLANDS Tel.: +31-(0)619502702, E-mail: verhaagg...@ziggo.nl Ik vertrouw erop dat de persoonlijke gegevens, te vinden in deze mail, uitsluitend voor correspondentie met ondergetekende worden gebruikt en beslist niet voor reclamedoeleinden of welke andere wijze dan ook. Het opnemen van deze gegevens, in welk soort van opslagsysteem dan ook, evenals het doorgeven ervan aan derden, zie ik als een schending van mijn privacy. ___ 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] \setbreakpoints[compound] with numbers
On 9/17/2020 4:54 PM, Denis Maier wrote: Hi, In the texts I'm currently typesetting, I occassionaly have to deal with ISBNs. So, e.g. 978-3-123456-78-9 \setbreakpoints[compound] does not enable automatic linebreaks after or before the hyphens. Is there a way to deal with this? Perhaps something similar like \hyphenatedurl{} or an extended version of \setbreakpoints. (I currently use zero-width spaces, so I got rid of ISBNs in the margins, but a more automatic solution would be great.) \unexpanded\def\isbnnumber#1% {\cldcontext{string.gsub("#1","-","\\automaticdiscretionary")}} \hsize 1mm \isbnnumber{123-456} - 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] 2020 Meeting recordings?
So do I. Marcus Vinicius On Thu, Sep 17, 2020, 13:07 Denis Maier wrote: > Hi, > > unfortunately, I wasn't able to come to this years meeting. Have the > presentations and demos been recorded? I would very much like to watch > some of those. > > Best, > Denis > > ___ > 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 > > ___ > ___ 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] 2020 Meeting recordings?
Hi, unfortunately, I wasn't able to come to this years meeting. Have the presentations and demos been recorded? I would very much like to watch some of those. Best, Denis ___ 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] \setbreakpoints[compound] with numbers
Hi, In the texts I'm currently typesetting, I occassionaly have to deal with ISBNs. So, e.g. 978-3-123456-78-9 \setbreakpoints[compound] does not enable automatic linebreaks after or before the hyphens. Is there a way to deal with this? Perhaps something similar like \hyphenatedurl{} or an extended version of \setbreakpoints. (I currently use zero-width spaces, so I got rid of ISBNs in the margins, but a more automatic solution would be great.) Best, Denis ___ 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] columns yet again
On 9/13/2020 10:54 AM, Thomas A. Schmitz wrote: Hi all, I hope everybody made it back home safely after the meeting. It was great listening in, even if I couldn't be there in person, unfortunately! Today's question is an old one, but I'm confused. What I need: two columns, of unequal width, the left column has line numbering; two column layout starts in the middle of pages. What I tried so far: \setuplayout[width=16cm] \starttext \enabledirectives[tabulate.linenumbers] \showframe \starttabulate[|p(7cm)|A{verytolerant}i2p(\dimexpr9cm-2em\relax)|] \NC \startlinenumbering \dorecurse{10}{\input ward \par} \stoplinenumbering \NC \dorecurse{3}{\input tufte \par} \NC \NR \stoptabulate \disabledirectives[tabulate.linenumbers] \starttabulate[|p(7cm)|A{verytolerant}i2p(\dimexpr9cm-2em\relax)|] \NC \startlinenumbering \dorecurse{10}{\input ward \par} \stoplinenumbering \NC \dorecurse{3}{\input tufte \par} \NC \NR \stoptabulate \stoptext I'm not sure why there is no key / value interface ... probably because I made it one for someone as fast hack. 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 / 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] lmtx update
El 17/9/20 a las 12:50, Eduardo Bohoyo escribió: El 17/9/20 a las 12:35, Wolfgang Schuster escribió: Eduardo Bohoyo schrieb am 17.09.2020 um 10:14: Thank you for this illustrative example, Wolfgang. So, what \forgetparagraphfreezing does is to reverse the order that lmtx currently imposes by default, right? In other words, \forgetparagraphfreezing, recovers the default behaviour of MkIV. So, I suspect that this will not change; if we want to apply Lettrine to a paragraph, from now on we must wrap it up with \forgetparagraphfreezing and \setparagraphfreezing. Please correct me if I'm wrong. LMTX removes some restrictions for settings which are applies to paragraphs, e.g. the following example works now without problems with LMTX while LuaTeX needs the \dontleavehmode at the begin of the paragraph \starttext \placefigure[left]{none}{\framed[width=2cm,height=2cm]{}} %\dontleavehmode {\bf Tufte: }\input tufte \stoptext To avoid side effects from these changes LMTX freezes a few settings at the begin of the paragraph. In some cases commands or settings have to be adapted to these changes and the lettrine module is one of them. The changes itself to the commands have to be made in the modules etc. itself and not in the documents, below is a minimal example how the lettrine module has to be changed to get indentation for the initial back. \starttext \hsize 10cm \noindent \parshape 3 1cm 9cm 1.5cm 8.5cm 0cm 10cm \input weisman \blank \begingroup \noindent \parshape 3 1cm 9cm 1.5cm 8.5cm 0cm 10cm \updateparagraphshapes \endgroup \input weisman \stoptext BTW: ConTeXt already provides a command to place initials as part of the core but it lacks a few features of the lettrine module. Wolfgang OK, I get it. Oh, and yes, I knew about the \setupinitial command. Thanks for pointing that out. Sorry, Wolfgag, I forgot to sign my reply. Eduardo ___ 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] lmtx update
El 17/9/20 a las 12:35, Wolfgang Schuster escribió: Eduardo Bohoyo schrieb am 17.09.2020 um 10:14: Thank you for this illustrative example, Wolfgang. So, what \forgetparagraphfreezing does is to reverse the order that lmtx currently imposes by default, right? In other words, \forgetparagraphfreezing, recovers the default behaviour of MkIV. So, I suspect that this will not change; if we want to apply Lettrine to a paragraph, from now on we must wrap it up with \forgetparagraphfreezing and \setparagraphfreezing. Please correct me if I'm wrong. LMTX removes some restrictions for settings which are applies to paragraphs, e.g. the following example works now without problems with LMTX while LuaTeX needs the \dontleavehmode at the begin of the paragraph \starttext \placefigure[left]{none}{\framed[width=2cm,height=2cm]{}} %\dontleavehmode {\bf Tufte: }\input tufte \stoptext To avoid side effects from these changes LMTX freezes a few settings at the begin of the paragraph. In some cases commands or settings have to be adapted to these changes and the lettrine module is one of them. The changes itself to the commands have to be made in the modules etc. itself and not in the documents, below is a minimal example how the lettrine module has to be changed to get indentation for the initial back. \starttext \hsize 10cm \noindent \parshape 3 1cm 9cm 1.5cm 8.5cm 0cm 10cm \input weisman \blank \begingroup \noindent \parshape 3 1cm 9cm 1.5cm 8.5cm 0cm 10cm \updateparagraphshapes \endgroup \input weisman \stoptext BTW: ConTeXt already provides a command to place initials as part of the core but it lacks a few features of the lettrine module. Wolfgang OK, I get it. Oh, and yes, I knew about the \setupinitial command. Thanks for pointing that out. ___ 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] lmtx update
Eduardo Bohoyo schrieb am 17.09.2020 um 10:14: Thank you for this illustrative example, Wolfgang. So, what \forgetparagraphfreezing does is to reverse the order that lmtx currently imposes by default, right? In other words, \forgetparagraphfreezing, recovers the default behaviour of MkIV. So, I suspect that this will not change; if we want to apply Lettrine to a paragraph, from now on we must wrap it up with \forgetparagraphfreezing and \setparagraphfreezing. Please correct me if I'm wrong. LMTX removes some restrictions for settings which are applies to paragraphs, e.g. the following example works now without problems with LMTX while LuaTeX needs the \dontleavehmode at the begin of the paragraph \starttext \placefigure[left]{none}{\framed[width=2cm,height=2cm]{}} %\dontleavehmode {\bf Tufte: }\input tufte \stoptext To avoid side effects from these changes LMTX freezes a few settings at the begin of the paragraph. In some cases commands or settings have to be adapted to these changes and the lettrine module is one of them. The changes itself to the commands have to be made in the modules etc. itself and not in the documents, below is a minimal example how the lettrine module has to be changed to get indentation for the initial back. \starttext \hsize 10cm \noindent \parshape 3 1cm 9cm 1.5cm 8.5cm 0cm 10cm \input weisman \blank \begingroup \noindent \parshape 3 1cm 9cm 1.5cm 8.5cm 0cm 10cm \updateparagraphshapes \endgroup \input weisman \stoptext BTW: ConTeXt already provides a command to place initials as part of the core but it lacks a few features of the lettrine module. 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] lmtx update
El 17/9/20 a las 1:07, ebohoyod escribió: El 16/9/20 a las 18:23, Wolfgang Schuster escribió: ebohoyod schrieb am 16.09.2020 um 17:52: Hi, It seems that the Lettrine module is one of those affected: https://tex.stackexchange.com/questions/562534/does-context-fail-in-the-lmtx-environment-with-the-lettrine-module?noredirect=1#comment1418902_562534 But, honestly, first, I don't know what means "/Of course it might have other side effects once in lmtx we everywhere expect freezing to be enabled./" I suppose that, in order not to be a nuisance (and not to digress into this real subject of interest), a short answer would be enough to put me on track to investigate it. On the other hand, I suppose the best practice, from what I have just read, would be not to use \forgetparagraphfreezing globaly, but \forgetparagraphfreezing and \setparagraphfreezing at the beginning and end of the first paragraph respectively of each chapter. Would this be the least harmful way? That is, wrapping it up to avoid this provisional failure of the Lettrine with LMTX module, but at the same time to avoid affecting that default freezing proposal in the rest of the document, right? By the way, and just out of curiosity, how does the recommended provisional command work? Would it be something like this in the preamble?: \definingparagraphs firstparagraph][n=1] \setupparagraphs [firstparagraph][1][align={hanging}] And then this arrangement in the \input files?: \startfirstparagraph \lettrine{B}{lah} blah, blah, blah... \stopfirstparagraph \blank [overlay] \strut I know it's a dirty, inelegant solution, but I can't think of a better one at the moment. Below is a minimal example which doesn't rely on the module, the problem is caused by the order of the \noindent and \parshape command. When a paragraph starts before the \parshape values are set the arguments are ignored because the values are already frozen at this moment, when you set the values before the paragraphs starts ConTeXt applies them. \starttext \hsize 10cm % lettrine module, \noindent before \parshape \noindent \parshape 3 1cm 9cm 1.5cm 8.5cm 0cm 10cm \input weisman \blank % working order, \parshape before \noindent \parshape 3 1cm 9cm 1.5cm 8.5cm 0cm 10cm \noindent \input weisman \stoptext Wolfgang Thank you for this illustrative example, Wolfgang. So, what \forgetparagraphfreezing does is to reverse the order that lmtx currently imposes by default, right? In other words, \forgetparagraphfreezing, recovers the default behaviour of MkIV. So, I suspect that this will not change; if we want to apply Lettrine to a paragraph, from now on we must wrap it up with \forgetparagraphfreezing and \setparagraphfreezing. Please correct me if I'm wrong. Eduardo. ___ 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] Struggling with startuseMPgraphic and string argument!
On 9/16/2020 4:32 PM, Geert Verhaag wrote: Hi, I'm trying to pass a string argument value to an MPgraphic but it doesn't seem to work: Tried the following: \startuseMPgraphic{name}{lbl} pair a ; a := (3cm,3cm) ;label.top("\MPvariable{lbl}",a) ; \stopuseMPgraphic \starttext \useMPgraphic{name}{lbl=1} \stoptext The above works as expected! But the following doesn't: \startuseMPgraphic{name}{lbl} pair a ; a := (3cm,3cm) ;label.top("\MPvariable{lbl}",a) ; \stopuseMPgraphic \starttext \useMPgraphic{name}{lbl=abc} \stoptext It yields: 1 \startuseMPgraphic{name}{lbl} 2 pair a ; a := (3cm,3cm) ;label.top("\MPvariable{lbl}",a) ; 3 \stopuseMPgraphic 4 5 %\startuseMPgraphic{name}fill fullcircle scaled 200pt withcolor .625yellow ;\stopuseMPgraphic 6 7 \starttext 8 Example: 9 >> \useMPgraphic{name}{lbl=abc} 10 \stoptext 11 a \m_meta_current_variable a-a bc ... \hbox {\scratchdimen \m_meta_current_variable sp}\ifzeropt \wd \b_meta_v... \secondoftwoarguments #1#2b-#2 \9>>1 #1,2-\meta_prepare_instance_variable {#1} \syst_helpers_do_process_comm... \syst_helpers_do_process_comma_list ...rgument #1, ]\relax \global \advance \... ... l.9 \useMPgraphic{name}{lbl=abc} So it seems that only numbers can be passed not character strings! Why is that? Is there a possibility to achieve this functionality? magic: \startuseMPgraphic{name}{s::lbl} pair a ; a := (3cm,3cm) ;label.top("\MPvariable{lbl}",a) ; \stopuseMPgraphic \starttext \useMPgraphic{name}{lbl=abc} \useMPgraphic{name}{lbl=def} \stoptext - 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___