xsize=10
ysize=8
size xsize ysize

pt=0.0352777778 ! 1 postscript point

fs=12*pt  !font size
tt=4*pt   !tick length
lw=0.5*pt !line width
glw=2*lw  !graph line width
ms=4*pt   !marker size

! graph settings
xmn=0
xmx=20
xticks=5
xsubticks=1
ymn=-15
ymx=20
yticks=10
ysubticks=5

set lwidth lw
set hei fs
set just tl

! funky LaTeX commands
begin texpreamble
    % set fonts used for text and maths to Palatino
    \usepackage{mathpazo}
    \renewcommand{\familydefault}{ppl}
    \usepackage{upgreek}
end texpreamble

! set the normal font to AvantGarde-Demi, which is really obviously
! different to Palatino, so you can spot it if you forget to wrap
! text in \tex{}
set font psagd 


! user stuff

madelung = 1.747564595 ! http://oeis.org/A085469/constant
width = 0.5

amove 0 0
begin graph
 size xsize ysize
 scale auto
 nobox
 
 xtitle "\tex{$R$ ($a/2$)}"
 xaxis min xmn max xmx dticks xticks dsubticks xsubticks
 xaxis format "fix 0 prepend \tex{$ append $}"
 xticks length tt
 
 ytitle "\tex{$M$}" dist 0.001
 yaxis min ymn max ymx dticks yticks dsubticks ysubticks
 yaxis format "fix 0 prepend \tex{$ append $}"
 yticks length tt
 
 y2labels color rgb255(255,13,13)
 y2places madelung
 y2names \tex{$1.748$}
 y2axis angle 0

 data NaCl-cube.tsv d3=c1,c2
 data NaCl-sphere.tsv d2=c1,c2
 
 d3 steps lstyle 1 lwidth glw/2 color rgb255(255,13,13)
 d2 steps lstyle 1 lwidth glw/4 color rgb255(48,80,248)

 let d10 = madelung-width/2 from 0 to 20
 let d11 = madelung+width/2 from 0 to 20
 fill d10,d11 color rgb255(255,206,206)
end graph

amove 2.2 6.5
set color rgb255(48,80,248)
text \tex{sphere}

amove 1.25 3
set color rgb255(255,13,13)
begin rotate 90
 text \tex{cube}
end rotate