I am sending the program and a sample input file. Please save this message into a file and cut out the two portions. Then compile the program using a regular C compiler (It is not in ANSI C). Then run a.out < input.file > output.tex Process the file output.tex using latex which should generate a output.dvi file. If you have a postscript file, you can print the dvi file using the command dvips. The output should consist of two pages, one with the clues and blank grid and the next page with the solution. The input file has the following format: (must be square) each in the range (0..grid_size-1) You only need to describe half the grid, the program enforces a 180 degree rotational symmetry in the grid Sentinel (-1 -1) to signify end of black square coordinates Words that fit the grid (solution), If you need to omit some words from the solution, you may replace the word with the appropriate number of dots. I added this feature to enable me to progressively fill in the grid when trying to compile a crossword Finally type in the clues, in the order they appear -- across and then down. BTW, the sample input file was copied from a Sunday edition of Indian Express, an Indian daily. If you want to, you can mess with the output file and replace the solution with the solution of a previous crossword and also modify it so that everything fits on a page. To do this you need to format both grids in two column mode so that they fit on a page. mtr ------------------- cut here -------------------------------------- /************************************************************************/ /* Crossword formatting program */ /* */ /* Author: M. T. Raghunath mtr@cs.berkeley.edu */ /* */ /* Feel free to distribute, Don't send me bug reports, please fix them */ /* However, appreciatory notes may be sent :-) */ /************************************************************************/ #include #define MAX_G_SIZE 21 #define MAX_G_SIZE_SQ MAX_G_SIZE * MAX_G_SIZE #define MAX_CLUE_LENGTH 256 #define BLANK 0 #define BLACK -1 #define TRUE -1 #define FALSE 0 int grid[MAX_G_SIZE][MAX_G_SIZE]; char def_scale[30] = "15pt"; int grid_size; char sol[MAX_G_SIZE][MAX_G_SIZE]; main() { int across_list[MAX_G_SIZE_SQ]; int across_length[MAX_G_SIZE_SQ]; int down_list[MAX_G_SIZE_SQ]; int down_length[MAX_G_SIZE_SQ]; int loci[MAX_G_SIZE_SQ]; int locj[MAX_G_SIZE_SQ]; int i, j; int count; int bx, by; int a_ptr, d_ptr; int next_num; for (i=0; i MAX_G_SIZE)) { printf("grid size %d out of range\n",grid_size); exit(0); } scanf("%d %d",&bx, &by); while((bx >= 0) && (by >= 0)) { if ((bx >= grid_size) || (by >= grid_size)) { fprintf(stderr,"black square out of range %d %d\n",bx, by); continue; } grid[bx][by] = BLACK; grid[grid_size-bx-1][grid_size-by-1] = BLACK; /* Enforce symmetry */ scanf("%d %d",&bx, &by); } next_num = 1; a_ptr = d_ptr = 0; for (i=0; i 0) { char clue[MAX_CLUE_LENGTH]; printf("\\item[%d.] ",across_list[a_ptr]); gets(clue); while (blank_line(clue)) gets(clue); printf("%s\n",clue); a_ptr++; } printf("\\end{itemize}\n\n"); printf("\\noindent{DOWN}\n"); printf("\\begin{itemize}\n"); d_ptr = 0; while (down_list[d_ptr] > 0) { char clue[MAX_CLUE_LENGTH]; printf("\\item[%d.] ",down_list[d_ptr]); gets(clue); while (blank_line(clue)) gets(clue); printf("%s\n",clue); d_ptr++; } printf("\\end{itemize}\n\n"); printf("}\n\n"); printf("\\newpage\n\n"); printf("\\twocolumn[\n"); printf("\\begin{center}\n"); printf("Crossword Solution\n"); printf("\\end{center}\n"); printf("\\setlength{\\unitlength}{%s}\n",def_scale); printf("\\begin{center}\n"); printf("\\begin{picture}(%d,%d)\n",grid_size, grid_size); for (i=0; i= grid_size) || (j < 0) || (j >= grid_size)) return(TRUE); if (grid[i][j] == BLACK) return(TRUE); else return(FALSE); } blank_line(s) char *s; { while ((*s == ' ') || (*s == '\t')) s++; if ((*s == '\n') || (*s == '\0')) return(TRUE); return(FALSE); } ------------------------------- cut here ----------------------------- 15 0 12 0 14 1 1 1 3 1 5 1 7 1 9 1 10 2 10 2 12 2 14 3 1 3 3 3 5 3 7 3 9 4 4 4 10 4 12 4 14 5 1 5 3 5 5 5 6 5 7 5 9 6 11 6 12 6 14 7 1 7 3 7 5 7 7 7 9 7 11 7 13 -1 -1 MATTEROFFACT UPAS SCANDALOUS SCRAP INTO ORATE INTER ECONOMICAID REPRESENTED COBRA BRASS ECHO CLASS .......... ANTI CLOTHESHORSE MISSILES TRACTION EDDY OILER FRUITCAKE TUSCAN MANATEE MOIRA IDLER IMPORTANT STICKLER ADVOCATE HOTLINE RUSTIC SPARE ITCH Lacking in imagination, it's true (6,2,4) Raised as a source of poison (4) A little science and a tortured soul giving offense (10) Science standard raised a bit (5) A preposition at the end of a station, for example (4) Bring the speech to an elaborate conclusion (5) Colourful character with no old man to bury (5) Cheapest means of getting a reputation for helpfulness? (8,3) Acted for the vendor who had taken ill (11) It may strike out A, B or C perhaps (5) It is comparatively bold (5) What you might hear from the men of Harlech on the march? (4) An order form, perhaps (5) Thanks for speechifying girl --- lets have a dance (10) Not favouring the shaking of a tin (4) On which you may give your jodhpurs an airing (7--5) Avoid tortuous lies could be fatal (8) Pulling right back before the battle (8) A boy naturally opposed to the current trend (4) Vessel carrying fuel from Loire (5) What a nutty thing to eat (5--4) Unions able to comprehend classical order (6) The sea-creature, covered in hair, was having a meal (7) The doctor orders a change of air an achievement for her (5) Badly riled, he's not keen to work (5) Meaning worker to be of some consequence (9) Tickles around making insistent demands (8) Urge to become a spokesman for the defence (8) Those best selling cakes providing a summit link (3,4) Citrus out of the country (6) Extra quarter to trim off (5) Having a feeling of irritation (4)