From 95292f9a4428a98e9f5eedeec47db9fdbbab0bbf Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sun, 21 Feb 2021 22:14:56 +0000
Subject: mcf2graph (21feb21)

git-svn-id: svn://tug.org/texlive/trunk@57830 c570f23f-e606-0410-a88d-b1316a301751
---
 .../doc/metapost/mcf2graph/mcf_manual.tex          | 336 ++++++++++++---------
 1 file changed, 201 insertions(+), 135 deletions(-)

(limited to 'Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.tex')

diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.tex b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.tex
index ef6c9b124f8..aea619862ad 100644
--- a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.tex
+++ b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.tex
@@ -1,5 +1,5 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%  Molecular Coding Format manual                by  Akira Yamaji 2021.02.11
+%  Molecular Coding Format manual                by  Akira Yamaji 2021.02.21
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \documentclass[a4paper]{article}
 \usepackage[pdftex]{graphicx}
@@ -52,9 +52,9 @@
 }%
 %---------------------------------------------------------------------------
 \def\put@char{%
-  \begin{picture}(75,110)%
-     \put(0,100){\bf [\NO]\EN}%
-     \put(5,95){\small\tt FM:\fm{ }MW:\mw}%
+  \begin{picture}(75,130)%
+     \put(0,120){\bf [\NO]\EN}%
+     \put(5,115){\small\tt FM:\fm{ }MW:\mw}%
      \put(5,0){\font\@strufont=\File\relax%
                \hbox{\@strufont\char\Char}}%
   \end{picture}%
@@ -394,10 +394,10 @@ exact mass, molecular formula.
 %-----------------------------------------------------------------------------
 \subsubsection{Charged atom}
 \begin{verbatim}
-  "+" : positive / "-" : negative
+  p_ : positive / n_ : negative
 
-<-30,!2,N,??,"+",!2,S,"-"^180,
-!6,7:N,7:??,9:S,7:"+",9:"-"^180
+<-30,!2,N,??,p_,!2,S,n_^180,
+!6,7:N,7:??,9:S,7:n_,9:n_^180
 \end{verbatim}
 \MCFgraph
 %-----------------------------------------------------------------------------
@@ -902,7 +902,7 @@ exact mass, molecular formula.
        0.06      0.12      0.20
 \end{verbatim}
 %-----------------------------------------------------------------------------
-\newpage
+%%\newpage
 %-----------------------------------------------------------------------------
 \subsection{Drawing mode}
 %-----------------------------------------------------------------------------
@@ -989,7 +989,7 @@ MCat(1, .5)(<30,Ph,4:/COOH,3:/NH2)
 \end{verbatim}
 \MCFgraph
 \begin{verbatim}
-  (Draw frame inside margin)
+  (Frame inside margin)
   sw_fframe=2
 \end{verbatim}
 \MCFgraph
@@ -999,7 +999,7 @@ MCat(1, .5)(<30,Ph,4:/COOH,3:/NH2)
 \end{verbatim}
 \MCFgraph
 \begin{verbatim}
-  (Draw small dot at corner)
+  (Small dot at corner)
   sw_fframe=4
 \end{verbatim}
 \MCFgraph
@@ -1018,6 +1018,28 @@ MCat(1, .5)(<30,Ph,4:/COOH,3:/NH2)
   MC(<30,COOH,!,COOH)
 \end{verbatim}
 \MCFgraph
+%-----------------------------------------------------------------------------
+\subsubsection{Remove indent}
+\index{sw\_indent\_off}%
+\begin{verbatim}
+  ** default  sw_indent_off=0
+  beginfont(": Ph         ",
+            ":  ,{1,4}:N  ",
+            ":  ,{2,3}:/_ ")
+  endfont
+
+    mc1=" Ph"
+    mc2="  ,{1,4}:N"
+    mc3="  ,{2,3}:/_"
+
+  sw_indent_off=1
+    mc1="Ph"
+    mc2=",{1,4}:N"
+    mc3=",{2,3}:/_"
+
+  mc="Ph,{1,4}:N,{2,3}:/_" ** 0 or 1
+\end{verbatim}
+%-----------------------------------------------------------------------------
 \newpage
 %-----------------------------------------------------------------------------
 \subsection{Parameter setting}
@@ -1085,36 +1107,53 @@ MCat(1, .5)(<30,Ph,4:/COOH,3:/NH2)
 
   MCat(c,d)(....) :
 
-  mposition:=(c,d);
-  MC(....)
+  mposition:=(c,d); MC(....)
 
-  c: x axis position
-  d: y axis position
+  c: x axis position  d: y axis position
 
-  beginfont()
   defaultsize:=5bp;
-  fsize:=(75mm,75mm);
-  fmargin:=(3mm,3mm);
-  blength:=0.07;
-  sw_fframe:=1;
+  fsize:=(40mm,40mm); fmargin:=(3mm,3mm);
+  blength:=0.1; sw_fframe:=1;
   mangle:=0;
-  for i=1 step -0.25 until 0:
-    for j=0 step 0.25 until 1:
-      %----------------
+  for i=1 step -0.5 until 0:
+    for j=0 step 0.5 until 1:
       MCat(j,i)(Ph,4:N)
-      %----------------
-      add(
-        drawarrow((A1+A1up**aw)..A1);
-        label(decimal(mangle),
-              p0+(0.5w,0.5h));
+      add(drawarrow((A1+A1up**aw)..A1);
+          label(decimal(mangle),
+                p0+(0.5w,0.5h));
       )
-      mangle:=mangle+15;
+      mangle:=mangle+30;
     endfor
   endfor
-  endfont
 
 \end{verbatim}
 \MCFgraph
+%-----------------------------------------------------------------------------
+\subsection{Function check\_mc()}
+\index{check\_mc()}%
+\begin{verbatim}
+  (immediately compile)
+
+  beginfont("EN:Pyridine")
+    MC(Ph,<30,2:N)
+  endfont
+
+  (check mcf and compile)
+
+  beginfont("EN:Pyridine",":<30,Ph,2:N")
+    if check_mc(mc)=0: MC(scantokens(mc)) fi
+  endfont
+
+  ** error in mcf  check_mc(mc)=1
+  beginfont("EN:Pyridine",":<30,Ph,2):N")
+    if check_mc(mc)=0: MC(scantokens(mc)) fi
+  endfont
+
+\end{verbatim}
+\MCFgraph\hspace{15mm}\MCFgraph
+\begin{verbatim}
+  check_mc(mc)=0   check_mc(mc)>=1
+\end{verbatim}
 %===============================================================================
 \newpage
 \subsection{Function add()}
@@ -1380,44 +1419,51 @@ endfont
 \section{MCF example}
 %-----------------------------------------------------------------------------
 \subsection{Luciferin}
-\begin{verbatim}
-beginfont("EN:Luciferin","MW:280.33")
-  fsize:=(60mm,20mm);
-  MC(
-    <30,Ph,3=?5,@8,\,?5,{9,16}=dl,
-    {9,14}:N,{7,11}:S,1:/OH,-2:*/COOH
-  )
+\index{check\_mc()}%
+\begin{verbatim}
+beginfont("EN:Luciferin","MW:280.33",
+  %-------------------------------------
+  ": <30,Ph,3=?5,@8,\,?5,{9,16}=dl,    ",
+  ": {9,14}:N,{7,11}:S,1:/OH,-2:*/COOH ")
+  %-------------------------------------
+  fsize:=(50mm,20mm);
+  if check_mc(mc)=0: MC(scantokens(mc)) fi
 endfont
 \end{verbatim}
 \MCFgraph
 %-----------------------------------------------------------------------------
 \subsection{Colchicine}
 \begin{verbatim}
-beginfont("EN:Colchicine","MW:385.41")
-  fsize:=(60mm,25mm);
-  MC(
-    <30,Ph,{1,2,6}:/O!,-4=?7,
-    -5=?7,{-1,-4,-6}=dl,
-    -2://O,-3:/O!,
-    @9,\,NH,!,//O,!
-  )
+beginfont("EN:Colchicine","MW:385.41",
+  %-------------------------------------
+  ": <30,Ph,{1,2,6}:/O!,-4=?7,-5=?7,  ",
+  ": {-1,-4,-6}=dl,-2://O,-3:/O!,     ",
+  ": @9,\,NH,!,//O,!                  ")
+  %-------------------------------------
+  fsize:=(50mm,20mm);
+  if check_mc(mc)=0: MC(scantokens(mc)) fi
 endfont
 \end{verbatim}
 \MCFgraph
 %-----------------------------------------------------------------------------
 \subsection{Paclitaxel}
 \begin{verbatim}
-beginfont("EN:Paclitaxel","MW:853.91")
-  MC(
-    ?6,5=dl,@3,#1,36,45,45,45,45,##,
-    &.$5,-4=?6,-4=?4,-1=wb,-3=wf,-1:O,||,
-    {4^35,4^-35,6}:/_,{3^-60,15}:*/OH,
-    8:/*H^-60,9:*/_^60,10://O,
-    @1,\,O,!,//O,!,*/OH,!,/Ph,
-    60~wf,NH,-60,//O,60,Ph,
-    @7,\*,O,-45,//O,60,Ph,
-    @11,*/OCO!>rl,12:/*OCO!^-15>lr
-  )
+beginfont("EN:Paclitaxel","MW:853.91",
+  %------------------------------------
+  ": ?6,5=dl,@3,#1,36,45,45,45,45,##, ",
+  ": &.$5",                           ",
+  ": -4=?6,-4=?4,-1=wb,-3=wf,-1:O,||, ",
+  ": 4:??,6:/_,{3^-60,15}:*/OH,       ",
+  ": 8:/*H^-60,",                     ",
+  ": 9:*/_^60,10://O,                 ",
+  ": @1,\,O,!,//O,!,*/OH,!,/Ph,60~wf, ",
+  ":   NH,-60,//O,60,Ph,              ",
+  ": @7,\*,O,-45,//O,60,Ph,           ",
+  ": @11,*\,O,-60,//O,60,             ",
+  ": @12,\*^-15,O,60,//O,-60          ")
+  %------------------------------------
+  fsize:=(50mm,25mm);
+  if check_mc(mc)=0: MC(scantokens(mc)) fi
 endfont
 \end{verbatim}
 \MCFgraph
@@ -1425,27 +1471,30 @@ endfont
 \subsection{Lycorine}
 \begin{verbatim}
 beginfont("EN:Lycorine","MW:287.31")
-  fsize:=(60mm,25mm);
-  MC(<30,
-    Ph,-4=?6,-2=?6,6=?5,(9,12)=?5[3],
-    13=dl,8:N,{15,17}:O,
-    9:/*H^180,10:*/H^60,13:*/OH,14:/*OH
-  )
+  %--------------------------------------
+  ": Ph,-4=?6,-2=?6,6=?5,(9,12)=?5[3], ",
+  ": 13=dl,8:N,{15,17}:O,              ",
+  ": 9:/*H^180,10:*/H^60,              ",
+  ": 13:*/OH,14:/*OH                   ")
+  %--------------------------------------
+  fsize:=(50mm,20mm);
+  if check_mc(mc)=0: MC(scantokens(mc)) fi
 endfont
 \end{verbatim}
 \MCFgraph
 %-----------------------------------------------------------------------------
 \subsection{Gibberellin}
 \begin{verbatim}
-beginfont("EN:Gibberellin","MW:346.37");
-  fsize:=(60mm,20mm);
-  MC(
-    <18,?5,3=?7,5=?6[12],@8,160`1.3,&3,
-    13=dl,6=wf,8=wb,
-    @5,40~zf`1,O,50,//O^180,&14~zb,
-    2:/COOH,7://_,13:*/OH,8:/*OH,
-    14:*/_,{1,4}:*/H^60
-  )
+beginfont("EN:Gibberellin A3","MW:346.37");
+  %----------------------------------------
+  ": <18,?5,3=?7,5=?6[12],@8,160`1.3,&3, ",
+  ": 13=dl,6=wf,8=wb,                    ",
+  ": @5,40~zf`1,O,50,//O^180,&14~zb,     ",
+  ": 2:/COOH,7://_,13:*/OH,8:/*OH,       ",
+  ": 14:*/_,{1,4}:*/H^60                 ")
+  %----------------------------------------
+  fsize:=(50mm,18mm);
+  if check_mc(mc)=0: MC(scantokens(mc)) fi
 endfont
 \end{verbatim}
 \MCFgraph
@@ -1453,13 +1502,14 @@ endfont
 \subsection{Quinine}
 \begin{verbatim}
 beginfont("EN:Quinine","MW:324.42")
-  fsize:=(60mm,25mm);
-  MC(
-    <30,Ph,3=Ph,7:N,6:/O!,
-    @10,\,*/OH,/H~zf^-60,!,
-    |,?6,2:N,1:*/H^60,4:*/!!,
-    @2,165~zf,60,&5~zb
-  )
+  %-------------------------------
+  ": <30,Ph,3=Ph,7:N,6:/O!,     ",
+  ": @10,\,*/OH,/H~zf^-60,!,    ",
+  ": |,?6,2:N,1:*/H^60,4:*/!!,  ",
+  ": @2,165~zf,60,&5~zb         ")
+  %-------------------------------
+  fsize:=(50mm,20mm);
+  if check_mc(mc)=0: MC(scantokens(mc)) fi
 endfont
 \end{verbatim}
 \MCFgraph
@@ -1486,33 +1536,45 @@ tag4:="fm";                                             >
 outputformat:="png"; hppp:=vppp:=0.1;                   > PNG output
 outputtemplate:="%j-%3c.png";                           >
 %-------------------------------------------------------------------------
-beginfont("N:1","EN:Ampicillin")                 > begin font(information)
-  MC(<45,?4,2:N,2=?5,-1:S,                              > begin MCF (1)
-     {3^45,4^-45}:/*H,1://O^15,5:/*COOH^-18,6:??,       >
-     @4,75,NH,!,//O,!,/*NH,!,Ph)                        > end MCF 
+beginfont("EN:Ampicillin","MW:349.405",                 > information
+  %----------------------------------------             >
+  ": <45,?4,-3=?5,2:N,7:S,                ",            > mc1
+  ": 3^45:/*H,1://O^15,5:/*COOH^-18,6:??, ",            > mc2
+  ": @4,*\^15,NH,!,//O,!,/*NH2,!,Ph       ")            > mc3
+  %----------------------------------------             >
+  if check_mc(mc)=0: MC(scantokens(mc)) fi              > mc=mc1&mc2&mc3
 endfont                                                 > end font
 %------------------------------------------------------------------------
-beginfont("N:2","EN:Cholesterol")                > begin font(information)
-  MC(<30,?6,{-4,-2}=?6,-4=?5,7=dl,                      > begin MCF (2)
-      1:*/OH,{4,12}:*/_^60,9:*/H^60,                    >
-      10:/*H^180,{11,-1}:/*H^-60,                       >
-      @-1,17,/*_,!4,?!)                                 > end MCF
+beginfont("EN:Cholesterol","MW:386.65",                 >information
+  %----------------------------------------             >
+  ": <30,?6,{-4,-2}=?6,-4=?5,7=dl,      ",              > mc1
+  ": 10:/*H^180,11:/*H^-60,17:/*H^-54,  ",              > mc2
+  ": {4,12}:*/_^60,                     ",              > mc3
+  ": @-1,18,/*_,-60,!3,?!               ")              > mc4
+  %----------------------------------------             >
+  if check_mc(mc)=0: MC(scantokens(mc)) fi              > mc=mc1&mc2&mc3
 endfont                                                 > end font
 %------------------------------------------------------------------------
-beginfont("N:3","EN:Limonin")                    > begin font(information)
-  MC(<30,?6,{-3,-4}=?6,                                 > begin MCF (3)
-      -5=?3,-2=wf,-1=wb,6=?5,-4=?6,-5=wf,               >
-      {13,15,17,20}:O,{3,12,21}://O,                    >
-      {4~wf^60,8~zf^60,18^35,18^-35}:/_,                >
-      {1^60,5^180,16^60}:/*H,                           >
-      @14,\*,|,?5,{1,4}=dl,3:O)                         > end MCF
+beginfont("EN:Limonin",                                 > information
+  %-----------------------------------------            >
+  ": <30,?6,{-3,-4}=?6,                    ",           > mc1
+  ":  -5=?3,-2=wf,-1=wb,6=?5,-4=?6,-5=wf,  ",           > mc2
+  ":  {13,15,17,20}:O,{3,12,21}://O,       ",           > mc3
+  ":  {4~wf^60,8~zf^60,18^35,18^-35}:/_,   ",           > mc4
+  ":  {1^60,5^180,16^60}:/*H,              ",           > mc5
+  ":  @14,\*,|,?5,{1,4}=dl,3:O)            ")           > mc6
+  %-----------------------------------------            >
+  if check_mc(mc)=0: MC(scantokens(mc)) fi              > mc=mc1 - mc6
 endfont                                                 > end font
 %------------------------------------------------------------------------
-beginfont("N:4","EN:beta-carotene)               > begin font(information)
-  MC(<30,?6,3=dl,{3,5^35,5^-35}:/_,                     > begin MCF (4)
-      @4,\,|,!18,{1,3,5,7,9,11,13,15,17}=dr,            >
-      {3,7,12,16}:/_,                                   >
-      |,?6,6=dl,2:??,6:/_)                              > end MCF
+beginfont("EN:beta-carotene",                           > information
+  %------------------------------------------           >
+  ": <30,?6,3=dl,{3,5^35,5^-35}:/_,         ",          > mc1
+  ": @4,\,|,!18,{1,3,5,7,9,11,13,15,17}=dr, ",          > mc2
+  ": {3,7,12,16}:/_,                        ",          > mc3
+  ": |,?6,6=dl,2:??,6:/_)                   ")          > mc4
+  %------------------------------------------           >
+  if check_mc(mc)=0: MC(scantokens(mc)) fi              > mc=mc1 - mc4
 endfont                                                 > end font
 %------------------------------------------------------------------------
 bye
@@ -1718,60 +1780,64 @@ M  END
 \subsection{LuaTeX file example}
 %############################################################################
 \begin{verbatim}
-%--------------------------------------------------------------------
 \documentclass{article}
 \usepackage{luamplib}%
+\usepackage[T1]{fontenc}%
+\usepackage{textcomp}%
 \mplibcodeinherit{enable}%
 \mplibverbatim{enable}%
-\everymplib{if unknown Ph1:
-              input mcf2graph.mf;
-              mp_log_name:="temp-info.aux";
-              sw_aux_out:=1; 
-            fi}%
-%--------------------------------------------------------------------
+\mplibnumbersystem{double}%
+\everymplib{%
+  if unknown Ph1: input mcf2graph.mf; fi
+  sw_calc:=1;  sw_fframe:=4;  max_blength:=4.5mm;
+  defaultfont:="uhvr8r"; defaultsize:=8bp; defaultscale:=1;
+}%
 \begin{document}
 \noindent%
 %--------------------------------------------------------------------
 \begin{mplibcode}
   fsize:=(50mm,50mm);
-  beginfont("NO:1","EN:Limonin","MW:470.51")
-  MC(<30,
-    ?6,{-3,-4}=?6,
-      -5=?3,-2=wf,-1=wb,6=?5,-4=?6,-5=wf,
-      {13,15,17,20}:O,{3,12,21}://O,
-      {4~wf^60,8~zf^60,18^35,18^-35}:/_,
-      {1^60,5^180,16^60}:/*H,
-      @14,\*,|,?5,{1,4}=dl,3:O
-  )
+  beginfont("NO:1","EN:Limonin","MW:470.51",
+    %----------------------------------------
+    ": <30,?6,{-3,-4}=?6,                  ",
+    ": -5=?3,-2=wf,-1=wb,6=?5,-4=?6,-5=wf, ",
+    ": {13,15,17,20}:O,{3,12,21}://O,      ",
+    ": {4~wf^60,8~zf^60,18^35,18^-35}:/_,  ",
+    ": {1^60,5^180,16^60}:/*H,             ",
+    ": @14,\*,|,?5,{1,4}=dl,3:O            ")
+    %----------------------------------------
+  if check_mc(mc)=0: MC(scantokens(mc)) fi 
   endfont
 \end{mplibcode}\\
 %--------------------------------------------------------------------
 \begin{mplibcode}
   fsize:=(80mm,50mm);
-  beginfont("NO:2","EN:beta-carotene","MW:536.87")
-    MC(<30,
-      ?6,3=dl,{3,5^35,5^-35}:/_,
-      @4,\,|,!18,{1,3,5,7,9,11,13,15,17}=dr,
-      {3,7,12,16}:/_,
-      |,?6,6=dl,{6,2^35,2^-35}:/_
-    )
+  beginfont("NO:2","EN:beta-carotene","MW:536.87",
+    %------------------------------------------
+    ": <30,?6,3=dl,{3,5^35,5^-35}:/_,         ",
+    ": @4,\,|,!18,{1,3,5,7,9,11,13,15,17}=dr, ",
+    ": {3,7,12,16}:/_,                        ",
+    ": |,?6,6=dl,{6,2^35,2^-35}:/_            ")
+    %------------------------------------------
+  if check_mc(mc)=0: MC(scantokens(mc)) fi 
   endfont
 \end{mplibcode}\\
 %--------------------------------------------------------------------
 \begin{mplibcode}
   fsize:=(50mm,50mm);
-  beginfont("NO:3","EN:Gibberellin A3","MW:346.37");
-  MC(<18,?5,3=?7,5=?6[12],
-     @8,160`1.3,&3,13=dl,6=wf,8=wb,
-     @5,40~zf`1,O,60,//O^180,&14~zb,
-     2:/COOH,7://_,13:*/OH,8:/*OH,
-     14:*/_,{1^60,4^60}:*/H
-  )
+  beginfont("NO:3","EN:Gibberellin A3","MW:346.37",
+    %------------------------------------
+    ": <18,?5,3=?7,5=?6[12],           ",
+    ": @8,160`1.3,&3,13=dl,6=wf,8=wb,  ",
+    ": @5,40~zf`1,O,60,//O^180,&14~zb, ",
+    ": 2:/COOH,7://_,13:*/OH,8:/*OH,   ",
+    ": 14:*/_,{1^60,4^60}:*/H          ")
+    %------------------------------------
+  if check_mc(mc)=0: MC(scantokens(mc)) fi 
 endfont;
-\end{mplibcode}\\
 %--------------------------------------------------------------------
+\end{mplibcode}\\
 \end{document}
-%--------------------------------------------------------------------
 \end{verbatim}%
 %############################################################################
 %------------------------------------------------------------------------
@@ -1801,16 +1867,16 @@ endfont;
 %--------------------------------------------------------------------
 \begin{document}
 \unitlength=1mm%
-\INFO{F:mcf_man_soc,C:139,NO:1,mw:349.40462,fm:C16H19N3O4S,EN:Ampicillin}%
-\INFO{F:mcf_man_soc,C:140,NO:2,mw:386.6532,fm:C27H46O,EN:Cholesterol}%
+\INFO{F:mcf_man_soc,C:141,NO:1,mw:349.40462,fm:C16H19N3O4S,EN:Ampicillin}%
+\INFO{F:mcf_man_soc,C:142,NO:2,mw:386.6532,fm:C27H46O,EN:Cholesterol}%
 \end{document}
 %--------------------------------------------------------------------
 \end{verbatim}%
 %############################################################################
 %------------------------------------------------------------------------
-\INFO{F:mcf_man_soc,C:139,NO:1,mw:349.40462,fm:C16H19N3O4S,EN:Ampicillin}%
-\INFO{F:mcf_man_soc,C:140,NO:2,mw:386.6532,fm:C27H46O,EN:Cholesterol}%
+\INFO{F:mcf_man_soc,C:141,NO:1,mw:349.40462,fm:C16H19N3O4S,EN:Ampicillin}%
+\INFO{F:mcf_man_soc,C:142,NO:2,mw:386.6532,fm:C27H46O,EN:Cholesterol}%
 %------------------------------------------------------------------------
-\printindex
+\texttt{\printindex}
 %------------------------------------------------------------------------
 \end{document}
-- 
cgit v1.2.3

