1:- module(latex_control, []).    2
    3user:file_search_path(sty, X):-  getenv(home, X0),
    4	atomic_list_concat([X0, '/cabinet/TeX/preambles'], X).
    5
    6
    7% jarticle([file(sty('jarticle.tex')),
    8% 	file(sty('macro-2009-jp.tex')),
    9% 	text("\n\\begin{document}\n"),
   10% 	region,
   11% 	text("\n\\end{document}\n")
   12%        ]).
   13
   14jarticle([file(sty('jarticle.tex')),
   15	text("\\langjptrue\n"),
   16    	text("\\input prooftree\n"),
   17	text("\\input environments\n"),
   18 	text("\\input standard-symbols\n"),
   19	text("\\input symbols-2009b\n"),
   20	text("\n\\begin{document}\n"),
   21	region,
   22	text("\\end{document}\n")
   23       ]).
   24
   25
   26powerdot([file(sty('powerdot2009.tex')),
   27	text("\\langjptrue\n"),
   28    	text("\\input prooftree\n"),
   29	text("\\input environments\n"),
   30 	text("\\input standard-symbols\n"),
   31	text("\\input symbols-2009b\n"),
   32	text("\n\\begin{document}\n"),
   33	region,
   34	text("\\end{document}\n")
   35       ]).
   36
   37
   38uarticle([file(sty('uarticle.tex')),
   39	text("\\langjptrue\n"),
   40	text("\\input environments\n"),
   41 	text("\\input standard-symbols\n"),
   42	text("\\input symbols-2009b\n"),
   43	text("\n\\begin{document}\n"),
   44	region,
   45	text("\\end{document}\n")
   46       ]).
   47
   48xarticle([file(sty('xarticle.tex')),
   49	text("\\langjpfalse\n"),
   50 	text("\\input xenvironments\n"),
   51  	text("\\input standard-symbols\n"),
   52	text("\\input symbols-2009b\n"),
   53	text("\n\\begin{document}\n"),
   54	region,
   55	text("\\end{document}\n")
   56       ]).
   57
   58% xarticle([file(sty('xarticle.tex')),
   59% % 	text("\\input macro-2009-jp\n"),
   60% 	text("\n\\begin{document}\n"),
   61% 	region,
   62% 	text("\\end{document}\n")
   63%        ]).
   64
   65:- meta_predicate(latex_control(?, 1)).   66latex_control(TeX_Distr, P) :- call(P, Fs),  cur_dir(D),
   67	directory(D, latex_control_(TeX_Distr, Fs)).
   68
   69latex_control_(D, Fs):- eh:assemble(Fs, '_region_.tex'), latex_control(D).
   70
   71
   72latex_control(ptex) :- !,
   73	sh('use-ptex';
   74     	     platex('_region_');
   75	     dvipdfmx('_region_');
   76	     open(-a('Preview'), '_region_.pdf')).
   77latex_control(uptex) :- !,
   78	sh('use-uptex';
   79	     uplatex('_region_');
   80	     '~/texbin/dvipdfmx'('_region_');
   81	     open(-a('Preview'), '_region_.pdf')).
   82latex_control(xetex) :-
   83	sh('use-xetex';
   84	     xelatex('_region_');
   85	     open(-a('Preview'), '_region_.pdf'))