ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Using \applytosplitstringwordspaced and allies
@ 2020-08-08  8:14 Jairo A. del Rio
  2020-08-08 10:00 ` Wolfgang Schuster
  0 siblings, 1 reply; 6+ messages in thread
From: Jairo A. del Rio @ 2020-08-08  8:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 356 bytes --]

Hi, list! :D
I've found \applytosplitstringwordspaced and many other commands reading on
the mailing list and TeX StackExchange. An issue with those is: the
following does not work:

\applytosplitstringwordspaced\somemacro{\input knuth}

It only works with explicit TeX "words". How to circumvent this
inconvenience? Thanks in advance.

Regards,

Jairo :)

[-- Attachment #1.2: Type: text/html, Size: 479 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Using \applytosplitstringwordspaced and allies
  2020-08-08  8:14 Using \applytosplitstringwordspaced and allies Jairo A. del Rio
@ 2020-08-08 10:00 ` Wolfgang Schuster
  2020-08-08 13:34   ` Hans Hagen
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2020-08-08 10:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Jairo A. del Rio schrieb am 08.08.2020 um 10:14:
> Hi, list! :D
> I've found \applytosplitstringwordspaced and many other commands reading 
> on the mailing list and TeX StackExchange. An issue with those is: the 
> following does not work:
> 
> \applytosplitstringwordspaced\somemacro{\input knuth}
> 
> It only works with explicit TeX "words". How to circumvent this 
> inconvenience? Thanks in advance.

You can't feed knuth.tex to the command because it contains multiple 
paragraphs but even when your file contains only a single paragraph it 
isn't perfect because the linebreak after the last line contains as 
extra word (seen in the first paragraph below).

To use \input as argument for \applytosplitstringwordspaced you need a 
few \expandafter's to ensure the file is read before the argument is 
passed to Lua. A easier method is to move everything to Lua where you 
read the file and put it in a string, afterward you can use the CLD 
mechanism to call \applytosplitstringwordspaced from Lua.

\unexpanded\def\somemacro#1{[#1]}

\starttext

\expandafter\applytosplitstringwordspaced\expandafter\somemacro\expandafter{\input 
weisman }

\blank

\startluacode

-- local ward = io.loaddata(resolvers.findfile("ward.tex"))
local ward = string.fullstrip(io.loaddata(resolvers.findfile("ward.tex")))

context.applytosplitstringwordspaced ( "\\somemacro", ward )

\stopluacode

\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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Using \applytosplitstringwordspaced and allies
  2020-08-08 10:00 ` Wolfgang Schuster
@ 2020-08-08 13:34   ` Hans Hagen
  2020-08-08 14:31     ` Jairo A. del Rio
  0 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2020-08-08 13:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Wolfgang Schuster

On 8/8/2020 12:00 PM, Wolfgang Schuster wrote:
> Jairo A. del Rio schrieb am 08.08.2020 um 10:14:
>> Hi, list! :D
>> I've found \applytosplitstringwordspaced and many other commands 
>> reading on the mailing list and TeX StackExchange. An issue with those 
>> is: the following does not work:
>>
>> \applytosplitstringwordspaced\somemacro{\input knuth}
>>
>> It only works with explicit TeX "words". How to circumvent this 
>> inconvenience? Thanks in advance.
> 
> You can't feed knuth.tex to the command because it contains multiple 
> paragraphs but even when your file contains only a single paragraph it 
> isn't perfect because the linebreak after the last line contains as 
> extra word (seen in the first paragraph below).
> 
> To use \input as argument for \applytosplitstringwordspaced you need a 
> few \expandafter's to ensure the file is read before the argument is 
> passed to Lua. A easier method is to move everything to Lua where you 
> read the file and put it in a string, afterward you can use the CLD 
> mechanism to call \applytosplitstringwordspaced from Lua.
> 
> \unexpanded\def\somemacro#1{[#1]}
> 
> \starttext
> 
> \expandafter\applytosplitstringwordspaced\expandafter\somemacro\expandafter{\input 
> weisman }
> 
> \blank
> 
> \startluacode
> 
> -- local ward = io.loaddata(resolvers.findfile("ward.tex"))
> local ward = string.fullstrip(io.loaddata(resolvers.findfile("ward.tex")))
> 
> context.applytosplitstringwordspaced ( "\\somemacro", ward )
> 
> \stopluacode
> 
> \stoptext
just a remark: knuth.tex is tricky becauss it also has \TeX and \ and 
such, so one needs to escape it, as in:

context.applytosplitstringwordspaced (
   "\\somemacro",
   context.escape(ward)
)


-----------------------------------------------------------------
                                           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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Using \applytosplitstringwordspaced and allies
  2020-08-08 13:34   ` Hans Hagen
@ 2020-08-08 14:31     ` Jairo A. del Rio
  2020-08-09  6:52       ` Wolfgang Schuster
  0 siblings, 1 reply; 6+ messages in thread
From: Jairo A. del Rio @ 2020-08-08 14:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Hans Hagen


[-- Attachment #1.1: Type: text/plain, Size: 3231 bytes --]

Thank you very much! Something else happens:

\applytosplitstringwordspaced\somemacro{Content and {\tt typewriter} more
content}

either ignores braced groups or ignores macros AND prints braces "{" and
"}" as if it were in verbatim mode depending on the content being on the
document or loaded via Lua, even when context.escape is used. How to keep
{\it braced content}? Thank you in advance.

Jairo :)

El sáb., 8 de ago. de 2020 a la(s) 08:34, Hans Hagen (j.hagen@xs4all.nl)
escribió:

> On 8/8/2020 12:00 PM, Wolfgang Schuster wrote:
> > Jairo A. del Rio schrieb am 08.08.2020 um 10:14:
> >> Hi, list! :D
> >> I've found \applytosplitstringwordspaced and many other commands
> >> reading on the mailing list and TeX StackExchange. An issue with those
> >> is: the following does not work:
> >>
> >> \applytosplitstringwordspaced\somemacro{\input knuth}
> >>
> >> It only works with explicit TeX "words". How to circumvent this
> >> inconvenience? Thanks in advance.
> >
> > You can't feed knuth.tex to the command because it contains multiple
> > paragraphs but even when your file contains only a single paragraph it
> > isn't perfect because the linebreak after the last line contains as
> > extra word (seen in the first paragraph below).
> >
> > To use \input as argument for \applytosplitstringwordspaced you need a
> > few \expandafter's to ensure the file is read before the argument is
> > passed to Lua. A easier method is to move everything to Lua where you
> > read the file and put it in a string, afterward you can use the CLD
> > mechanism to call \applytosplitstringwordspaced from Lua.
> >
> > \unexpanded\def\somemacro#1{[#1]}
> >
> > \starttext
> >
> >
> \expandafter\applytosplitstringwordspaced\expandafter\somemacro\expandafter{\input
>
> > weisman }
> >
> > \blank
> >
> > \startluacode
> >
> > -- local ward = io.loaddata(resolvers.findfile("ward.tex"))
> > local ward =
> string.fullstrip(io.loaddata(resolvers.findfile("ward.tex")))
> >
> > context.applytosplitstringwordspaced ( "\\somemacro", ward )
> >
> > \stopluacode
> >
> > \stoptext
> just a remark: knuth.tex is tricky becauss it also has \TeX and \ and
> such, so one needs to escape it, as in:
>
> context.applytosplitstringwordspaced (
>    "\\somemacro",
>    context.escape(ward)
> )
>
>
> -----------------------------------------------------------------
>                                            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
>
> ___________________________________________________________________________________
>

[-- Attachment #1.2: Type: text/html, Size: 4561 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Using \applytosplitstringwordspaced and allies
  2020-08-08 14:31     ` Jairo A. del Rio
@ 2020-08-09  6:52       ` Wolfgang Schuster
  2020-08-09  7:13         ` Jairo A. del Rio
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2020-08-09  6:52 UTC (permalink / raw)
  To: Jairo A. del Rio; +Cc: mailing list for ConTeXt users

Jairo A. del Rio schrieb am 08.08.2020 um 16:31:
> Thank you very much! Something else happens:
>
> \applytosplitstringwordspaced\somemacro{Content and {\tt typewriter} 
> more content}
>
> either ignores braced groups or ignores macros AND prints braces "{" 
> and "}" as if it were in verbatim mode depending on the content being 
> on the document or loaded via Lua, even when context.escape is used. 
> How to keep {\it braced content}? Thank you in advance.

Are you trying to typeset interlinear text?

http://mirrors.ctan.org/macros/generic/expex/expex-doc.pdf

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Using \applytosplitstringwordspaced and allies
  2020-08-09  6:52       ` Wolfgang Schuster
@ 2020-08-09  7:13         ` Jairo A. del Rio
  0 siblings, 0 replies; 6+ messages in thread
From: Jairo A. del Rio @ 2020-08-09  7:13 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 938 bytes --]

I know about expex. I was trying something more akin to this:

https://tex.stackexchange.com/questions/552518/how-do-i-typeset-interleaved-streams-of-text-with-independent-line-breaks

Jairo :)

El dom., 9 de ago. de 2020 a la(s) 01:52, Wolfgang Schuster (
wolfgang.schuster.lists@gmail.com) escribió:

> Jairo A. del Rio schrieb am 08.08.2020 um 16:31:
> > Thank you very much! Something else happens:
> >
> > \applytosplitstringwordspaced\somemacro{Content and {\tt typewriter}
> > more content}
> >
> > either ignores braced groups or ignores macros AND prints braces "{"
> > and "}" as if it were in verbatim mode depending on the content being
> > on the document or loaded via Lua, even when context.escape is used.
> > How to keep {\it braced content}? Thank you in advance.
>
> Are you trying to typeset interlinear text?
>
> http://mirrors.ctan.org/macros/generic/expex/expex-doc.pdf
>
> Wolfgang
>
>

[-- Attachment #1.2: Type: text/html, Size: 1582 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-08-09  7:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-08  8:14 Using \applytosplitstringwordspaced and allies Jairo A. del Rio
2020-08-08 10:00 ` Wolfgang Schuster
2020-08-08 13:34   ` Hans Hagen
2020-08-08 14:31     ` Jairo A. del Rio
2020-08-09  6:52       ` Wolfgang Schuster
2020-08-09  7:13         ` Jairo A. del Rio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).