% pdflatex \documentclass[a4paper]{article} \oddsidemargin=-.2in \voffset=-1.0in \parindent=0pt \usepackage[utf8x]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage[a4paper]{geometry} \input cprotect-other.tex %For the example of the footnote. \input Tcode_C.tex \input Tutils-fastfonts-1.tex %Commenting out this line should not change the output. %Remove the stretch and shrink of spaces, and the extra space inserted after e.g. a full stop. %A fixed-wdith font should not have those wider spaces. \TcodeHook\exP{\the\TcodeHook\frenchspacing} \CPreParenDefaultMacro %Suppose that unrecognized words preceding a ( are macros %The other options are None (the default) and Function \begin{document} Some inline code: \ncode{if(x>y*y) test=true; else test=false;}. %\ident can be used in place of \ncode for single identifiers. It is faster. The header {\tt stddef.h} defines the macro \ident{NULL}, the type \ident{size_t} and other identifiers. \begin{Code} #include #include /* ... */ char *weekday, *month; // pointers to strings int day, hour, min; fprintf(stdout, "%s, %s %d, %.2d:%.2d\n", weekday, month, day, hour, min); fprintf(stdout, "pi = %.5f\n", 4 * atan(1.0)); \end{Code} \CodeFramewd=0pt \DefColor{bkgcolor}{.9, .9, .92} \CsnippetColor \def\CsnippetBkg{bkgcolor} { \MakeWord{uint}{Typedef} \MakeWord{Hel2Dg}{Typedef} \MakeWord{Hel2Dg_pp}{Function} Using \fcode{}{\\cprotect} to protect a displayed snippet in the argument to \fcode{}{\\footnote}.% \cprotect\footnote{The following two declarations are equivalent: \begin{Code}\MakeWord{f}{Function} float f (float *v, int n); float f(float v[], int n); \end{Code} } \begin{Code} #define exfordown(n,third,lineid) exfordownex(n,third,lineid) #define exfordownex(n,third,lineid) for(uint fordown_id##lineid=n; \ fordown_id##lineid-- >=1;third) #define dontimes(n,third) exfordown(n,third,__LINE__) Hel2Dg Hel2Dg_pp(const Puntoxy(double)* points1, const Puntoxy(double)* points2, uint n){ Hel2Dg T; const Puntoxy(double) *ptr1, *ptr2; double rr1,rr2, c,s; T.cg1.y=T.cg1.x=0; T.cg2.y=T.cg2.x=0; ptr1=points1; ptr2=points2; dontimes(n,){ T.cg1.x+=ptr1->x; T.cg1.y+=ptr1->y; ptr1++; T.cg2.x+=ptr2->x; T.cg2.y+=ptr2->y; ptr2++; } {double aux=1.0/n; T.cg1.x*=aux; T.cg1.y*=aux; T.cg2.x*=aux; T.cg2.y*=aux;} rr2=rr1=0; s=c=0; ptr1=points1; ptr2=points2; dontimes(n,){ double x1,y1,x2,y2; x1=ptr1->x-T.cg1.x; y1=ptr1->y-T.cg1.y; ptr1++; x2=ptr2->x-T.cg2.x; y2=ptr2->y-T.cg2.y; ptr2++; rr1+=x1*x1+y1*y1; rr2+=x2*x2+y2*y2; c+=x1*x2+y1*y2; s+=x1*y2-y1*x2; } T.esc=sqrt(rr2/rr1); {double r=1/sqrt(c*c+s*s); T.cosg=c*r; T.sing=s*r;} return T; } #undef exfordown #undef exfordownex #undef dontimes \end{Code} } \end{document} .