From 6173294c8dccb7500fabf74417b1005a43375248 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Mon, 3 Aug 2015 22:03:30 +0000
Subject: mcf2graph (3aug15)

git-svn-id: svn://tug.org/texlive/trunk@38032 c570f23f-e606-0410-a88d-b1316a301751
---
 .../doc/metapost/mcf2graph/mcf_mplib_exa.tex       | 132 +++++++++++++--------
 1 file changed, 81 insertions(+), 51 deletions(-)

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

diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.tex b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.tex
index ba0d89e3ad9..b90ce3a9d9a 100644
--- a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.tex
+++ b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.tex
@@ -1,9 +1,51 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%   MCF Lualatex(luamplib) Example              by A.Yamaji      2015.7.30
+%   MCF luamplib(LuaLaTeX) Example              by A.Yamaji      2015.8.3
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \documentclass{article}
 \usepackage{luamplib}
 \usepackage{fancyvrb}
+\def\tempaux{temp_file.aux}%
+%-------------------------------------------------------------------------------
+\everymplib{verbatimtex \leavevmode etex; input mcf2graph.mf; sw_logout:=1;
+            mp_log_name:="temp-info.aux"; input \tempaux;}%
+\everyendmplib{write EOF to mp_log_name;}%
+%-------------------------------------------------------------------------------
+\makeatletter%
+\newdimen \MOLwidth%
+%-------------------------------------------------------------------------------
+\def\mol@sel#1{%
+  \if#1\empty\relax\else%
+    \edef\@first{\expandafter\@first@param#1;}%
+    \edef\@second{\expandafter\@second@param#1;}%
+    \ifx\@first\@EN@    \edef\MOLnameE{\@second}\fi%
+    \ifx\@first\@JN@    \edef\MOLnameJ{\@second}\fi%
+    \ifx\@first\@NO@    \edef\MOLnumber{\@second}\fi%
+    \ifx\@first\@CAS@   \edef\MOLcas{\@second}\fi%
+    \ifx\@first\@MW@    \edef\MOLmw{\@second}\fi%
+    \ifx\@first\@FM@    \edef\MOLfomura{\@second}\fi%
+    \ifx\@first\@USE@   \edef\MOLuse{\@second}\fi%
+    \ifx\@first\@XLogP@ \edef\MOLXLogP{\@second}\fi%
+    \ifx\@first\@EXA@   \edef\MOLextA{\@second}\fi%
+    \ifx\@first\@EXB@   \edef\MOLextB{\@second}\fi%
+  \fi%
+}%
+%-------------------------------------------------------------------------------
+\def\@first@param#1:#2;{#1}\def\@second@param#1:#2;{#2}%
+\def\@EN@{EN}\def\@JN@{JN}\def\@CAS@{CAS}\def\@NO@{NO}\def\@MW@{MW}\def\@FM@{FM}%
+\def\@USE@{USE}\def\@XLogP@{XLogP}\def\@EXA@{EXA}\def\@EXB@{EXB}%
+\def\MOL@info@aux#1#2#3{\mol@sel{#1}\mol@sel{#2}\mol@sel{#3}}%
+\def\MOLinfo#1#2#3#4#5#6#7#8#9{%   %%%% max item number = 12  %%%%
+  \edef\MOLnameE{}\edef\MOLnameJ{}\edef\MOLnumber{}\edef\MOLcas{}\edef\MOLmw{}%
+  \edef\MOLfomura{}\edef\MOLuse{}\edef\MOLXLogP{}\edef\MOLextA{}\edef\MOLextB{}%
+  \mol@sel{#1}\mol@sel{#2}\mol@sel{#3}\mol@sel{#4}\mol@sel{#5}\mol@sel{#6}%
+  \mol@sel{#7}\mol@sel{#8}\mol@sel{#9}\MOL@info@aux}%
+%--------------------------------------------------------------------------------
+\def\MCFinfo#1#2#3#4#5#6#7#8#9{\MOLwidth#4pt\relax}%
+\def\MOLcaption#1#2{\input temp-info.aux\relax\advance\MOLwidth -#1\relax%
+\llap{\makebox[\MOLwidth][l]{\raisebox{#2}%
+{\sf NO.\MOLnumber{ }\MOLnameE{ }\tiny (MW:\MOLmw)}}}}%
+\makeatother%
+%------------------------------------------------------------------------------------
 \pagestyle{empty}
 \topmargin=-25mm
 \oddsidemargin=0mm
@@ -12,16 +54,11 @@
 \unitlength=1mm
 %------------------------------------------------------------------------------------
 \begin{document}
-%
-{\LARGE  MCF example for LuaLaTeX(luamplib) }%
-   \hspace{20mm}by Akira Yamaji   2015.7.30\vspace{8mm}\\
-%
-\everymplib{verbatimtex \leavevmode etex; input mcf2graph.mf; input temp_file.aux;}%
+{\LARGE  MCF example for luamplib(LuaLaTeX) }%
+   \hspace{20mm}by Akira Yamaji   2015.8.3\vspace{8mm}\\
 %------------------------------------------------------------------------------------
-\rlap{\raisebox{35mm}{No.1 Chlorophyll a}}%
-\begin{VerbatimOut}{temp_file.aux}
-  font_wd:=100mm;
-  font_ht:=50mm;
+\begin{VerbatimOut}{\tempaux}
+  font_wd:=100mm; font_ht:=50mm;
   beginfont("NO:1","EN:Chlorophyll a","MW:893.49")
     MCf(^^54,
    {,``1,?5,$(2,5)d,4:N,3\,54~dl,?5,$(2,4)d,5:N,
@@ -33,14 +70,12 @@
   )
   endfont
 \end{VerbatimOut}
-\begin{mplibcode}\end{mplibcode}%
-\hspace{8mm}%
+\begin{mplibcode}\end{mplibcode}
+\MOLcaption{0mm}{35mm}\hspace{8mm}%
 %----------------------------------------------------------------------------
-\rlap{\raisebox{38mm}{No.2 Limonin}}%
-\begin{VerbatimOut}{temp_file.aux}
-  font_wd:=60mm;
-  font_ht:=40mm;
-  beginfont("NO:2","EN:Limonin")
+\begin{VerbatimOut}{\tempaux}
+  font_wd:=60mm; font_ht:=40mm;
+  beginfont("NO:2","EN:Limonin","MW:470.51")
   MCf(^^30,
     ?6,$(-3,-4)??6,-5=??3,-2=wf,-1=wb,6=??5,-4=??6,-5=wf,
       @(13,15,17,20,25)O,@(3,12,21)//O,
@@ -49,13 +84,12 @@
      )
   endfont
 \end{VerbatimOut}
-\begin{mplibcode}\end{mplibcode}\vspace{8mm}\\%
+\begin{mplibcode}\end{mplibcode}%
+\MOLcaption{0mm}{43mm}\vspace{8mm}\\%
 %----------------------------------------------------------------------------
-\rlap{\raisebox{25mm}{No.3 beta-Carotene}}%
-\begin{VerbatimOut}{temp_file.aux}
-  font_wd:=90mm;
-  font_ht:=30mm;
-  beginfont("NO:3","EN:beta-Carotene")
+\begin{VerbatimOut}{\tempaux}
+  font_wd:=90mm; font_ht:=30mm;
+  beginfont("NO:3","EN:beta-Carotene","MW:536.87")
     MCf(^^30,
       ?6,3:d,@(3,5^35,5^-35)/Me,
       4\,!18,$(1,3,5,7,9,11,13,15,17)dr,@(3,7,12,16)/Me,
@@ -63,13 +97,12 @@
     )
   endfont
 \end{VerbatimOut}
-\begin{mplibcode}\end{mplibcode}\hspace{8mm}%
+\begin{mplibcode}\end{mplibcode}%
+\MOLcaption{0mm}{25mm}\hspace{8mm}%
 %----------------------------------------------------------------------------
-\rlap{\raisebox{25mm}{No.4 Gibberellin}}%
-\begin{VerbatimOut}{temp_file.aux}
-font_wd:=50mm;
-font_ht:=40mm;
-beginfont("NO:4","EN:Gibberellin");
+\begin{VerbatimOut}{\tempaux}
+font_wd:=50mm; font_ht:=40mm;
+beginfont("NO:4","EN:Gibberellin","MW:346.37");
   MCf(
      ^^12,?6`1.3,3=??5,9=??7,12\^160`1.6,&8,
      4\^155~zf`-1.2,O,55,//O^180`1,&2~zb,
@@ -78,13 +111,12 @@ beginfont("NO:4","EN:Gibberellin");
    )
 endfont;
 \end{VerbatimOut}
-\begin{mplibcode}\end{mplibcode}\vspace{10mm}\\%
+\begin{mplibcode}\end{mplibcode}%
+\MOLcaption{0mm}{25mm}\vspace{10mm}\\%
 %----------------------------------------------------------------------------
-\rlap{\raisebox{55mm}{No.5 Erythromycin}}%
-\begin{VerbatimOut}{temp_file.aux}
-font_wd:=60mm;
-font_ht:=70mm;
-beginfont("NO:5","EN:Erythromycin");
+\begin{VerbatimOut}{\tempaux}
+font_wd:=60mm; font_ht:=70mm;
+beginfont("NO:5","EN:Erythromycin","MW:733.93");
 MCf(^^30,
   {,``1,^^-120,60,60,60,-60,60,60,-60,60,60,60,-60,60,60,},&1,
      14:O,13:/*Et,@(1,9)//O,@(2,10)*/Me,@(4,6^-35,8,12^35)/*Me,
@@ -94,13 +126,12 @@ MCf(^^30,
 )
 endfont;
 \end{VerbatimOut}
-\begin{mplibcode}\end{mplibcode}\hspace{8mm}%
+\begin{mplibcode}\end{mplibcode}%
+\MOLcaption{0mm}{55mm}\hspace{8mm}%
 %----------------------------------------------------------------------------
-\rlap{\raisebox{70mm}{No.6 Vancomycin}}%
-\begin{VerbatimOut}{temp_file.aux}
-font_wd:=100mm;
-font_ht:=70mm;
-beginfont("NO:6","EN:Vancomycin");
+\begin{VerbatimOut}{\tempaux}
+font_wd:=100mm; font_ht:=70mm;
+beginfont("NO:6","EN:Vancomycin","MW:1449.25");
   MCf(^^30,
    {,``1,!12,$(1,3,12)zf,7=wf,/H^-60,60,*/OH,60,
    Ph,-4:/Cl,-3\,O,!,Ph,-4\,O,!,Ph,-1^15:/Cl,-3\,/*OH,*/H^-60,&(#1),
@@ -110,18 +141,17 @@ beginfont("NO:6","EN:Vancomycin");
    @(1^180,4^180)*/H,@(7^-60,10^60,14^60)/*H,
    #10*\^-60,60,//O,!,NH2,
    #13*\,NH,!,//O,!,/'(!,iPr)^-35>60,*/H^60,!~zf,NH,!,
-   #23\,O,!,{,``.7,?6,2:O,3^10:/'(!,OH),@(4,5)/OH,},
-    -1\,O,!,{,``.7,?6,6:O,@(3^35,5)/Me,3^-35:/NH2,4:/OH,}
+   #23\,O,!,?6`.7,2:O,3^10:/'(!,OH),@(4,5)/OH,,
+    -1\,O,!,?6`.7,6:O,@(3^35,5)/Me,3^-35:/NH2,4:/OH
   )
 endfont;
 \end{VerbatimOut}
-\begin{mplibcode}\end{mplibcode}\vspace{8mm}\\%
+\begin{mplibcode}\end{mplibcode}%
+\MOLcaption{0mm}{70mm}\vspace{8mm}\\%
 %----------------------------------------------------------------------------
-\rlap{\raisebox{50mm}{No.7 Maitotoxin}}%
-\begin{VerbatimOut}{temp_file.aux}
-  font_wd:=160mm;
-  font_ht:=90mm;
-  beginfont("NO:7","EN:Maitotoxin")
+\begin{VerbatimOut}{\tempaux}
+  font_wd:=160mm; font_ht:=90mm;
+  beginfont("NO:7","EN:Maitotoxin","MW:3425.86")
   MCf(^^55.8,
   ?6,-4=??7 ,$(-4,-3,-3,-3)??6,-3\,!!3,??6,$(-4,-3,-3,-3)??6,
   -3\,??6,-3=??6,-3\,!!3,60,^^-30,??6,-3=??6,
@@ -143,7 +173,7 @@ endfont;
   )
   endfont
 \end{VerbatimOut}
-\begin{mplibcode}\end{mplibcode}\\%
+\begin{mplibcode}\end{mplibcode}%
+\MOLcaption{0mm}{50mm}\\%
 %----------------------------------------------------------------------------
-%
 \end{document}
-- 
cgit v1.2.3

