aboutsummaryrefslogtreecommitdiffhomepage
path: root/libslang/doc/tm/fixtex.sl
blob: 787eb91b305b6c189f4066ee6bfd5651be464074 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
!if (is_defined ("__argv"))
{
   message ("You need a newer version of jed to run this script");
   quit_jed ();
}

if (__argc != 4)
{
   message ("Usage: jed -script fixtex.sl <filename>");
   quit_jed ();
}

variable file = __argv[3];
() = read_file (file);

% Patch up the >,< signs
bob ();
replace ("$<$", "<");
replace ("$>$", ">");

% It appears that sgml2tex screws up _for in section titles, producing \_{for}.
replace ("ion\\_{", "ion{\\_");

% Make the first chapter a preface
bob ();
if (bol_fsearch ("\\chapter{Preface}"))
{
   push_spot ();
   push_mark ();
   go_right (8); insert ("*");	       %  \chapter{ --> \chapter*{
   () = bol_fsearch ("\\chapter{");
   push_spot ();

   insert("\\tableofcontents\n");
   eol ();
   insert ("\n\\pagenumbering{arabic}");

   pop_spot ();
   narrow ();
   bob ();
   replace ("\\section{", "\\section*{");
   widen ();

   if (bol_bsearch ("\\tableofcontents"))
     delete_line ();
   
   pop_spot ();
   if (bol_bsearch ("\\maketitle"))
     insert ("\\pagenumbering{roman}\n");

}

save_buffer ();
quit_jed ();