On the use of btx datasets to manage images and plots
Dear all, since this is my first post on the mailing lists, let me make a small preamble: after years of LaTeX experience I decided in May to give ConTeXt a try. The journey has been extremely pleasant up to now, so I want to thank all the contributors to this project for making such a great piece of software. Now, let's dig into the topic: I'm a PhD student in High Energy Physics (HEP) and my typical work include producing lot of plots and then presenting them in various meetings, comparing my results with existing ones present in the literature. Tipically, many plots and figures are re-used in different meetings and they might end up in the final thesis. My current workflow is just copying in different directories these (mostly vector) images and copying the caption between different tex sources. This workflow clearly scales very bad, and I would like to exploit all the goodies of the ConTeXt dataset machinery. In the Bibliografies manual it is mentioned that one can use datasets to manage images as well [1]. My case however is (slightly) more complicated than the one showed in the manual. What I would like to have is four databases: - a bibliography dataset; - an "others' figure" dataset, with all the images I took from the references. This means that in some way in the caption I would like to cite the references included in the bibliography dataset; - a "own figures" dataset, with the plots I produced with external programs; - a "metafun figures" dataset, pointing at the metafun code corresponding to some diagram. In my idea, for each figure dataset the \placebtxrendering should plot the figure with the right label to refer to in the main text and the right caption. (Clearly for the metafun dataset it should not include the pdf of the diagrams but instead compile the metafun code). In this way, I could create a single ConTeXt project with different products for different presentations, posters and other documents. Do you think this workflow can be implemented in ConTeXt? If so, how? Is btx the right tool for the job? I hope I was clear, and sorry if I was not. Thanks in advance for the help. Cheers MR [1] https://www.pragma-ade.nl/general/manuals/mkiv-publications.pdf#%5B%7B%22num...
On 11/25/2024 6:02 PM, marco.riggirello.98@gmail.com wrote:
Dear all, since this is my first post on the mailing lists, let me make a small preamble: after years of LaTeX experience I decided in May to give ConTeXt a try. The journey has been extremely pleasant up to now, so I want to thank all the contributors to this project for making such a great piece of software.
Now, let's dig into the topic:
I'm a PhD student in High Energy Physics (HEP) and my typical work include producing lot of plots and then presenting them in various meetings, comparing my results with existing ones present in the literature.
Tipically, many plots and figures are re-used in different meetings and they might end up in the final thesis. My current workflow is just copying in different directories these (mostly vector) images and copying the caption between different tex sources.
This workflow clearly scales very bad, and I would like to exploit all the goodies of the ConTeXt dataset machinery.
In the Bibliografies manual it is mentioned that one can use datasets to manage images as well [1]. My case however is (slightly) more complicated than the one showed in the manual. What I would like to have is four databases: - a bibliography dataset; - an "others' figure" dataset, with all the images I took from the references. This means that in some way in the caption I would like to cite the references included in the bibliography dataset;
You can add an entry to your bib dataset, say image = {foo.pdf} and access that field \externalfigure[\btxflush{image}]
- a "own figures" dataset, with the plots I produced with external programs; - a "metafun figures" dataset, pointing at the metafun code corresponding to some diagram.
In my idea, for each figure dataset the \placebtxrendering should plot the figure with the right label to refer to in the main text and the right caption. (Clearly for the metafun dataset it should not include the pdf of the diagrams but instead compile the metafun code).
In this way, I could create a single ConTeXt project with different products for different presentations, posters and other documents.
Do you think this workflow can be implemented in ConTeXt? If so, how? Is btx the right tool for the job?
I hope I was clear, and sorry if I was not. Thanks in advance for the help.
There are many ways to do this and as you also need bibliographies it makes sense to use these. You can also use lua files instead of bib ones. Attached is an example of metapost (the sample file will be processed automatically when it changes). 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 -----------------------------------------------------------------
Dear Hans, sorry for thanking you only now, I have the time to play around your files only now. Your solution is very very close to my needs! However, when I try to add this definition to your file "metafun-001.tex" \startsetups btx:samples:cite:image \doifelsesomething{\btxflush{mpfile}} { \externalfigure[\btxflush{mpfile}] } { \MPcode{ \btxflush{mpcode} } } \stopsetups The command \cite [image] [sample2] does not show the image. Am I doing things wrong? Thanks a lot for your useful suggestion MR
participants (3)
-
Hans Hagen
-
Marco Riggirello
-
marco.riggirello.98@gmail.com