tableOfContents[notebook_]:= Module[{headerTypes,nb,header,headerCells, tagHeaders},(*Cell types to include in ToC*) headerTypes="Subsection"|"Section"; (*Find cells of the desired type and tag with their names*) nb=Import[notebook]; headerCells=Cases[nb,Cell[_,headerTypes,___],Infinity]; tagHeaders=Map[Append[#,CellTags->#[[1]]]&,headerCells]; (*Export tagged cells*) Export[notebook, ReplaceAll[nb, Normal[AssociationThread[headerCells,tagHeaders]]]]; (*Generate styled hyperlinks for ToC*) Map[If[MatchQ[#[[2]],"Section"], Hyperlink[ Style[#[[1]],RGBColor@{211/256,15/64,0}, FontFamily->"Arial",FontTracking->"Plain", FontSize->18],{notebook,#[[1]]}], Hyperlink[ Style["\t"<>#[[1]],RGBColor@{53/64,51/128,1/256}, FontFamily->"Arial",FontTracking->"Plain", FontSize->14],{notebook,#[[1]]}]]&,headerCells]// TableForm];
cell[color_,form_,style_String:"Text", font_String:"Comic Sans MS",size_Integer:15]:= NotebookWrite[EvaluationCell[], Cell[BoxData[FormBox["",form]],style, CellFrame->{{0.5,0.5},{1.5,0.5}},FontSize->size, FontFamily->font,FontWeight->"Plain", Background-> RGBColor[ Sequence@@(color/.ColorSetter:>List/.RGBColor:>List// Flatten)]],All]; ccell=cell[ColorSetter[GrayLevel[1]],TraditionalForm,"Text", "Times New Roman",15]//Defer csmyellowcell:= cell[RGBColor[1.,1.,0.5019607843137255],TraditionalForm,"Text", "Comic Sans MS",15]; csmgreencell:= cell[LightGreen,TraditionalForm,"Text","Comic Sans MS",15];
tnryellowcell:= cell[RGBColor[1.,1.,0.5019607843137255],TraditionalForm,"Text", "Times New Roman",15];
tnrwhitecell:= cell[White,TraditionalForm,"Text","Times New Roman",15]; tnrgreencell:= cell[LightGreen,TraditionalForm,"Text","Times New Roman",15]; tnrgraycell:= cell[RGBColor[236/255,236/255,236/255],TraditionalForm,"Text", "Times New Roman",15];
(*Assume the original function is fana(t)/fpole(t)*) funcomplexint[fana_,fpole_,t_]:=Module[{sol,poles,numpoles}, sol=Solve[fpole==0,t]; numpoles=Length[Flatten[sol]]; poles=t/.sol; Table[(fana*(t-poles[[i]])/fpole)/.{t->poles[[i]]},{i, numpoles}] ];