Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to include one MetaPost file into another?

Tags:

metapost

I have two metapost files:

% test1.mp
beginfig(1):

% foobar code

% code specific to test1

endfig;
end;

% test2.mp
beginfig(1):

% foobar code    

% code specific to test2

endfig;
end;

As a programmer, I naturally hate duplication. Is there a way of moving the "foobar code" into a foobar.mp file, and then including this file in both test1.mp and test2.mp? For example...

% test1.mp
beginfig(1):

% for illustration...
Include.foobar("foobar.mp");

% code specific to test2

endfig;
end;
like image 454
Nick Bolton Avatar asked Oct 14 '22 22:10

Nick Bolton


1 Answers

% test1.mp
beginfig(1):
input foobar
endfig;
end;
like image 50
Nate Eldredge Avatar answered Oct 17 '22 23:10

Nate Eldredge