[NTG-context] METAPOST vardef returning multiple and non-numeric types as a single answer?

Gerben Wierda gerben.wierda at rna.nl
Sun Mar 15 11:22:25 CET 2020


I would like a vardef macro to return the pair of a picture and a bounding box. I don't want to use the setbound operator, because as soon as I do that, I cannot access the components of the picture anymore with pathpart.

I found metapost vardef returning multiple values <https://tex.stackexchange.com/questions/448740/metapost-vardef-returning-multiple-values> on StackExchange but that is about returning multiple values of the same numeric type. Is it possible to have vardef return a set of (picture, path) or (picture, picture) in some way? If not, I need to make two vardef macros for each result type.

I tried many things, amongst which:

vardef Foo( expr w, h)
% define pic
pic
end group,begingroup
% define pic
pic
endif

picture foo[]; foo = Foo( 2, 4);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20200315/3c8000db/attachment-0001.htm>


More information about the ntg-context mailing list