%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Example of MCF   Typeset with LuaLaTeX(luamplib)   by A.Yamaji   2022.01.22
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ** mcf2graph.mf must be version 4.79
% ** use mcf_data_base.mcf
% ** typeset by LuaLaTeX(luamplib)
\documentclass{article}
\usepackage{luamplib}%
\usepackage[T1]{fontenc}%
\mplibcodeinherit{enable}%
\mplibnumbersystem{double}%
\mpliblegacybehavior{disabled}%
%-------------------------------------------------------------------------
\everymplib{%
  if unknown Ph1: input mcf2graph; fi
  outputformat:="eps";
  sw_output:=Fig+Calc;
  fsize:=(35mm,24mm);
  max_blength:=4mm;
  defaultfont:="uhvr8r";
  defaultsize:=8;
  defaultscale:=1;
}%
%-------------------------------------------------------------------------
\pagestyle{empty}
\topmargin=-24mm
\oddsidemargin=-12mm
\textwidth=192mm
\textheight=280mm
\parindent=0mm
%-------------------------------------------------------------------------
\begin{document}
\begin{center}
 {\Huge\sf Molecular Coding Format examples} \vspace{5mm} \\
 Author : Akira Yamaji \quad Date : \today \\
 Located at : http://www.ctan.org/pkg/mcf2graph
\end{center}
{\small *typeset with LuaLaTeX \quad
        *use molecular data base file 'mcf\_data\_base.mcf' \\
        ** FM(fm):molecular formula (calculated) \quad 
        * MW(mw):molecular weight (calculated)} \vspace{3mm} \\
%-------------------------------------------------------------------------
\noindent%
\makeatletter
\newbox \f@box%
\newcount \f@num%
\newcount \t@num%
\font\labelM=cmtt8 at 6pt\relax%
%-------------------------------------------------------------------------
\f@num=0%
\t@num=0%
\unitlength=0.01mm%
\noindent%
%-------------------------------------------------------------------------
\newif\ifCONT@%
\CONT@true%
\loop%
\sbox{\f@box}{%
\begin{mplibcode}
  beginfigm("t:EXA","v+:1")
    if check(mc)=0:
      MC(scantokens(mc))
      VerbatimTeX("\gdef\EN{"&inf_EN&"}");
      VerbatimTeX("\gdef\MW{"&inf_MW&"}");
      VerbatimTeX("\gdef\mw{"&cal_MW&"}");
      VerbatimTeX("\gdef\fm{"&cal_FM&"}");
    fi
  endfigm
\end{mplibcode}
}%
%------------------------------------------------------------------------
\begin{picture}(3750,3350)%
  \put(20,3000){\footnotesize\bf \EN}%
  \put(20,2750){\labelM mw:\mw { / }fm:\fm}%
  \put(20,2530){\labelM MW:\MW { / }[\the\f@num]}%
  \put(0,0){\makebox(3750,2530){\usebox{\f@box}}}%
\end{picture}%
%------------------------------------------------------------------------
\advance\f@num\@ne\relax%
\advance\t@num\@ne\relax%
\ifnum\t@num=5 \\ \t@num=\z@ \fi%
\ifnum\f@num=155 \CONT@false \fi%
\ifCONT@ \repeat%
%------------------------------------------------------------------------------
\end{document}
