figure in reciprocal.tex

Manipulate[
DynamicModule[{(*x, e1, e2,*) f1, f2, xe, xf, o, r, s, ao, to, esub, esuper, bold, proj, rproj},
o = {0, 0} ;
ao = {0,.15} ;
s = 0.3 ;

to[start_, end_, ss_ :s] =  start + (end-start)(1 + ss/Norm[end-start]) ;

bold = Style[ #, Bold] &;
esub = Subscript[bold["x"], #] &;
esuper = Superscript[bold["x"], #] &;
proj = Row[{"(", bold["a"], "·", esuper[#], ")", esub[#]}] &;
rproj = Row[{"(", bold["a"], "·", esub[#], ")", esuper[#]}] &;

r= Inverse[{ e1, e2} ];
f1 = Part[r, All, 1] ;
f2 = Part[r, All, 2] ;

xf = {x . f1, x . f2 } ;
xe = {x . e1, x . e2 } ;

Graphics[{
Thick
, Arrow[{o, x}, ao]

(*Path along x_a coordinates to x*)
,Darker[Blue]
, Arrow[{o, xe[[1]] f1}, ao]
, Arrow[{xe[[1]] f1, xe[[1]] f1 + xe[[2]] f2}, ao]
, Text[ rproj[1], to[o,xe[[1]]  f1/2 ]  ,Background->White]
, Text[ rproj[2], to[o, xe[[1]]  f1 +  xe[[2]] f2 /2 ],Background->White]

(*Path along x^a coordinates to x*)
,Darker[Purple]
, Arrow[{o, xf[[1]] e1}, ao]
, Arrow[{xf[[1]] e1, xf[[1]] e1 + xf[[2]] e2}, ao]
, Text[ proj[1], to[o,xf[[1]]  e1 /2],Background->White]
, Text[ proj[2], to[o,xf[[1]] e1 +xf[[2]]e2 /2] +{0.5,0},Background->White]


(*e^1, e^2*)
, Darker[Red]
, Arrow[{o,  f1}, ao]
, Arrow[{xe[[1]] f1, xe[[1]] f1 +  f2}, ao]
, Text[ esuper[1],  to[o, f1 ],Background->White]
, Text[ esuper[2],  to[xe[[1]] f1,xe[[1]] f1+  f2 ] ,Background->White]
, Arrow[{o2,  o2+f1}, ao]
, Arrow[{o2,o2 +  f2}, ao]
, Text[ esuper[1],  to[o2,o2+f1 ],Background->White]
, Text[ esuper[2],  to[o2,o2+ f2 ] ,Background->White]


(*e_1, e_2*)
,Darker[Green]
, Arrow[{o,  e1}, ao]
, Arrow[{xf[[1]] e1, xf[[1]] e1 + e2}, ao]
, Text[ esub[1], to[o,e1 ],Background->White]
, Text[ esub[2], to[xf[[1]] e1, xf[[1]] e1 +e2],Background->White]
, Arrow[{o2,  o2+e1}, ao]
, Arrow[{o2, o2 + e2}, ao]
, Text[ esub[1], to[o2,o2+e1 ],Background->White]
, Text[ esub[2], to[o2, o2+e2],Background->White]


, Black
,PointSize[Large]
, Point[x]
, Text[bold["a"],to[o,x, 2s ],Background->White]

, Opacity[0.1]
, Brown // Lighter
, Parallelogram[ o2,{e1,f2}]
,Brown // Darker
, Parallelogram[ o2,{e2,f1}]

}
, Frame->True
, GridLines->Automatic
, GridLinesStyle->Directive[Orange,Dashed]
,BaseStyle->14 (* this changes the font, making it bigger *)
]

] 
, {{x,{4,2}},Locator}
, {{e1,{1,1}},Locator}
, {{e2,{1, 2}},Locator}
, {{o2,{8,2}},Locator}
]

(*first iteration, without subplot*)
(*sn3 =DynamicModule[{e1={1,1},e2={1,2},x={4,2}},DynamicModule[{f1,f2,xe,xf,o,r,s,ao,to,esub,esuper,bold,proj,rproj},o={0,0};ao={0,0.15`};s=0.3`;to[start_,end_,ss_:s]=start+(end-start) (1+(ss/(Norm[end-start])));bold=Style[#1,Bold]&;esub=(Subscript[bold["e"], #1])&;esuper=(Superscript[bold["e"], #1])&;proj=Row[{"(",bold["x"],"·",esuper[#1],")",esub[#1]}]&;rproj=Row[{"(",bold["x"],"·",esub[#1],")",esuper[#1]}]&;r=Inverse[{e1,e2}];f1=r[[All,1]];f2=r[[All,2]];xf={x.f1,x.f2};xe={x.e1,x.e2};Graphics[{Thick,Arrow[{o,x},ao],Darker[Blue],Arrow[{o,xe[[1]] f1},ao],Arrow[{xe[[1]] f1,xe[[1]] f1+xe[[2]] f2},ao],Darker[Purple],Arrow[{o,xf[[1]] e1},ao],Arrow[{xf[[1]] e1,xf[[1]] e1+xf[[2]] e2},ao],Darker[Red],Arrow[{o,f1},ao],Arrow[{xe[[1]] f1,xe[[1]] f1+f2},ao],Darker[Green],Arrow[{o,e1},ao],Arrow[{xf[[1]] e1,xf[[1]] e1+e2},ao],Black,PointSize[Large],Point[x],Text[bold["x"],to[o,x,2 s],Background->White],Text[esub[1],to[o,e1],Background->White],Text[esub[2],to[xf[[1]] e1,xf[[1]] e1+e2],Background->White],Text[esuper[1],to[o,f1],Background->White],Text[esuper[2],to[xe[[1]] f1,xe[[1]] f1+f2],Background->White],Text[rproj[1],to[o,(1/2) xe[[1]] f1],Background->White],Text[rproj[2],to[o,xe[[1]] f1+(1/2) xe[[2]] f2],Background->White],Text[proj[1],to[o,(1/2) xf[[1]] e1],Background->White],Text[proj[2],to[o,xf[[1]] e1+(1/2) xf[[2]] e2]+{0.5`,0},Background->White]},Frame->True,GridLines->Automatic,GridLinesStyle->Directive[Orange,Dashed],BaseStyle->14]]]*)

sn3 = DynamicModule[{e1={1,1},e2={1,2},o2={8,2},x={4,2}},DynamicModule[{f1,f2,xe,xf,o,r,s,ao,to,esub,esuper,bold,proj,rproj},o={0,0};ao={0,0.15`};s=0.3`;to[start_,end_,ss_:s]=start+(end-start) (1+(ss/(Norm[end-start])));bold=Style[#1,Bold]&;esub=(Subscript[bold["x"], #1])&;esuper=(Superscript[bold["x"], #1])&;proj=Row[{"(",bold["a"],"·",esuper[#1],")",esub[#1]}]&;rproj=Row[{"(",bold["a"],"·",esub[#1],")",esuper[#1]}]&;r=Inverse[{e1,e2}];f1=r[[All,1]];f2=r[[All,2]];xf={x.f1,x.f2};xe={x.e1,x.e2};Graphics[{Thick,Arrow[{o,x},ao],Darker[Blue],Arrow[{o,xe[[1]] f1},ao],Arrow[{xe[[1]] f1,xe[[1]] f1+xe[[2]] f2},ao],Text[rproj[1],to[o,(1/2) xe[[1]] f1],Background->White],Text[rproj[2],to[o,xe[[1]] f1+(1/2) xe[[2]] f2],Background->White],Darker[Purple],Arrow[{o,xf[[1]] e1},ao],Arrow[{xf[[1]] e1,xf[[1]] e1+xf[[2]] e2},ao],Text[proj[1],to[o,(1/2) xf[[1]] e1],Background->White],Text[proj[2],to[o,xf[[1]] e1+(1/2) xf[[2]] e2]+{0.5`,0},Background->White],Darker[Red],Arrow[{o,f1},ao],Arrow[{xe[[1]] f1,xe[[1]] f1+f2},ao],Text[esuper[1],to[o,f1],Background->White],Text[esuper[2],to[xe[[1]] f1,xe[[1]] f1+f2],Background->White],Arrow[{o2,o2+f1},ao],Arrow[{o2,o2+f2},ao],Text[esuper[1],to[o2,o2+f1],Background->White],Text[esuper[2],to[o2,o2+f2],Background->White],Darker[Green],Arrow[{o,e1},ao],Arrow[{xf[[1]] e1,xf[[1]] e1+e2},ao],Text[esub[1],to[o,e1],Background->White],Text[esub[2],to[xf[[1]] e1,xf[[1]] e1+e2],Background->White],Arrow[{o2,o2+e1},ao],Arrow[{o2,o2+e2},ao],Text[esub[1],to[o2,o2+e1],Background->White],Text[esub[2],to[o2,o2+e2],Background->White],Black,PointSize[Large],Point[x],Text[bold["a"],to[o,x,2 s],Background->White],Opacity[0.1`],Lighter[Brown],Parallelogram[o2,{e1,f2}],Darker[Brown],Parallelogram[o2,{e2,f1}]},Frame->True,GridLines->Automatic,GridLinesStyle->Directive[Orange,Dashed],BaseStyle->14]]]

peeters`exportForLatex["obliqueReciprocalFig2", sn3]