ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Xml - Lua - context
@ 2022-03-28 13:40 Thomas A. Schmitz via ntg-context
  2022-03-28 16:21 ` Adam Reviczky via ntg-context
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas A. Schmitz via ntg-context @ 2022-03-28 13:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Thomas A. Schmitz

And here comes question 2, a very basic one: on A4 landscape pages, I want to place two images next to each other (like the spread pages of a book). What would be the preferred way of the really competent users to do this, again keeping in mind that I want to loop over page numbers in a pdf file and thus am coding in Lua. So far, I have tried or thought about:

1. Embedded xtable

This is what I’m using now, an xtable of two columns for every A4 page. It works, but I wonder if it’s a good method.

2. combinations

This appeared to be the most natural approach (because it’s what combinations are for), but I ran into expansion problems, added a few “function () end” in my code, but couldn’t make it compile. Combinations, combined with framed and externalfigure, are difficult to write in Lua - or am I too stupid to find the winning combination (sorry for the puns).

3. columns

Again, this would seen like a natural approach, having every A4 page set up as two columns, but maybe that’s overkill? 

I’d be curious to know what you think!

All best

Thomas
___________________________________________________________________________________
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] 10+ messages in thread

* Re: Xml - Lua - context
  2022-03-28 13:40 Xml - Lua - context Thomas A. Schmitz via ntg-context
@ 2022-03-28 16:21 ` Adam Reviczky via ntg-context
  2022-03-28 17:06   ` Thomas A. Schmitz via ntg-context
  0 siblings, 1 reply; 10+ messages in thread
From: Adam Reviczky via ntg-context @ 2022-03-28 16:21 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Adam Reviczky, Thomas A. Schmitz


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

Hi Thomas,

Not sure whether it helps or not, but in regards to combinations and Lua I
have had some challenges as well, but Hans' and Wolfgangs' solution with
externalfigures works fine for me now:

https://mailman.ntg.nl/pipermail/ntg-context/2021/103822.html
https://mailman.ntg.nl/pipermail/ntg-context/2021/103827.html

Adam

On Mon, Mar 28, 2022 at 2:42 PM Thomas A. Schmitz via ntg-context <
ntg-context@ntg.nl> wrote:

> And here comes question 2, a very basic one: on A4 landscape pages, I want
> to place two images next to each other (like the spread pages of a book).
> What would be the preferred way of the really competent users to do this,
> again keeping in mind that I want to loop over page numbers in a pdf file
> and thus am coding in Lua. So far, I have tried or thought about:
>
> 1. Embedded xtable
>
> This is what I’m using now, an xtable of two columns for every A4 page. It
> works, but I wonder if it’s a good method.
>
> 2. combinations
>
> This appeared to be the most natural approach (because it’s what
> combinations are for), but I ran into expansion problems, added a few
> “function () end” in my code, but couldn’t make it compile. Combinations,
> combined with framed and externalfigure, are difficult to write in Lua - or
> am I too stupid to find the winning combination (sorry for the puns).
>
> 3. columns
>
> Again, this would seen like a natural approach, having every A4 page set
> up as two columns, but maybe that’s overkill?
>
> I’d be curious to know what you think!
>
> All best
>
> Thomas
>
> ___________________________________________________________________________________
> 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: 3141 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] 10+ messages in thread

* Re: Xml - Lua - context
  2022-03-28 16:21 ` Adam Reviczky via ntg-context
@ 2022-03-28 17:06   ` Thomas A. Schmitz via ntg-context
  2022-03-28 19:08     ` \figuresymbol with underlying hyperlink? Steffen Wolfrum via ntg-context
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas A. Schmitz via ntg-context @ 2022-03-28 17:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Thomas A. Schmitz



> On 28. Mar 2022, at 18:21, Adam Reviczky via ntg-context <ntg-context@ntg.nl> wrote:
> 
> Hi Thomas,
> 
> Not sure whether it helps or not, but in regards to combinations and Lua I have had some challenges as well, but Hans' and Wolfgangs' solution with externalfigures works fine for me now:
> 
> https://mailman.ntg.nl/pipermail/ntg-context/2021/103822.html
> https://mailman.ntg.nl/pipermail/ntg-context/2021/103827.html
> 
> Adam


Thank you, that’s already very useful! I should have looked if there is a “delayed” alternative for externalfigure as well, but I also take Hans’s warning to heart that all of this is non-trivial. 

Thank you, best wishes

Thomas
___________________________________________________________________________________
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] 10+ messages in thread

* \figuresymbol with underlying hyperlink?
  2022-03-28 17:06   ` Thomas A. Schmitz via ntg-context
@ 2022-03-28 19:08     ` Steffen Wolfrum via ntg-context
  2022-03-29  7:56       ` Henning Hraban Ramm via ntg-context
  0 siblings, 1 reply; 10+ messages in thread
From: Steffen Wolfrum via ntg-context @ 2022-03-28 19:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Steffen Wolfrum

Hi,

is it possible to combine figuresymbol with some kind of \useurl?

The goal is to have an inline symbol that provides a http url link.

Best wishes, 
Steffen
___________________________________________________________________________________
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] 10+ messages in thread

* Re: \figuresymbol with underlying hyperlink?
  2022-03-28 19:08     ` \figuresymbol with underlying hyperlink? Steffen Wolfrum via ntg-context
@ 2022-03-29  7:56       ` Henning Hraban Ramm via ntg-context
  2022-03-29  8:48         ` Steffen Wolfrum via ntg-context
  0 siblings, 1 reply; 10+ messages in thread
From: Henning Hraban Ramm via ntg-context @ 2022-03-29  7:56 UTC (permalink / raw)
  To: ntg-context; +Cc: Henning Hraban Ramm

Am 28.03.22 um 21:08 schrieb Steffen Wolfrum via ntg-context:
> Hi,
> 
> is it possible to combine figuresymbol with some kind of \useurl?
> 
> The goal is to have an inline symbol that provides a http url link.

AFAIK there’s nothing ready-made in that regard, but just define your 
own macro.

E.g. I use:

\define[1]\Web{\goto{\hyphenatedurl{#1}}[url(https://#1)]\autoinsertnextspace}
\define[1]\Email{\goto{\hyphenatedurl{#1}}[url(mailto:#1)]\autoinsertnextspace}
\define[1]\WebQR{\inouter[scope=local]{\barcode[alternative=qr code, 
text={#1}, width=10mm]}\Web{#1}}
\define[1]\WebArrow{\symbol[wingdings 
3][barb1right]~{\em\hyphenatedurl{#1}}}

So I guess you’d like something like:

\define[1]\Link{\goto{\symbol[wingdings 
3][barb1right]}[url(https://#1)]\autoinsertnextspace}

Hraban

___________________________________________________________________________________
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] 10+ messages in thread

* Re: \figuresymbol with underlying hyperlink?
  2022-03-29  7:56       ` Henning Hraban Ramm via ntg-context
@ 2022-03-29  8:48         ` Steffen Wolfrum via ntg-context
  2022-03-29 10:59           ` Henning Hraban Ramm via ntg-context
  2022-03-30 14:45           ` Hans Hagen via ntg-context
  0 siblings, 2 replies; 10+ messages in thread
From: Steffen Wolfrum via ntg-context @ 2022-03-29  8:48 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Steffen Wolfrum

Unfortunately I have to use it at a heading:
and this gives an error:


\starttext

\define[1]\Link{\goto{\symbol[wingdings 3][barb1right]}[url(https://#1)]\autoinsertnextspace}

\chapter{a\Link}

text

\stoptext


Steffen



> Am 29.03.2022 um 09:56 schrieb Henning Hraban Ramm via ntg-context <ntg-context@ntg.nl>:
> 
> Am 28.03.22 um 21:08 schrieb Steffen Wolfrum via ntg-context:
>> Hi,
>> is it possible to combine figuresymbol with some kind of \useurl?
>> The goal is to have an inline symbol that provides a http url link.
> 
> AFAIK there’s nothing ready-made in that regard, but just define your own macro.
> 
> E.g. I use:
> 
> \define[1]\Web{\goto{\hyphenatedurl{#1}}[url(https://#1)]\autoinsertnextspace}
> \define[1]\Email{\goto{\hyphenatedurl{#1}}[url(mailto:#1)]\autoinsertnextspace}
> \define[1]\WebQR{\inouter[scope=local]{\barcode[alternative=qr code, text={#1}, width=10mm]}\Web{#1}}
> \define[1]\WebArrow{\symbol[wingdings 3][barb1right]~{\em\hyphenatedurl{#1}}}
> 
> So I guess you’d like something like:
> 
> \define[1]\Link{\goto{\symbol[wingdings 3][barb1right]}[url(https://#1)]\autoinsertnextspace}
> 
> Hraban
> 
> ___________________________________________________________________________________
> 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
___________________________________________________________________________________

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

* Re: \figuresymbol with underlying hyperlink?
  2022-03-29  8:48         ` Steffen Wolfrum via ntg-context
@ 2022-03-29 10:59           ` Henning Hraban Ramm via ntg-context
  2022-03-29 15:41             ` Steffen Wolfrum via ntg-context
  2022-03-30 14:45           ` Hans Hagen via ntg-context
  1 sibling, 1 reply; 10+ messages in thread
From: Henning Hraban Ramm via ntg-context @ 2022-03-29 10:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Henning Hraban Ramm

Did you try to use it with a parameter?
\Link{wiki.contextgarden.net}

Hraban

Am 29.03.22 um 10:48 schrieb Steffen Wolfrum:
> Unfortunately I have to use it at a heading:
> and this gives an error:
> 
> 
> \starttext
> 
> \define[1]\Link{\goto{\symbol[wingdings 3][barb1right]}[url(https://#1)]\autoinsertnextspace}
> 
> \chapter{a\Link}
> 
> text
> 
> \stoptext
> 
> 
> Steffen
> 
> 
> 
>> Am 29.03.2022 um 09:56 schrieb Henning Hraban Ramm via ntg-context <ntg-context@ntg.nl>:
>>
>> Am 28.03.22 um 21:08 schrieb Steffen Wolfrum via ntg-context:
>>> Hi,
>>> is it possible to combine figuresymbol with some kind of \useurl?
>>> The goal is to have an inline symbol that provides a http url link.
>>
>> AFAIK there’s nothing ready-made in that regard, but just define your own macro.
>>
>> E.g. I use:
>>
>> \define[1]\Web{\goto{\hyphenatedurl{#1}}[url(https://#1)]\autoinsertnextspace}
>> \define[1]\Email{\goto{\hyphenatedurl{#1}}[url(mailto:#1)]\autoinsertnextspace}
>> \define[1]\WebQR{\inouter[scope=local]{\barcode[alternative=qr code, text={#1}, width=10mm]}\Web{#1}}
>> \define[1]\WebArrow{\symbol[wingdings 3][barb1right]~{\em\hyphenatedurl{#1}}}
>>
>> So I guess you’d like something like:
>>
>> \define[1]\Link{\goto{\symbol[wingdings 3][barb1right]}[url(https://#1)]\autoinsertnextspace}
>>
>> Hraban
>>
>> ___________________________________________________________________________________
>> 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
___________________________________________________________________________________

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

* Re: \figuresymbol with underlying hyperlink?
  2022-03-29 10:59           ` Henning Hraban Ramm via ntg-context
@ 2022-03-29 15:41             ` Steffen Wolfrum via ntg-context
  0 siblings, 0 replies; 10+ messages in thread
From: Steffen Wolfrum via ntg-context @ 2022-03-29 15:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Steffen Wolfrum

No, I didn’t…. Thank you very much, now it works ;o)

Steffen


> Am 29.03.2022 um 12:59 schrieb Henning Hraban Ramm via ntg-context <ntg-context@ntg.nl>:
> 
> Did you try to use it with a parameter?
> \Link{wiki.contextgarden.net}
> 
> Hraban
> 
> Am 29.03.22 um 10:48 schrieb Steffen Wolfrum:
>> Unfortunately I have to use it at a heading:
>> and this gives an error:
>> \starttext
>> \define[1]\Link{\goto{\symbol[wingdings 3][barb1right]}[url(https://#1)]\autoinsertnextspace}
>> \chapter{a\Link}
>> text
>> \stoptext
>> Steffen
>>> Am 29.03.2022 um 09:56 schrieb Henning Hraban Ramm via ntg-context <ntg-context@ntg.nl>:
>>> 
>>> Am 28.03.22 um 21:08 schrieb Steffen Wolfrum via ntg-context:
>>>> Hi,
>>>> is it possible to combine figuresymbol with some kind of \useurl?
>>>> The goal is to have an inline symbol that provides a http url link.
>>> 
>>> AFAIK there’s nothing ready-made in that regard, but just define your own macro.
>>> 
>>> E.g. I use:
>>> 
>>> \define[1]\Web{\goto{\hyphenatedurl{#1}}[url(https://#1)]\autoinsertnextspace}
>>> \define[1]\Email{\goto{\hyphenatedurl{#1}}[url(mailto:#1)]\autoinsertnextspace}
>>> \define[1]\WebQR{\inouter[scope=local]{\barcode[alternative=qr code, text={#1}, width=10mm]}\Web{#1}}
>>> \define[1]\WebArrow{\symbol[wingdings 3][barb1right]~{\em\hyphenatedurl{#1}}}
>>> 
>>> So I guess you’d like something like:
>>> 
>>> \define[1]\Link{\goto{\symbol[wingdings 3][barb1right]}[url(https://#1)]\autoinsertnextspace}
>>> 
>>> Hraban
>>> 
>>> ___________________________________________________________________________________
>>> 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
> ___________________________________________________________________________________

___________________________________________________________________________________
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] 10+ messages in thread

* Re: \figuresymbol with underlying hyperlink?
  2022-03-29  8:48         ` Steffen Wolfrum via ntg-context
  2022-03-29 10:59           ` Henning Hraban Ramm via ntg-context
@ 2022-03-30 14:45           ` Hans Hagen via ntg-context
  1 sibling, 0 replies; 10+ messages in thread
From: Hans Hagen via ntg-context @ 2022-03-30 14:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Hans Hagen, Steffen Wolfrum

On 3/29/2022 10:48 AM, Steffen Wolfrum via ntg-context wrote:
> Unfortunately I have to use it at a heading:
> and this gives an error:
> 
> 
> \starttext
> 
> \define[1]\Link{\goto{\symbol[wingdings 3][barb1right]}[url(https://#1)]\autoinsertnextspace}
> 
> \chapter{a\Link}
> 
> text
> 
> \stoptext
shouldn't you pass some argument to your \Link macro?



-----------------------------------------------------------------
                                           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] 10+ messages in thread

* Xml - lua - context
@ 2022-03-28 13:32 Thomas A. Schmitz via ntg-context
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas A. Schmitz via ntg-context @ 2022-03-28 13:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Thomas A. Schmitz

Dear all,

For a small project, I have two questions (without MWE…) on processing xml via Lua and context. I’ll write two messages so eager volunteers can reply more easily!

So question one: given an xml structure like this

  <section>
    <sectiontitle>
      Introduction: the <em>Iliad</em>
    </sectiontitle>
    <sectionlist>
      Introduction: the <em>Iliad</em>
    </sectionlist>
  </section>

I want to typeset the section title with some added information. Since I’m processing in a loop, I thought this would be easier in Lua, so I have something like this:

local i = 0

local sessions = { “April 2”, “April 9”, “April 16” } -- etc.

function xml.functions.section(t)
	i = i + 1
	local raw_section = xml.text (t, "/sectiontitle")
	local section_head = i .. ". session, " .. sessions [i] .. ": " .. raw_section
	context.startsection { title=section_head }
	lxml.flush (t)
	context.stopsection ()
end

However, this means that the section_head is serialized as a string and not processed according to the xml setups, so I have “the <em>Iliad</em>” in my typeset document. How can this be avoided? How can I have the <em>...</em> processed instead of serialized in the section title? 

Thanks for looking at my code!

Thomas
___________________________________________________________________________________
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] 10+ messages in thread

end of thread, other threads:[~2022-03-30 14:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-28 13:40 Xml - Lua - context Thomas A. Schmitz via ntg-context
2022-03-28 16:21 ` Adam Reviczky via ntg-context
2022-03-28 17:06   ` Thomas A. Schmitz via ntg-context
2022-03-28 19:08     ` \figuresymbol with underlying hyperlink? Steffen Wolfrum via ntg-context
2022-03-29  7:56       ` Henning Hraban Ramm via ntg-context
2022-03-29  8:48         ` Steffen Wolfrum via ntg-context
2022-03-29 10:59           ` Henning Hraban Ramm via ntg-context
2022-03-29 15:41             ` Steffen Wolfrum via ntg-context
2022-03-30 14:45           ` Hans Hagen via ntg-context
  -- strict thread matches above, loose matches on Subject: below --
2022-03-28 13:32 Xml - lua - context Thomas A. Schmitz via ntg-context

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).