summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.tex
blob: 0fc116290463b9f0b573d1d8ad0cce0cd3a9c340 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Example of  MCF typest with LuaLaTeX(luamplib)     by A.Yamaji    2017.03.26
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% mcf2graph.mf it must be version 4.20 or later
\documentclass{article}
%------------------------------------------------------------------------------
\usepackage{luamplib}%
\usepackage{lmodern}%
\usepackage[T1]{fontenc}%
\usepackage{textcomp}%
\mplibcodeinherit{enable}%
\mplibverbatim{enable}%
\everymplib{if unknown Ph1:
              input mcf2graph.mf;
              mp_log_name:="temp-info.aux";
              sw_auxout:=1; 
              sw_label:=1;
              var3:="mol_wd"; tag3:="Lx";
              var4:="cal_MW"; tag4:="cMW";
              var5:="cal_FM"; tag5:="cFM";
            fi}%
\everyendmplib{write EOF to mp_log_name;}%
%------------------------------------------------------------------------------
\makeatletter%
\newdimen \MOLwidth%
\newif\ifCONT@%
\newread\@auxf%
%------------------------------------------------------------------------------
\def\@fst@param#1:#2;{#1}%
\def\@sec@param#1:#2;{#2}%
\def\mol@sel#1{%
\if#1\empty\relax\else%
  \edef\@tag{\expandafter\@fst@param#1;}%
  \edef\@var{\expandafter\@sec@param#1;}%
  \ifx\@tag\@F\edef\MOLfile{\@var}\fi    \ifx\@tag\@C\edef\MOLchar{\@var}\fi%
  \ifx\@tag\@Lx\edef\MOLlenx{\@var}\fi   \ifx\@tag\@Ly\edef\MOLleny{\@var}\fi%
  \ifx\@tag\@EN\edef\MOLnameE{\@var}\fi  \ifx\@tag\@JN\edef\MOLnameJ{\@var}\fi%
  \ifx\@tag\@CAS\edef\MOLcas{\@var}\fi   \ifx\@tag\@USE\edef\MOLuse{\@var}\fi%
  \ifx\@tag\@FM\edef\MOLfm{\@var}\fi     \ifx\@tag\@cFM\edef\CALfm{\@var}\fi%
  \ifx\@tag\@MW\edef\MOLmw{\@var}\fi     \ifx\@tag\@cMW\edef\CALmw{\@var}\fi%
  \ifx\@tag\@logP\edef\MOLlogP{\@var}\fi \ifx\@tag\@EXA\edef\MOLextA{\@var}\fi%
  \ifx\@tag\@EXB\edef\MOLextB{\@var}\fi  \ifx\@tag\@NO\edef\MOLnum{\@var}\fi\fi}%
%-------------------------------------------------------------------------------
\def\@F{F}\def\@C{C}\def\@EN{EN}\def\@JN{JN}\def\@CAS{CAS}%
\def\@MW{MW}\def\@cMW{cMW}\def\@FM{FM}\def\@cFM{cFM}\def\@Lx{Lx}\def\@Ly{Ly}%
\def\@NO{NO}\def\@USE@{USE}\def\@logP@{logP}\def\@EXA@{EXA}\def\@EXB@{EXB}%
%-------------------------------------------------------------------------------
%  modified latex2e kernel program control (@for delimiter ','=>';')
\def\@sfor#1#2{\expandafter\def\expandafter\@tmp\expandafter{#1}%
 \ifx\@tmp\@empty\else \expandafter\@rep#1;\@nil;\@nil\@@\@list{#2}\fi}%
\def\@rep#1;#2\@@#3#4{\def#3{#1}\ifx#3\@nnil%
 \expandafter\@fornoop\else#4\relax\expandafter\@rep\fi#2\@@#3{#4}}%
%-------------------------------------------------------------------------------
\def\inputINFO#1{\openin\@auxf=#1\CONT@true%
\loop
\read\@auxf to \@info%
\ifeof\@auxf\CONT@false\else \@sfor\@info{\mol@sel\@list}\fi%
\ifCONT@ \repeat
\closein\@auxf}%
%--------------------------------------------------------------------------------
\newdimen\MOLwidth%
\newdimen\heightCap%
\def\MOLcaption#1#2{%
\MOLwidth=\MOLlenx pt%
\advance\MOLwidth -#1\relax%
\heightCap=#2%
\llap{\makebox[\MOLwidth][l]{\raisebox{\heightCap}{\sf NO.\MOLnum{ }\MOLnameE{ }}}}%
\advance\heightCap -5mm\relax%
\llap{\makebox[\MOLwidth][l]{\raisebox{\heightCap}{\small\tt FM(C):\CALfm}}}%
\advance\heightCap -4mm\relax%
\llap{\makebox[\MOLwidth][l]{\raisebox{\heightCap}{\small\tt MW(C):\CALmw}}}%
\advance\heightCap -4mm\relax%
\llap{\makebox[\MOLwidth][l]{\raisebox{\heightCap}{\small\tt MW(D):\MOLmw}}}%
}%
\makeatother%
%------------------------------------------------------------------------------------
\pagestyle{empty}
\topmargin=-25mm
\oddsidemargin=0mm
\textwidth=160mm
\textheight=280mm
\unitlength=1mm
%------------------------------------------------------------------------------------
\begin{document}
\begin{center}
 {\Huge\sf MCF example for luamplib(Lua\LaTeX)}\vspace{5mm}\\
 Author : Akira Yamaji \quad Date : \today\\
 Located at : http://www.ctan.org/pkg/mcf2graph\vspace{2mm}\\
\end{center}
\noindent%
%------------------------------------------------------------------------------------
{{\small {\tt FM(C) :} molecular formula calculated by mcf2graph}\\
{{\small {\tt MW(C) :} molecular weight calculated by mcf2graph}\\
{{\small {\tt MW(D) :} molecular weight from literature data}\\
\begin{mplibcode}
  font_wd:=90mm; font_ht:=45mm;
  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,
     -2\,54~dl,|,?5,2=d,5:N,-2\~dl,54,|,?5,5=d,5:N,-2\~dl,&#5,
     -1*,24,/*COO!^15,72,//O,&#1,},
     4\`1.45,Mg,&17,-1*,&11~vb,-1*,&23~vb,
     @(2,9,15,20~zf)/_,8:/!,14\,!!,
     21*,-6~wf,!2,//O,!,O,!2,!!,|,!13,@(1,5,9,13)/_,
   )
  endfont
\end{mplibcode}
\inputINFO{temp-info.aux}%
\MOLcaption{0mm}{35mm}\hspace{8mm}%
%----------------------------------------------------------------------------
\begin{mplibcode}
  font_wd:=40mm; font_ht:=35mm;
  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)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
     )
  endfont
\end{mplibcode}
\inputINFO{temp-info.aux}%
\MOLcaption{0mm}{45mm}\vspace{6mm}\\%
%----------------------------------------------------------------------------
\begin{mplibcode}
  font_wd:=80mm; font_ht:=28mm;
  beginfont("NO:3","EN:beta-carotene","MW:536.87")
    MCf(<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)/_
    )
  endfont
\end{mplibcode}
\inputINFO{temp-info.aux}%
\MOLcaption{0mm}{35mm}\hspace{8mm}%
%----------------------------------------------------------------------------
\begin{mplibcode}
font_wd:=50mm; font_ht:=40mm;
beginfont("NO:4","EN:Gibberellin A3","MW:346.37");
  MCf(<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)
endfont;
\end{mplibcode}
\inputINFO{temp-info.aux}%
\MOLcaption{0mm}{38mm}\vspace{5mm}\\%
%----------------------------------------------------------------------------
\begin{mplibcode}
font_wd:=55mm; font_ht:=55mm;
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)*/_,@(4,6^-35,8,12^35)/*_,
     @(6^35,11,12^-35)*/OH,
     #3\*,O,30,|,?6`.7,2:O,@(3,5^35)/_,4:/OH,5^-35:/O!,
     #5\*^30`1.7,O,!,|,?6`.7,6:O,5:/_,2:/OH,3:/NMeMe
     )
  endfont;
\end{mplibcode}
\inputINFO{temp-info.aux}%
\MOLcaption{30mm}{52mm}\hspace{8mm}%
%----------------------------------------------------------------------------
\begin{mplibcode}
font_wd:=90mm; font_ht:=55mm;
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,
    #7*,&#26,#1\^120,//O,60,NH,60,/*H,*/COOH^180,-60,
    Ph,@(-2,-4)/OH,-1\,Ph,-5:/OH,-2*,&#4,},
    @(3^40,6,9,12)//O,@(2,5,8,11)NH,
    @(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,!,|,?6`.7,2:O,3^10:/!OH,@(4,5)/OH,
        -1\,O,!,|,?6`.7,6:O,@(3^35,5)/_,3^-35:/NH2,4:/OH
  )
endfont;
\end{mplibcode}
\inputINFO{temp-info.aux}%
\MOLcaption{55mm}{50mm}\vspace{6mm}\\%
%----------------------------------------------------------------------------
\begin{mplibcode}
  font_wd:=150mm; font_ht:=70mm;
  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,
    -3\^30,<30,?6,$(-3,-3)?6,-3=?7,$(-4,-3,-3)?6,
    -2\,?6,-3=?6,-3=?7,$(-3,-3)?6,-3=?8,-3=dl,$(-5,-3,-3,-3)?6,
    @(5,7,15,16,23,24,32,40,41,48,49,58,59,72,73,82,83,90,91,99,
      100,107,113,114,122,123,130,131,140,141,148,149)O,
    @(1^60,2,26,28,29,51,54,61,63,68,75^60,78,109)*/OH,
    @(11,20,35,45,52,55,65,69,86)/*OH,@(47,57,71)/*H^60,
    @(3,8,13,17,21,33,38,42,56,70,84,92,101,106,111,128,138,142,146,150)/*H^-60,
    @(4,14,22,34,39,43,81,89,98,102,116,121,125,129,133)*/H^60,
    @(6,46,50,53,60,67,74)*/H^-60,
    @(9,18,85,93,112,139,143,147)*/_`1^60,
    @(80,88,97,115,120,124)/*_`1^-60,108:*/_`1^-60,
    #6\,|,!11,60~dr,-60,60,OH,2:/*OH,@(7,10)*/OH,@(1,3)*/_,@(8~zf,11~dm,12)/_,
              6\,O,30,SOO,30,"O{Na}",
    #36\~zf^-45,O,30,SOO,30,"O{Na}",
    #150\,|,!7,@(1,2)/*OH,4:*/_,5:/*_,7=dl
    )
  endfont
\end{mplibcode}
\inputINFO{temp-info.aux}%
\MOLcaption{110mm}{70mm}\\%
%----------------------------------------------------------------------------
\end{document}