%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Molecular Coding Format manual          by  Akira Yamaji 2016.10.13
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[a4paper]{article}
%%%%\usepackage{graphicx}
\usepackage[dvipdfm]{graphicx}
%%%%\usepackage[pdftex]{graphicx}
%%%%\usepackage{epstopdf}
\usepackage[dvipdfmx]{hyperref}
%%%%\usepackage[pdftex]{hyperref}
\hypersetup{colorlinks=true,linkcolor=blue}
\topmargin=-18mm
\textheight=254mm
\textwidth=168mm
\oddsidemargin=0mm
\unitlength=1mm%
\makeatletter
%----------------------------------------------------------------------------
\newcount \fontnum%
\newcount \tempnum%
\newdimen \htman%
\newdimen \wdman%
\newdimen \htmans%
\htman=45mm%
\wdman=94mm%
\htmans=42mm%
\fontnum=20%
\tempnum=1%
%----------------------------------------------------------------------------
\font\@strufont=mcf_man_soc\relax%
%----------------------------------------------------------------------------
\def\MCFstructure{\hspace{5mm}{\@strufont\char\fontnum}\advance\fontnum\@ne\relax}%
%--------------------------------------------------------------------
\def\@F{F}\def\@C{C}\def\@EN{EN}\def\@NO{NO}\def\@cMW{cMW}\def\@cFM{cFM}%
\def\@fst#1:#2;{#1}\def\@sec#1:#2;{#2}%
\def\mol@sel#1{%
\if#1\empty\relax\else%
  \edef\@tag{\expandafter\@fst#1;}%
  \edef\@var{\expandafter\@sec#1;}%
  \ifx\@tag\@F\edef\MOLfile{\@var}\fi%
  \ifx\@tag\@C\edef\MOLchar{\@var}\fi%
  \ifx\@tag\@EN\edef\MOLnameE{\@var}\fi%
  \ifx\@tag\@NO\edef\MOLnum{\@var}\fi
  \ifx\@tag\@cMW\edef\CALmw{\@var}\fi
  \ifx\@tag\@cFM\edef\CALfm{\@var}\fi
\fi}%
\def\put@char{%
  \begin{picture}(84,28)%
     \put(0,23){\bf [\MOLnum]\MOLnameE}%
     \put(5,18){\small\tt FM:\CALfm{ }MW:\CALmw}%
     \put(5,0){\font\@strufont=\MOLfile\relax%
               \hbox{\@strufont\char\MOLchar}}%
  \end{picture}%
}
%----------------------------------------------------------------------------
\def\INFO#1{\@for\@temp:=#1\do{\mol@sel\@temp}\put@char}%
%----------------------------------------------------------------------------
\def\figex#1#2#3#4{%
\makebox[5mm]{}%%
\makebox[#1]{\tt #2}%
\makebox[#1]{\tt #3}%
\makebox[#1]{\tt #4}}%
%----------------------------------------------------------------------------
\begin{document}
\title{\Huge\sf Molecular Coding Format manual}
\author{Akira Yamaji}
\date{\today}
\maketitle
\begin{center} Located at http://www.ctan.org/pkg/mcf2graph \end{center}
%-----------------------------------------------------------------------------
\vspace{10mm}
{\@strufont%
\makebox[10mm]{}\char0\raisebox{10mm}{\char1}\char2\raisebox{10mm}{\char3}\\
\makebox[10mm]{}\char4\raisebox{10mm}{\char5}\char6\raisebox{10mm}{\char7}\\
\makebox[10mm]{}\char8\raisebox{10mm}{\char9}\char10\raisebox{10mm}{\char11}\\
\makebox[10mm]{}\char12\raisebox{10mm}{\char13}\char14\raisebox{10mm}{\char15}\\
\makebox[10mm]{}\char16\raisebox{10mm}{\char17}\char18\raisebox{10mm}{\char19}\\}
%-----------------------------------------------------------------------------
\twocolumn
\tableofcontents
%-----------------------------------------------------------------------------
\linethickness{0.08mm}%
%----------------------------------------------------------------------------
\newpage
\section{Introduction}
Molecular Coding Format(MCF) is new linear notation
 represent chemical structure diagrams. 
This 'Coding' is named from coding(programing) technique
like adressing,grouping,macro,etc. 
There are no Meta language commands in MCF.
mcf2graph.m convert MCF file to graphics file
pk font,PNG,SVG,EPS or MDL MOL file(V2000).\\
%-----------------------------------------------------------------------------
\section{MCF syntax}
\subsection{Make bond}
\subsubsection{Chain}
\begin{verbatim}
  real number plus (+): anticlockwize 
  real number minus(-): clockwize

  <30,-60,60,-90,120,-90,60
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\begin{verbatim}
  ! : take value 60 or -60 depend on
        current angle and enviroment
  !6 : !,!,!,!,!,!

  <30,!,!,!,!,!,!
  <30,!6
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Jump and branch bond}
\begin{verbatim}
  n* : Jump to An
  ** An: atom number(-999<=n<=4095)
       
  <30,!6,3*,0,!,5*,-30
\end{verbatim}
\MCFstructure
%------------------------------------
\begin{verbatim}
  3\ : 3*,0

  <30,!6,3\,!
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Branch bond}
\begin{verbatim}
  2\  : 2*,0
  4*\ : 4*,0~wf
  6\* : 6*,0~zf
  8\\ : 8*,0~dm

  <30,!8,2\,!,4*\,!,6\*,!,8\\,!
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\begin{verbatim}
  2\~dr  : 2*,0~dr
  4\`1.5 : 4*,0`1.5
  6\^15  : 6*,0^15

  <-30,!6,
  2\~dr,!,
  4\`1.5,-90,
  6\^15,-60
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Connect atom}
\begin{verbatim}
  &n : Connect to An

  <30,!6,3\,!,&5
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Ring}
\begin{verbatim}
  ?n : n membered ring(3<=n<=20)
  ?6 : <-120,60,60,60,60,60,&1
   ?6
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Rotate current angle}
\begin{verbatim}
  <angle : rotate current angle

  0,0,<90,0,<-90,0,0,$(1,2,3,4,5)vf 
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Change bond type}
\subsubsection{Double,triple}
\begin{verbatim}
  a~type : ~~type,a
  dm : double middle
  dl : double left side
  dr : double right side
  tm : triple

  <30,!~dm,!~dl,!~dr,!~tm
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Wedge}
\begin{verbatim}
  wf : wedge forward
  wb : wedge backward
  zf : wedge dotted
  zb : wedge dotted backward

  <30,!~wf,!,!~wb,!,!~zf,!,!~zb
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Vector}
\begin{verbatim}
  vf : vector forward
  vb : vector backward

  <30,!~vf,!,!~vb
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Dotted,wave}
\begin{verbatim}
  Bn=bond type : change bond type at Bn
  dt : dotted
  wv : wave

  <30,!3,1=dt,3=wv
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Broad}
\begin{verbatim}
  bd : broad
  bz : broad dotted 

  <30,!3,1=bd,3=bz
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Change multi bond type}
\begin{verbatim}
  $(2,4,6)dr : 2=dr,4=dr,6=dr

  <30,!7,$(2,4,6)dr
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Over line}
\begin{verbatim}
  si_ : single over line 
  wf_ : wedge forward over line 
  wb_ : wedge backward over line 
  bd_ : broad over line 

  <-30,!8,!,60,90`8,
  @(2~si_,4~wf_,6~wb_,8~bd_)/Me`2
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Change bond length}
\subsubsection{Chain length}
\begin{verbatim}
  (!,!n)`length : change length of !,!n

  <30,!2,!2`1.2,!2

  ** !2`1.2 : '`1.2,!2
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\begin{verbatim}
``length : change all bond length after

  <30,!2,``1.2,!4
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Ring length}
\begin{verbatim}
  ?n`length : change ring length

  ?6,4\,?6`1.2
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\newpage
\subsection{Change atom}
\subsubsection{Insert atom}
\begin{verbatim}
  Insert hetero atom

  <30,!2,O,!2,N,!2
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Addressed atom}
\begin{verbatim}
  2:O : change A2 C to O
  @(3,5)N : change  A3,A5 C to N

  <30,!6,2:O,@(3,5)N
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Brock address}
\begin{verbatim}
  | : divide brock

  ?6,4\,|,?6,2:O
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\begin{verbatim}
  || : reset brock adress

  ?6,4\,|,?6,||,2:N
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Absolute address}
\begin{verbatim}
  #2:N : change A#2 C to N
  ** #n : (1<=n<=3095)

  ?6,4\,|,?6,#2:N
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Relative address}
\begin{verbatim}
  -2:N : change A(-2) C to N
  ** -n : (1<=n<=999)

  ?6,4\,?6,-2:N
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Fuse ring}
\subsubsection{Attached 1 bond}
\begin{verbatim}
  ?6,3=?6 : fuse ?6 at B3
  ** Bn(n:-999<=n<=4095): bond number

  ?6,3=?6
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\begin{verbatim}
  ** fused ring size depend on 
  attached bond length

  ?6,4\,?6`1.2,5=?6,11=?6
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\begin{verbatim}
  ?6,3=?6[13] : fuse ?6[13] at B3
  ?6[13]: 6 membered ring scaled 13/10
  ** ?m[n] (5<=m<=8,11<=n<=15)

  ?6,3=?6[13]
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\begin{verbatim}
  ?6,$(-3,-4,-4,-2,-2,-4,-4)?6
  ?6,$(4,8,13,20,25,28,33)?6
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Attached 2 bond}
\begin{verbatim}
  (4,11)=?6[4]  : fuse 4/6 ring to B11..B4
  (4,11)=?5[3]  : fuse 3/5 ring to B11..B4
  (4,11)=?4[2]  : fuse 2/4 ring to B11..B4
  ** ?m[n] (4<=m<=6,n=m-2)

  MCd(1,.7)(  0,0)(<30,?6,3=?6,(11,4)=?6[4])
  MCd(1,.6)(.54,1)(<30,?6,3=?6,(11,4)=?5[3])
  MCd(1,.6)(  1,0)(<30,?6,3=?6,(11,4)=?4[2])
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Attached 3 bond}
\begin{verbatim}
  (16,4)=?6[3] : fuse 3/6 ring to B16..B4
  (16,4)=?5[2] : fuse 2/5 ring to B16..B4
  ** ?m[n] (5<=m<=6,n=m-3)

  MCd(1,.55)(0,0)(?6,$(3,10)?6,(16,4)=?6[3])
  MCd(1,.55)(1,0)(?6,$(3,10)?6,(16,4)=?5[2])
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Attached 4 bond}
\begin{verbatim}
  (21,4)=?6[2] : fuse 2/6 ring to B21..B4

  MCf(<-30,?6,$(3,10,15)?6,(21,4)=?6[2])

  ** ?m[n] (m=6,n=2)
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Spiro ring}
\begin{verbatim}
  4*,?5 : add ?5(5 membered ring) at A4

  <30,!6,4*,?5

  An* : jump to An
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Substituent}
\subsubsection{Insert substituent}
\begin{verbatim}
  <30,!,/Me,!,/Et,!3,/Pr,!,/iPr,
      !3,/tBu,!,/Ph^-30,!

  ** Me:methyl Et:ethyl
     Pr:propyl iPr:isopropyl
     tBu:tertial buthyl Ph:phenyl
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Insert modified substituent}
\begin{verbatim}
  /  : single
  // : double
  */ : wedge forward
  /* : wedge dotted forward
  ** : direct

  <30,!,//O,!,/*H,!,*/H,!,/?3,!,**?3,!
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\begin{verbatim}
  ~ : change type
  ^ : change angle
  ` : change length
  > : change enviroment

  <30,``1,!,/Me~zf`2^30,!,/Me~zf`2^30,
   !2,*/Pr>lr,!2,*/Pr>rl,!)
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Add substituent}
\begin{verbatim}
  <-30,!17,2:/Me,4:/Et,6:/Pr,
   10:/iPr,14:/tBu,16:/Ph^-60
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Add modified substituent}
\begin{verbatim}
  ~,^,` : change type,angle,length

  <-30,!6,
  @(2~wf,4~zf,6^-30)/H
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\begin{verbatim}
  ^,`,> : change angle,length,environment

  <30,!7`1,
  3:/*Me`2^30,5:*/Pr>lr,7:*/Pr>rl
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Chain environment}
\subsubsection{Horizontal,vertical}
\begin{verbatim}
  >hz : horizontal enviroment (default)
  >vt : vertical enviroment

  ?4,@(3^-90,3^-30,3^90)/'(!3,"{hz}")>hz,
     @(1^-60,1`2,1^60)/'(!2,"{vt}")>vt
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Left-right,right-left}
\begin{verbatim}
  >lr : left-right enviroment
  >rl : right-left enviroment

  <30,!6,
  @(3^-30,3,3^30)/'(!3,"{lr}")>lr,
  @(5^-30,5,5^30)/'(!3,"{rl}")>rl
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Fixed angle,multi angle}
\begin{verbatim}
  >45 : fixed angle enviroment
  >'(-90,90,-90) : multi angle enviroment

  <-30,!6,@(2>45)/'(!3,"{45}"),
  @(6>'(-90,90,-90))/'(!3,"{(-90,90,-90)}")
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Miscellaneous}
%-----------------------------------------------------------------------------
\subsubsection{Change atom and Substituent}
\begin{verbatim}
  NH,SO,SOO :
   inset hetero atom and substituent
   simultaneously

  <30,!2,NH,!,SO,!,SOO,!3
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Change color}
\begin{verbatim}
  @(5)green : change color of A5 green
  $(3)red :   change color of B3 red
  **  METAFONT ignore color command

  <30,Ph,@(2,5)N,2:red,5:blue,3=green
\end{verbatim}
%%%%\MCFstructure   % for Metafont
\includegraphics{mcf_man_soc-060.eps}%  for dvipdfmx
\advance\fontnum\@ne\relax\advance\tempnum\@ne\relax%
%-----------------------------------------------------------------------------
\subsubsection{Make block}
\begin{verbatim}
  { : start brock
  } : end brock

  <30,!2,{,``1.2,!2,},!2
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Chain start multiple characters}
\begin{verbatim}
  if chain start multi charactor string,
  use !0 instead of !

  MCf(<30,COOH,!0,!3,COOH)
\end{verbatim}
\MCFstructure
\begin{verbatim}
  MCf(<30,COOH,!4,COOH)
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{User definition}
\begin{verbatim}
  iBuOH : user defined substructure

 iBuOH:='(!,/Me,!,OH)
 MCf(<30,?6,@(4,6)/iBuOH)
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Inline definition}
\begin{verbatim}
  Insert user defined substructure
 
  <30,!3,/'(!,/Me,!,OH),!3
\end{verbatim}
\MCFstructure
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newpage
\section{Option parameter}
%------------------------------------------------------------------------------
\subsection{Size parameter}
\subsubsection{Font size}
\begin{verbatim}
  beginfont("EN:Caffeine")
    font_wd#:=30mm#;  %<==font width
    font_ht#:=20mm#;  %<==font height
    MCf(<30,?6,-4=?5,$(3,8)dl,@(2,6,7,9)N,
       @(2,6,9)/Me,@(1,5)//O)  endfont
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Margin left and right}
\begin{verbatim}
 default: margin_left_right=0.4mm
\end{verbatim}
\MCFstructure
\begin{picture}(12,20)
\put(1,14){\makebox(10,6)[r]{\tt 0mm}}
\put(1, 7){\makebox(10,6)[r]{\tt 0.4mm}}
\put(1, 0){\makebox(10,6)[r]{\tt 5mm}}
\end{picture}
%-----------------------------------------------------------------------------
\subsubsection{Margin top and bottom}
\begin{verbatim}
 default: margin_top_bottom=0.4mm
\end{verbatim}
\MCFstructure\\
\figex{20mm}{0mm}{0.4mm}{5mm}
%-----------------------------------------------------------------------------
\subsubsection{Offset thickness of bond}
\begin{verbatim}
  default: offset_thickness#=0.2pt#
\end{verbatim}
\MCFstructure\\
\figex{20mm}{0pt}{0.2pt}{0.5pt}
%-----------------------------------------------------------------------------
\subsubsection{Offset of doublebond gap}
\begin{verbatim}
  default: offset_bond_gap#=0.3pt#
\end{verbatim}
\MCFstructure\\
\figex{20mm}{0.0pt}{0.3pt}{1.0pt}
%-----------------------------------------------------------------------------
\subsubsection{Offset of atom width}
\begin{verbatim}
  default: offset_atom#=0.8pt#
\end{verbatim}
\MCFstructure\\
\figex{20mm}{0.0pt}{0.8pt}{2.0pt}
%-----------------------------------------------------------------------------
\subsubsection{Offset of wedge width}
\begin{verbatim}
  default:  offset_wedge#=0.4pt#
\end{verbatim}
\MCFstructure\\
\figex{20mm}{0.0pt}{0.4pt}{1.0pt}
%-----------------------------------------------------------------------------
\subsubsection{Max bond length}
\begin{verbatim}
  default:  max_bond_length#=10mm#
\end{verbatim}
\MCFstructure\\
\figex{18mm}{6mm}{8mm}{20mm}
%-----------------------------------------------------------------------------
\subsection{Ratio parameter}
%-----------------------------------------------------------------------------
\subsubsection{Thickness/bond length}
\begin{verbatim}
  default:  ratio_thickness_bond=0.015
\end{verbatim}
\MCFstructure\\
\figex{20mm}{0.005}{0.015}{0.030}
%-----------------------------------------------------------------------------
\subsubsection{Char/bond thickness}
\begin{verbatim}
  default:  ratio_char_bond=1.5
\end{verbatim}
\MCFstructure\\
\figex{20mm}{1.0}{1.5}{2.0}
%-----------------------------------------------------------------------------
\subsubsection{Bondgap/bond length}
\begin{verbatim}
  default:  ratio_bondgap_bond= 0.15
\end{verbatim}
\MCFstructure\\
\figex{20mm}{0.10}{0.15}{0.20}
%-----------------------------------------------------------------------------
\subsubsection{Atom/bond length}
\begin{verbatim}
  default:  ratio_atom_bond= 0.36
\end{verbatim}
\MCFstructure\\
\figex{20mm}{0.25}{0.36}{0.46}
%-----------------------------------------------------------------------------
\subsubsection{Wedge/bond length}
\begin{verbatim}
  default:  ratio_wedge_bond=0.12
\end{verbatim}
\MCFstructure\\
\figex{20mm}{0.10}{0.12}{0.20}
%-----------------------------------------------------------------------------
\subsubsection{Font atom gap/atom length}
\begin{verbatim}
  default:  ratio_atomgap_atom= 0.050
\end{verbatim}
\MCFstructure\\
\figex{20mm}{0.0}{0.050}{0.12}
%-----------------------------------------------------------------------------
\subsubsection{Chain/ring length}
\begin{verbatim}
  default:  ratio_chain_ring= 0.66
\end{verbatim}
\MCFstructure\\
\figex{20mm}{0.4}{0.65}{1.0}
%-----------------------------------------------------------------------------
\subsubsection{Zebra gap/bond length}
\begin{verbatim}
  default:  ratio_zebragap_bond=0.12
\end{verbatim}
\MCFstructure\\
\figex{20mm}{0.06}{0.12}{0.20}
%-----------------------------------------------------------------------------
\subsection{Drawing mode}
%-----------------------------------------------------------------------------
\subsubsection{Numbering atom}
\begin{verbatim}
  numberA_start:=3; numberA_end:=8;
  default: sw_numberA=0 :
    numberA_start=1 numberA_end=4095
\end{verbatim}
\MCFstructure
\begin{picture}(5,20)
\put(0,14){\makebox[5mm]{\tt 1}}
\put(0, 8){\makebox[5mm]{\tt 2}}
\put(0, 2){\makebox[5mm]{\tt 3}}
\end{picture}
%-----------------------------------------------------------------------------
\subsubsection{Numbering bond}
\begin{verbatim}
  numberB_start:=3; numberB_end:=8;
  default: sw_numberB=0 :
    numberB_start=1 numberB_end=4095
\end{verbatim}
\MCFstructure
\begin{picture}(5,20)
\put(0,14){\makebox[5mm]{\tt 1}}
\put(0, 8){\makebox[5mm]{\tt 2}}
\put(0, 2){\makebox[5mm]{\tt 3}}
\end{picture}
%-----------------------------------------------------------------------------
\subsubsection{Solid mode}
\begin{verbatim}
  MCd(1,1)(0,.5)(Ph,4:/Me)
  sw_solid:=1;
  bond_len#:=6mm#;
  MCd(1,1)(1,.5)(Ph,4:/Me)
\end{verbatim}
\MCFstructure\\
\makebox[5mm]{}%
\makebox[30mm]{\tt 0 :default}%
\makebox[30mm]{\tt 1}%
%-----------------------------------------------------------------------------
\subsubsection{Expand mode}
\begin{verbatim}
  MCd(1,.5)(0,0.5)(<30,Ph,4:/COOH,3:/NH2)
  sw_expand:=1;
  MCd(1,.5)(1,0.5)(<30,Ph,4:/COOH,3:/NH2)
\end{verbatim}
\MCFstructure\\
\makebox[5mm]{}%
\makebox[30mm]{\tt 0 :default}%
\makebox[30mm]{\tt 1}%
%-----------------------------------------------------------------------------
\subsubsection{Substituent off mode}
\begin{verbatim}
  MCd(1,.5)( 0,0.5)(<30,Ph,4:/Cl,3:/F)
  sw_subst_off:=1;
  MCd(1,.5)( 1,0.5)(<30,Ph,4:/Cl,3:/F)
\end{verbatim}
\MCFstructure\\
\makebox[5mm]{}%
\makebox[30mm]{\tt 0 :default}%
\makebox[30mm]{\tt 1}%
%-----------------------------------------------------------------------------
\subsubsection{Single bond mode}
\begin{verbatim}
  MCd(1,.5)( 0,0.5)(<30,Ph,4:/Cl,3:/F)
  sw_bond_single:=1;
  MCd(1,.5)( 1,0.5)(<30,Ph,4:/Cl,3:/F)
\end{verbatim}
\MCFstructure\\
\makebox[5mm]{}%
\makebox[30mm]{\tt 0 :default}%
\makebox[30mm]{\tt 1}%
%-----------------------------------------------------------------------------
\subsection{Frame,vector}
%-----------------------------------------------------------------------------
\subsubsection{Start vector}
\begin{verbatim}
  MCf(<30,Ph,4:/Cl,3:/F)
  sw_start_vector:=1;
  MCf(<30,Ph,4:/Cl,3:/F)
\end{verbatim}
\MCFstructure\\
\makebox[5mm]{}%
\makebox[30mm]{\tt 0 :default}%
\makebox[30mm]{\tt 1}%
%-----------------------------------------------------------------------------
\subsubsection{Font frame}
\begin{verbatim}
  sw_font_frame=0 : no frame  **default
  sw_font_frame=1 : draw frame of font
  sw_font_frame=2 : draw frame inside margin
  sw_font_frame=3 : draw both

  sw_font_frame:=3;
  margin_left_right:=5mm;
  margin_top_bottom:=2mm;
  MCf(<30,Ph,4:/Cl,3:/F)
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Molecular frame}
\begin{verbatim}
  sw_mol_frame:=1;
  MCd(1,.5)(1,0.5)(<30,Ph,4:/Cl,3:/F)
  ** default: sw_mol_frame=0
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsubsection{Atom frame}
\begin{verbatim}
  sw_atom_frame:=1;
  MCf(<30,Ph,1:/Cl,4:/COOH,3:/OH)
  ** default: sw_atom_frame=0
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Clipping font}
\begin{verbatim}
  beginfont()
  sw_clip:=0;
  MCf(<30,Ph,4:/Cl,3:/F) endfont
  ** default: sw_clip=0
\end{verbatim}
\MCFstructure
\begin{verbatim}
  beginfont()
  sw_clip:=1;
  MCf(<30,Ph,4:/Cl,3:/F) endfont
\end{verbatim}
\MCFstructure
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newpage
\section{MCF draw function}
\subsection{Function MCd (draw)}
\begin{verbatim}
  MCd(a,b)(c,d)(...)
    a: ratio molecular width/font width
    b: ratio molecular hight/font hight
    c: x axis position
    d: y axis position

  MCd(1,0.8)(0.2,0.9)(<30,Ph,3:/F,4:/Cl)
  MCd(1,0.8)(0.8,0.1)(<30,Ph,3:/F,4:/Cl)
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Function MCf (fit draw)}
\begin{verbatim}
  MCf(...) : MCd(1,1)(0.5,0.5)(...)

  sw_font_frame:=1;
  sw_mol_frame:=1;
  MCf(<30,Ph,3:/F,4:/Cl)
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Local setting}
\begin{verbatim}
  beginfont() MCd(1,.4)(0,.5)(Ph) endfont
  beginfont()
    ratio_thickness_bond:=0.05;
    MCd(1,.4)(0.5,.5)(Ph)
  endfont
  beginfont() MCd(1,.4)(1,.5)(Ph) endfont
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Global setting}
\begin{verbatim}
  ratio_thickness_bond:=0.05;
  beginfont() MCd(1,.4)( 0,.5)(Ph) endfont
  beginfont() MCd(1,.4)(.5,.5)(Ph) endfont
  beginfont() MCd(1,.4)( 1,.5)(Ph) endfont
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Output molecular information}
\begin{verbatim}
var3:="calc_weight";  tag3:="cMW";
var4:="calc_formula"; tag4:="cFM";
%% Output to mcf_man_soc-info.aux %%
..... ;C:85;cMW:194.19174;cFM:C8H10N4O2

cMW:calculated molecular weight
cFM:calculated molecular formula
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Output additional information}
\begin{verbatim}
beginfont("EN:Tocopherol","CAS:59-02-9")
  MCf(...) endfont

%% Output to mcf_man_soc-info.aux %%
F:mcf_man_soc;C:86;EN:Tocopherol;CAS:59-02-9

*F:filename *C:char number EN:molecular name
CAS:CAS number *:default output
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Change aux information delimiter}
\begin{verbatim}
aux_delimiter:="/";
beginfont("EN:Ampicillin","CAS:69-53-4")
  MCf(...) endfont

%% Output to mcf_man_soc-info.aux %%
F:mcf_man_soc/C:90/EN:Ampicillin/CAS:69-53-4

  **default  aux_delimiter=";"
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Fixed aux information}
\begin{verbatim}
  tag3:="NO"; var3:="inf_NO";
  tag4:="EN"; var4:="inf_EN";
  sw_auxfix:=1; auxtag_out;
  beginfont("EN:Cholesterol","NO:1")
  ..... endfont

  %% Output to mcf_man_soc-info.aux %%
  F;C;NO;EN
  mcf_man_soc;91;1;Ampicillin
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\newpage
\section{MCF example}
\subsection{Warfarin}
\begin{verbatim}
  <30,Ph,3=?6,8=dl,
  10:O,7:/OH,9://O,
  8\,/Ph`1,60,!,//O,!
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Limonin}
\begin{verbatim}
 <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)/Me,
  @(1^60,5^180,16^60)/*H,
  14\*,|,?5,$(1,4)dl,3:O
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Sesamine}
\begin{verbatim}
 <54,?5,1=?5,
 @(4,7)O,@(1^-54,2^54)*/H,
 #5*\^-12,Ph,|,-3=?5,@(-1,-3)O,
 #8*\^-12,Ph,|,-3=?5,@(-1,-3)O
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Colchicine}
\begin{verbatim}
  <30,Ph,@(1,2,6)/OMe,
  -4=?7,-5=?7,
  $(-1,-4,-6)dl,-2://O,-3:/OH,
  9\,NH,!,//O,!
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Lycorine}
\begin{verbatim}
  <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
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Gibberellin}
\begin{verbatim}
  <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://Me,13:*/OH,8:/*OH,
  14:*/Me,@(1^60,4^60)*/H
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Quinine}
\begin{verbatim}
  <30,Ph,3=Ph,7:N,6:/OMe,
   10\,*/OH,/H~zf^-60,!,
   |,?6,2:N,1:*/H^60,
   4*\,!~dr,
   2*,165~zf,60,&5~zb
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Atoropin}
\begin{verbatim}
  <-30,O,!,//O,!,!,Ph,
  #1\~zb^-120,
  |,?7,6*\^190`1.02,N,/Me,&3~wb,
  #3\~wv,!,OH
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Rotenone}
\begin{verbatim}
  <-60,?5,$(-3,-2,-3,-4)?6,
  $(7,9,-2,-4)dl,$(3,17)dr,
  @(2,13,16)O,10://O,@(11^-60,12^60)*/H,
  @(-2,-3)/OMe,1*\,/Me,!~dl
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Pyrethrin I}
\begin{verbatim}
  <30,?3,@(3^35~wf,3^-35~zf)/Me,
  1*\,!~dl,iPr,2\*,//O,!,O,-36~zb,|,
  ?5,-2=d,-1:/Me,-3://O,-2\,!4,$(-1,-3)dl
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Validamycin}
\begin{verbatim}
  <30,?6,@(5,6)/OH,3\,-60,OH,
  #4\,O,-60,|,?6,2:O,@(3,4,5,6)/OH,
  #1\,NH,!,|,?6,2=d,@(4,5,6)/OH,-4\,!,OH
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Paclitaxel}
\begin{verbatim}
  ?6,5=d,3*,{,``1,36,45,45,45,45,},&#5,
  -4=?6,-4=?4,-1=wb,-3=wf,-1:O,||,
  @(4^35,4^-35,6)/Me,@(3^-60,15)*/OH,
  8:/*H^-60,9:*/Me^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
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\onecolumn%
\section{Example to use mcf2graph}
\subsection{Molecular definition file}
\begin{verbatim}
%-------------------------------------------------------------------------
input mcf2graph.mf;                               % input macro
%-------------------------------------------------------------------------
sw_auxout:=1;         % aux(information) file output on > Gloval setting
font_wd#:=60mm#;      % font width                      > 
font_ht#:=40mm#;      % font height                     >
var3:="cal_MW"; tag3:="cMW";                            > AUX file table
var4:="cal_FM"; tag4:="cFM";                            >
outputformat:="png"; hppp:=vppp:=0.1;                   > PNG output
outputtemplate:="%j-%3c.png";                           >
%-------------------------------------------------------------------------
beginfont("NO:1","EN:Ampicillin")                 > begin font(information)
  MCf(<45,?4,2:N,2=?5,-1:S,                             > begin MCF (1)
     @(3^45,4^-45)/*H,1://O^15,5:/*COOH^-18,            >
     @(6^35,6^-35)/Me,                                  >
     4\^75,NH,!,//O,!,/*NH,!,Ph)                        > end MCF 
endfont                                                 > end font
%------------------------------------------------------------------------
beginfont("NO:2","EN:Cholesterol")                > begin font(information)
  MCf(<30,?6,$(-4,-2)?6,-4=?5,7=dl,                     > begin MCF (2)
      1:*/OH,@(4,12)*/Me^60,9:*/H^60,                   >
      10:/*H^180,@(11,-1)/*H^-60,                       >
      -1\^17,/*Me,!4,/Me,!)                             > end MCF
endfont                                                 > end font
%------------------------------------------------------------------------
bye
\end{verbatim}
%------------------------------------------------------------------------
\noindent%
\subsection{Information auxfile output}
\paragraph{(Insert option parameter setting)}
\begin{verbatim}
  sw_auxout:=1;
  ** default : sw_auxout=0
\end{verbatim}
\paragraph{(Command line)}
\begin{verbatim}
  >mpost -s ahangle=0 FILENAME (molecular difinition file)
\end{verbatim}
\paragraph{(Output)}
\begin{verbatim}
(sw_auxfix=0)
F:mcf_man_soc;C:109;cMW:349.40462;cFM:C16H19N3O4S;EN:Ampicillin
F:mcf_man_soc;C:110;cMW:386.6532;cFM:C27H46O;EN:Cholesterol
  .....................................................
  .....................................................

(sw_auxfix=1)
F;C;cMW;cFM;EN
mcf_man_soc;90;349.40462;C16H19N3O4S;Ampicillin
mcf_man_soc;91;386.6532;C27H46O;Cholesterol
  ......................................
  ......................................

( tag : variable )
F : filename   C : char number   NO : serial number   EN : english name
cMW : molecular weight calculated   cFM : molecular formula calculated
MW  : molecular weight from literature data
\end{verbatim}
%------------------------------------------------------------------------
\newpage
\noindent%
\subsection{Checklist output}
\paragraph{(Insert option parameter setting)}
\begin{verbatim}
  sw_checklist:=1;
  ** default : sw_checklist=0
\end{verbatim}
\paragraph{(Command line)}
\begin{verbatim}
  >mpost -s ahangle=0 -s ahlength=2 FILENAME (molecular difinition file)
\end{verbatim}
\paragraph{(Output)}
\begin{verbatim}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Molecular name = Caffeine
%  There were   0 warnings / Expanded command count= 75
%  width * height = 39.54677 * 36.84769
%  Shift width * height  = -9.33592 * -12.77518
%  Bond length = 9.23628   Atom size   = 4.12209
%  Atom count= 14 Bond count= 15 Ring count=  2 Hide H = 10
%-----------------------------------< atom >< bond >-------
%    1  (         0 ) (         0 )  C           4
%    2  (   0.86603 ) (      -0.5 )  N           3
%    3  (   1.73206 ) (         0 )  C           4
%    4  (   1.73206 ) (         1 )  C           4
%    5  (   0.86603 ) (       1.5 )  C           4
%    6  (         0 ) (         1 )  N           3
%    7  (    2.6831 ) (  -0.30902 )  N           3
%    8  (   3.27089 ) (       0.5 )  C           3
%    9  (    2.6831 ) (   1.30902 )  N           3
%   10  (   0.86603 ) (  -1.38315 )  C           1
%   11  (  -0.78764 ) (   1.45474 )  C           1
%   12  (   2.95923 ) (   2.15886 )  C           1
%   13  (  -0.78764 ) (  -0.45474 )  O           2
%   14  (   0.86603 ) (   2.38315 )  O           2
%Bond list---------------------------------------------------------
%   1   1 ->   2 (  1)
%   2   2 ->   3 (  1)
%   3   3 ->   4 (  2)
%   4   4 ->   5 (  1)
%   5   5 ->   6 (  1)
%   6   6 ->   1 (  1)
%   7   3 ->   7 (  1)
%   8   7 ->   8 (  2)
%   9   8 ->   9 (  1)
%  10   9 ->   4 (  1)
%  11   2 ->  10 (  1)
%  12   6 ->  11 (  1)
%  13   9 ->  12 (  1)
%  14   1 ->  13 (  2)
%  15   5 ->  14 (  2)
%Fomula / Molecular weight ---------------------------------------
% C   (  12.0107) *      8 =     96.08557
% H   (  1.00793) *     10 =     10.07935
% N   (  14.0067) *      4 =      56.0268
% O   (  15.9994) *      2 =     31.99881
% Weight  Calc:  194.19052 / Input: 194.19 / weight gap= 0.00052
% Fomula  Calc: C8H10N4O2 / Input: C8H10N4O2 / MACTCH
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{verbatim}%
\newpage
%------------------------------------------------------------------------
\noindent%
\subsection{Molfile output}
\paragraph{(Insert option parameter setting)}
\begin{verbatim}
  sw_MOLout:=1;
  ** default : sw_MOLout=0
\end{verbatim}
\paragraph{(Command line)}
\begin{verbatim}
  >mpost -s ahangle=3  FILENAME (molecular difinition file)
\end{verbatim}
\paragraph{(Output)}
\begin{verbatim}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  -MCFtoMOL- EN:Caffeine         

 14 15  0  0  0  0  0  0  0  0999 V2000
         0         0         0 C   0  0  0  0
   0.86603      -0.5         0 N   0  0  0  0
   1.73206         0         0 C   0  0  0  0
   1.73206         1         0 C   0  0  0  0
   0.86603       1.5         0 C   0  0  0  0
         0         1         0 N   0  0  0  0
    2.6831  -0.30902         0 N   0  0  0  0
   3.27089       0.5         0 C   0  0  0  0
    2.6831   1.30902         0 N   0  0  0  0
   0.86603  -1.36383         0 C   0  0  0  0
  -0.76894   1.44394         0 C   0  0  0  0
  -0.76894  -0.44394         0 O   0  0  0  0
   0.86603   2.36383         0 O   0  0  0  0
   2.95299    2.1396         0 C   0  0  0  0
  1  2  1  0     0  0
  2  3  1  0     0  0
  3  4  2  0     0  0
  4  5  1  0     0  0
  5  6  1  0     0  0
  6  1  1  0     0  0
  3  7  1  0     0  0
  7  8  2  0     0  0
  8  9  1  0     0  0
  9  4  1  0     0  0
  2 10  1  0     0  0
  6 11  1  0     0  0
  1 12  2  0     0  0
  5 13  2  0     0  0
  9 14  1  0     0  0
M  END
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{verbatim}%
\newpage
%----------------------------------------------------------------------------
\subsection{\LaTeX file example}
%############################################################################
\begin{verbatim}
%--------------------------------------------------------------------
\documentclass[a4paper]{article}
\usepackage{graphicx}
\pagestyle{empty}
\makeatletter%
%--------------------------------------------------------------------
\def\@F{F}\def\@C{C}\def\@EN{EN}\def\@NO{NO}\def\@MW{MW}\def\@FMc{FMc}%
\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\@EN\edef\MOLnameE{\@var}\fi%
  \ifx\@tag\@NO\edef\MOLnum{\@var}\fi
  \ifx\@tag\@MW\edef\CALmw{\@var}\fi
  \ifx\@tag\@FMc\edef\CALfm{\@var}\fi
\fi}%
\def\put@char{%
  \begin{picture}(84,42)%
     \put(0,38){\bf [\MOLnum]\MOLnameE{ }\small\tt/FM:\CALfm/MW:\CALmw}%
     \put(10,0){\font\@strufont=\MOLfile\relax%
               \hbox{\@strufont\char\MOLchar}}%
  \end{picture}%
\def\INFO#1{\@for\@temp:=#1\do{\mol@sel\@temp}\put@char}%
\makeatother
%--------------------------------------------------------------------
\begin{document}
\unitlength=1mm%
\INFO{F:mcf_man_soc,C:103,NO:1,cMW:349.40462,cFM:C16H19N3O4S,EN:Ampicillin}%
\INFO{F:mcf_man_soc,C:104,NO:2,cMW:386.6532,cFM:C27H46O,EN:Cholesterol}%
\end{document}
%--------------------------------------------------------------------
\end{verbatim}%
%############################################################################
%------------------------------------------------------------------------
\INFO{F:mcf_man_soc,C:103,NO:1,cMW:349.40462,cFM:C16H19N3O4S,EN:Ampicillin}%
\INFO{F:mcf_man_soc,C:104,NO:2,cMW:386.6532,cFM:C27H46O,EN:Cholesterol}%
%------------------------------------------------------------------------
\end{document}
