A nice setting for working with Metapost

Dimitris <[email protected]> Fri, 29 Jan 2021 07:24:50 +0200
Newsgroups gmane.comp.tex.metapost
Message-ID <[email protected]>
Dears,

I just want to tell you about a nice setting for working with Metapost!

I use ktikz (https://github.com/fhackenberger/ktikz) a well known editor 
for pgf/tikz graphics. It exists for linux and windows.

You just have to use the following template for ktikz:

-------------------------

\documentclass{article}
\usepackage{luamplib}
\usepackage{amsmath,amsfonts,amsthm,amssymb}
\usepackage[usenames,dvipsnames,svgnames]{xcolor}
\usepackage{color}
\usepackage[active,pdftex,tightpage]{preview}
%\PreviewEnvironment[]{tikzpicture}
%\PreviewEnvironment[]{pgfpicture}
\PreviewEnvironment[]{mplibcode}

\begin{document}

\begin{footnotesize}
<>
\end{footnotesize}

\end{document}

--------------------------

and the actual mp file in the form,

----------------------
\begin{mplibcode}

beginfig(1)

prologues:=3;

u:=1.3cm;

pair k[], w[];

path p[], c[];

.....

.....

endfig;

end;

\end{mplibcode}

---------------------------

and select "lualatex" in the ktikz configuration. This gives you instant 
display of the graph you are doing, and export to pdf or png or any of 
the other formats available in ktikz.

I think this is a very handy setting, which i didn't see anywhere else, 
so I thought I share it with you,

BR

Dimitris

--
http://tug.org/metapost/