* [NTG-context] Re: Experiments with \doloopoverlist
@ 2023-08-17 22:07 Andres Conrado Montoya
0 siblings, 0 replies; 3+ messages in thread
From: Andres Conrado Montoya @ 2023-08-17 22:07 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 1659 bytes --]
Thank you Hanks, seems to work well after some tweaking.
I had an issue, the patch you sent me gave an error when I ran 'context
--make'. The error said:
tex error > tex error on line 51 in file core-dat.mkxl: Parameters
must be numbered consecutively
[#1]#*[
<to be read again>
S
<line 3.51>
\permanent\tolerant\protected\def\setdataset[#1]#*[#S
#2]#*[#S#3]%
<empty file>
I've inserted the digit you should have used after the #.
I edited line 51 as:
\permanent\tolerant\protected\def\setdataset[#1]#*[#2]#*[#3]%
Instead of your original:
\permanent\tolerant\protected\def\setdataset[#1]#*[#S#2]#*[#S#3]%
And now context --make runs, and the example compiles correctly, however,
not really sure if what I did was the right thing to do.
Thank you so much for your help!
--
Andrés Conrado Montoya
Andi Kú
andresconrado@gmail.com
http://sesentaycuatro.com
http://messier87.com
http://chiquitico.org
----------------------------------------
Los fines no justifican los medios, porque la medida verdadera de nuestro
carácter está dada por los medios que estamos dispuestos a utilizar, no por
los fines que proclamamos.
----------------------------------------
“You develop an instant global consciousness, a people orientation, an
intense dissatisfaction with the state of the world, and a compulsion to do
something about it. From out there on the moon, international politics look
so petty. You want to grab a politician by the scruff of the neck and drag
him a quarter of a million miles out and say, ‘Look at that, you son of a
bitch.’” — Apollo 14 astronaut Edgar Mitchell
[-- Attachment #1.2: Type: text/html, Size: 2364 bytes --]
[-- Attachment #2: Type: text/plain, Size: 495 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* [NTG-context] Re: Experiments with \doloopoverlist
@ 2023-08-18 16:24 Andres Conrado Montoya
0 siblings, 0 replies; 3+ messages in thread
From: Andres Conrado Montoya @ 2023-08-18 16:24 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 1919 bytes --]
I was using an old LMTX copy, and that was the issue. Thanks to Hans for
pointing that out.
Now I'm trying to expand my solution a little more. Is there any way to
retrieve an element in a dataset by using the key? For example, given an
"authors" dataset, I would like to do something similar to:
%% Given this data structure ...
\setdataset[authors][
nombre={Andrés Conrado Montoya Acosta},
bio={This is a bio, it could be two or three paragraphs long},
email={loremipsum@email.edu.co},
cvlac={
https://scienti.minciencias.gov.co/cvlac/visualizador/generarCurriculoCv.do?cod_rh=0002125949
},
orcid={https://orcid.org/0009-0007-0765-4241},
gscholar={
https://scholar.google.com/citations?user=GpYTTU0AAAAJ&hl=es&authuser=1},
]
%% I want to do something like....
\startGetAuthor[nombre={Andrés Conrado Montoya Acosta}]
\datasetentry{bio}\par
email: \mailhref{\datasetentry{email}}
\stopGetAuthor
So, if my name is found in the dataset, get the data for that name. Is
something like that possible?
Thank you for your time.
--
Andrés Conrado Montoya
Andi Kú
andresconrado@gmail.com
http://sesentaycuatro.com
http://messier87.com
http://chiquitico.org
----------------------------------------
Los fines no justifican los medios, porque la medida verdadera de nuestro
carácter está dada por los medios que estamos dispuestos a utilizar, no por
los fines que proclamamos.
----------------------------------------
“You develop an instant global consciousness, a people orientation, an
intense dissatisfaction with the state of the world, and a compulsion to do
something about it. From out there on the moon, international politics look
so petty. You want to grab a politician by the scruff of the neck and drag
him a quarter of a million miles out and say, ‘Look at that, you son of a
bitch.’” — Apollo 14 astronaut Edgar Mitchell
[-- Attachment #1.2: Type: text/html, Size: 2896 bytes --]
[-- Attachment #2: Type: text/plain, Size: 495 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* [NTG-context] Re: Experiments with \doloopoverlist
2023-08-17 1:50 [NTG-context] " Andres Conrado Montoya
@ 2023-08-17 8:08 ` Hans Hagen via ntg-context
0 siblings, 0 replies; 3+ messages in thread
From: Hans Hagen via ntg-context @ 2023-08-17 8:08 UTC (permalink / raw)
To: ntg-context; +Cc: Hans Hagen
On 8/17/2023 3:50 AM, Andres Conrado Montoya wrote:
> Hello List.
>
> I've been trying to typeset a somewhat complex list of authors for several
> articles and a book.
> My proof of concept seems to work fine, however, I know I am doing weird
> things that I think could probably be done in a better way. I'm using
> datasets and a recursion, kind of hacky but I can't find a better way of
> handling it. Specifically I would like to know:
> 1. Is there a way of getting the length of a filled dataset? (how many
> entries it contains)
> 2. Is it OK to use \startuserdata \stopuserdata without its inlineuserdata?
> Is there an alternative that does not require inlineuserdata?
Weird is relative. Just use what you like most. One could for instance
use the publication mechanism but you need to set up a bit more (see
manual for example of usa as database).
Now datasets. It is not hard to add a size query so I added that. Your
data is missins commas so let's fix that first
\definedataset[autores]
\setdataset[autores]
[
nombre={Angie Natalia Farfán Acevedo},
cvlac={https://scienti.minciencias.gov.co/cvlac/visualizador/generarCurriculoCv.do?cod_rh=0002125949},
orcid={https://orcid.org/0009-0007-0765-4241},
gscholar={https://scholar.google.com/citations?user=GpYTTU0AAAAJ&hl=es&authuser=1},
]
\setdataset[autores]
[
nombre={Ivon Andrea Rodríguez Román},
cvlac={https://scienti.minciencias.gov.co/cvlac/visualizador/generarCurriculoCv.do?cod_rh=0000027033},
orcid={https://orcid.org/0009-0001-1183-6829},
gscholar={https://scholar.google.com/citations?user=iz8SQNcAAAAJ&hl=es},
]
\setdataset[autores]
[
nombre={Angie Caterin Garzón González},
cvlac={https://scienti.minciencias.gov.co/cvlac/visualizador/generarCurriculoCv.do?cod_rh=0002128501},
orcid={https://orcid.org/0009-0009-0990-6902},
gscholar={https://scholar.google.com/citations?view_op=list_works&hl=es&user=5WqcOeEAAAAJ},
]
\setdataset[autores]
[
nombre={Heidy Paola Veira Tenorio},
cvlac={https://scienti.minciencias.gov.co/cvlac/visualizador/generarCurriculoCv.do?cod_rh=0002127550},
orcid={https://orcid.org/0009-0008-4076-7317},
gscholar={https://scholar.google.es/citations?view_op=new_profile&hl=es&authuser=1},
]
\setdataset[autores]
[
nombre={Yerly Lorena Diaz Aldana},
cvlac={https://scienti.minciencias.gov.co/cvlac/visualizador/generarCurriculoCv.do?cod_rh=0002127754},
orcid={https://orcid.org/0009-0008-1720-4057},
gscholar={https://scholar.google.com/citations?hl=es&user=0obyCwkAAAAJ&view_op=list_works&gmla=AOV7GLPWRTK-xooHNe0iQ3uubfcSbG__GY_Guy35FdaqDJA3OfLLtp01-E1kzjxUhltlsfj494MaoQFkk9U9hCFYSipoR8aX0Vu2E6sV},
]
There is no need to use userdata as intermediate:
% \startsetups[userdata:idautor]
% \dontleavehmode
% \imghref
% {\externalfigure[cvlac.pdf][logo]}
% {\datasetvariable{autores}{\recurselevel}{vclac}}
% \quad
% \imghref
% {\externalfigure[orcid.pdf][logo]}
% {\datasetvariable{autores}{\recurselevel}{orcid}}
% \quad
% \imghref
% {\externalfigure[gscholar.pdf][logo]}
% {\datasetvariable{autores}{\recurselevel}{nombre}}
% \quad
% \datasetvariable{autores}{\recurselevel}{nombre}\par
% \stopsetups
Just loop over the set and call up the variables in the setup:
% \startdocument
% \dorecurse{\datasetsize{autores}}{
% \setups[userdata:idautor]
% }
% \stopdocument
However, i can provide a processor:
% \startsetups[userdata:idautor]
% \dontleavehmode
% \imghref
% {\externalfigure[cvlac.pdf][logo]}
% {\datasetvariable{autores}{\datasetindex}{vclac}}
% \quad
% \imghref
% {\externalfigure[orcid.pdf][logo]}
% {\datasetvariable{autores}{\datasetindex}{orcid}}
% \quad
% \imghref
% {\externalfigure[gscholar.pdf][logo]}
% {\datasetvariable{autores}{\datasetindex}{nombre}}
% \quad
% \datasetvariable{autores}{\datasetindex}{nombre}\par
% \stopsetups
As we know what dataset we process:
\startsetups[userdata:idautor]
\dontleavehmode
\imghref
{\externalfigure[cvlac.pdf][logo]}
{\datasetentry{vclac}}
\quad
\imghref
{\externalfigure[orcid.pdf][logo]}
{\datasetentry{orcid}}
\quad
\imghref
{\externalfigure[gscholar.pdf][logo]}
{\datasetentry{nombre}}
\quad
\datasetentry{nombre}
\par
\stopsetups
We then end up with:
\startdocument
\processdataset[autores][userdata:idautor]
\stopdocument
I'll mail you the patch. Copy it to the right place and remake the format.
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://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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-18 16:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-17 22:07 [NTG-context] Re: Experiments with \doloopoverlist Andres Conrado Montoya
-- strict thread matches above, loose matches on Subject: below --
2023-08-18 16:24 Andres Conrado Montoya
2023-08-17 1:50 [NTG-context] " Andres Conrado Montoya
2023-08-17 8:08 ` [NTG-context] " Hans Hagen 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).