Chromatograms

From ConTeXt wiki

< Sample documents

The \Chromato macro is an example application for the positioning environment. I've written it for my brother, who is writing a thesis in Chemistry.

\newdimen\Width \newdimen\Height
\define[3]\Chromato{%
  \setbox\scratchbox\hbox{\externalfigure[#1][width=0.6\makeupwidth]}%
  \setuppositioning[unit=pt] \Width=\wd\scratchbox \Height=\ht\scratchbox
  \placefigure[][fig:#1]{#2}{\startpositioning
    \position(0,0){\externalfigure[#1][width=0.6\makeupwidth]}#3%
  \stoppositioning}}
\define[3]\LRposition{\edef\YPos{\withoutpt{\the\dimexpr(\withoutpt{%
        \the\dimexpr(#1pt/100)}\Height - 0.1\baselineskip)}}%
  \position(#2,\YPos){\vbox to 2pt{\vss{\hbox to 0pt{#3}\vss}}}}
\define[4]\Lbrace{\LRposition{#1}0{\hss\rotate[rotation=90]{%
      $\overbrace{\hskip#2\Height}^{\rotate[rotation=270]{#4}}$}\hskip#3em}}
\define[4]\Rbrace{\LRposition{#1}{\withoutpt{\the\Width}}{\hskip#3em
    \rotate[rotation=270]{$\overbrace{\hskip#2\Height}^{%
        \rotate[rotation=90]{#4}}$}\hss}}
\define[2]\Lpfeil{\LRposition{#1}0{\hss{\tx#2} $\rightarrow$}}
\define[2]\Rpfeil{\LRposition{#1}{\withoutpt{\the\Width}}{$\leftarrow$ \tx#2}}
\define[3]\Oposition{\edef\XPos{\withoutpt{\the\dimexpr(\withoutpt{%
      \the\dimexpr(#1pt/100)}\Width)}}%
    \position(\XPos,-\withoutpt{\the\dimexpr(#2\baselineskip)}){%
    \hbox to 0pt{\hss#3\hss}}}
\define[2]\Oben{\Oposition{#1}{0.8}{\tx#2}}
\define[3]\Obrace{\Oposition{#1}{2.5}{$\overbrace{\hskip#2\Width}^{\hbox{#3}}$}}

\starttext
\Chromato{ecolizeit}{Expression der rekombinanten Fucosyltransferase~V in
  {\it E.~coli}.}{%
\Oben5{BRS} \Oben{15}1 \Oben{26}2 \Oben{38}3 \Oben{50}4
\Oben{61}5 \Oben{72}6 \Oben{83}7 \Oben{94}8
\Obrace{49}{0.68}{\tx1--7}
\Lpfeil{12}{97\,kDa} \Lpfeil{20}{66\,kDA}
\Lpfeil{32}{45\,kDa} \Lpfeil{52}{31\,kDa}
\Lbrace{40}{0.8}{4}A \Lbrace{90}{0.2}{0.1}B
\Rpfeil{29}{FucT~V} \Rpfeil{87}{FucT~V}
\Rpfeil{40}1 \Rpfeil{80}2 \Rbrace{60}{0.4}3{\txx1--2}}
\stoptext

(A downloadable version of the macro is also available.)

The resulting figure looks like this, though you'll have to imagine the graphic. The output with the graphic included can be downloaded here, in pdf form.

You can download the chromato module from http://pmrb.free.fr/work/OS/ConTeXt/