User:Sid

From Wiki
Jump to navigation Jump to search

I am a PhD student (in Physics) and using context to write my reports etc. This page documents some tips I find useful.

  • Plots using mpgraph. In following I plot a spectrum. In file raman-exmple.mp I have:

input graph; draw begingraph(8cm,6cm); glabel.lft(btex Raman Intensity (a.u.) etex rotated 90, OUT); glabel.bot(btex Raman Shift ($\rm{cm}^{-1}$) etex, OUT); glabel.urt(btex D etex, 1390, 320); setrange(1200, -10, 2800, whatever); for x=1300,1800,2300,2800: otick.bot(textext(decimal x), x); endfor; gdraw "raman-example.d"; autogrid(,otick.lft); endgraph; end


raman-example.d has data in two columns whose range on x-axis is 1200-2800 etc. Third glabel statement puts a label 'D' at specified location. You can customise the tics as shown (for x=1300...).

To process use:

texexec --mpstatic raman-example.mp

which generates raman-example.pdf

This can be included in a .tex file as:

\placefigure [here] [fig:carbon-spectrum] {The spectrum of disordered carbon}

   {\externalfigure[raman-example.pdf][width=\textwidth]}