2010-10-10 95 views
5

我有两个MetaPost的文件:是否有可能包含一个MetaPost文件到另一个?

% test1.mp 
beginfig(1): 

% foobar code 

% code specific to test1 

endfig; 
end; 

% test2.mp 
beginfig(1): 

% foobar code  

% code specific to test2 

endfig; 
end; 

作为一个程序员,我自然恨重复。有没有办法将“foobar代码”移动到foobar.mp文件中,然后将这个文件包含在test1.mp和test2.mp中?例如...

% test1.mp 
beginfig(1): 

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

% code specific to test2 

endfig; 
end; 

回答

4
% test1.mp 
beginfig(1): 
input foobar 
endfig; 
end; 
+0

是随时随地记录了'input'命令?我试图搜索关于它的信息,但找不到任何东西。 – Palec 2015-05-04 01:30:39

+0

另外,当使用内置于lualatex中的mplib时,输入机制似乎不起作用---任何解决方案/解决方法? – user22356 2016-12-26 13:01:37