summaryrefslogtreecommitdiff
path: root/graphics/mcf2graph/mcf_example.tex
blob: c356799a8f4b78f2c8e387036883543c063c46ec (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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Example of MCF   Typeset with LuaLaTeX(luamplib)   by A.Yamaji   2022.03.27
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ** mcf2graph.mf must be version 4.83
% ** use mcf_library.mcf
% ** typeset by LuaLaTeX(luamplib)
\documentclass{article}
\usepackage{luamplib}
\usepackage[T1]{fontenc}
\mplibcodeinherit{enable}
\mplibnumbersystem{double}
\mpliblegacybehavior{disabled}
%-------------------------------------------------------------------------
\everymplib{
  if unknown Ph1:
    input mcf2graph;
    outputformat:="eps";
    sw_output:=Fig+Calc;
    fsize:=(35mm,24mm);
    max_blength:=4mm;
  fi
}%
%-------------------------------------------------------------------------
\pagestyle{empty}
\topmargin=-24mm
\oddsidemargin=-12mm
\textwidth=192mm
\textheight=280mm
\parindent=0mm
\newcount\headeroff
\headeroff=0
\makeatletter
%-------------------------------------------------------------------------
\begin{document}
\ifnum\z@=\headeroff%
\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 library file 'mcf\_library.mcf' \\
        ** FM(fm):molecular formula (calculated) \quad 
        * MW(mw):molecular weight (calculated)} \vspace{3mm} \\
\fi%
%-------------------------------------------------------------------------
\noindent%
\newbox \fig@box%
\newcount \fig@num%
\newcount \col@num%
\font\labelM=cmtt8 at 6pt\relax%
%-------------------------------------------------------------------------
\fig@num=0%
\col@num=0%
\unitlength=0.01mm%
\edef\zero{0}%
\noindent%
%-------------------------------------------------------------------------
\newif\ifCONT@%
\CONT@true%
\loop%
\advance\fig@num\@ne\relax%
\advance\col@num\@ne\relax%
\sbox{\fig@box}{%
\begin{mplibcode}
  beginfigm("t:EXA","v+:1")
    if mc_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
  VerbatimTeX("\gdef\EOF{"&decimal(f_EOF)&"}");
\end{mplibcode}
}%
%------------------------------------------------------------------------
\ifx\EOF\zero%
  \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\fig@num]}%
    \put(0,0){\makebox(3750,2530){\usebox{\fig@box}}}%
  \end{picture}%
  \ifnum\col@num=5 \\ \col@num=\z@ \fi%
\else%
  \CONT@false%
\fi%
%------------------------------------------------------------------------
%%%%%%%%\ifnum\fig@num=10 \CONT@false \fi%
\message{[\the\fig@num:\EN]}%
\ifCONT@ \repeat%
%------------------------------------------------------------------------------
\end{document}