1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Utilities for Latex conversion.
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
33 * Variables accessible from clients
37 TexChunk
* DocumentTitle
= NULL
;
38 TexChunk
* DocumentAuthor
= NULL
;
39 TexChunk
* DocumentDate
= NULL
;
41 // Header/footers/pagestyle
42 TexChunk
* LeftHeaderEven
= NULL
;
43 TexChunk
* LeftFooterEven
= NULL
;
44 TexChunk
* CentreHeaderEven
= NULL
;
45 TexChunk
* CentreFooterEven
= NULL
;
46 TexChunk
* RightHeaderEven
= NULL
;
47 TexChunk
* RightFooterEven
= NULL
;
48 TexChunk
* LeftHeaderOdd
= NULL
;
49 TexChunk
* LeftFooterOdd
= NULL
;
50 TexChunk
* CentreHeaderOdd
= NULL
;
51 TexChunk
* CentreFooterOdd
= NULL
;
52 TexChunk
* RightHeaderOdd
= NULL
;
53 TexChunk
* RightFooterOdd
= NULL
;
54 char * PageStyle
= copystring("plain");
56 int DocumentStyle
= LATEX_REPORT
;
57 int MinorDocumentStyle
= 0;
58 wxPathList TexPathList
;
59 char * BibliographyStyleString
= copystring("plain");
60 char * DocumentStyleString
= copystring("report");
61 char * MinorDocumentStyleString
= NULL
;
76 * USER-ADJUSTABLE SETTINGS
81 int chapterFont
= 12; // LARGEFont3;
82 int sectionFont
= 12; // LargeFont2;
83 int subsectionFont
= 12; // largeFont1;
84 int titleFont
= LARGEFont3
;
85 int authorFont
= LargeFont2
;
86 int mirrorMargins
= TRUE
;
87 bool winHelp
= FALSE
; // Output in Windows Help format if TRUE, linear otherwise
88 bool isInteractive
= FALSE
;
89 bool runTwice
= FALSE
;
90 int convertMode
= TEX_RTF
;
91 bool headerRule
= FALSE
;
92 bool footerRule
= FALSE
;
93 bool compatibilityMode
= FALSE
; // If TRUE, maximum Latex compatibility
94 // (Quality of RTF generation deteriorate)
95 bool generateHPJ
; // Generate WinHelp Help Project file
96 char *winHelpTitle
= NULL
; // Windows Help title
97 int defaultTableColumnWidth
= 2000;
99 int labelIndentTab
= 18; // From left indent to item label (points)
100 int itemIndentTab
= 40; // From left indent to item (points)
102 bool useUpButton
= TRUE
;
103 int htmlBrowseButtons
= HTML_BUTTONS_TEXT
;
105 bool truncateFilenames
= FALSE
; // Truncate for DOS
106 int winHelpVersion
= 3; // WinHelp Version (3 for Windows 3.1, 4 for Win95)
107 bool winHelpContents
= FALSE
; // Generate .cnt file for WinHelp 4
108 bool htmlIndex
= FALSE
; // Generate .htx file for HTML
109 bool htmlFrameContents
= FALSE
; // Use frames for HTML contents page
110 bool useHeadingStyles
= TRUE
; // Insert \s1, s2 etc.
111 bool useWord
= TRUE
; // Insert proper Word table of contents, etc etc
112 int contentsDepth
= 4; // Depth of Word table of contents
113 bool indexSubsections
= TRUE
; // Index subsections in linear RTF
114 // Linear RTF method of including bitmaps. Can be "includepicture", "hex"
115 char *bitmapMethod
= copystring("includepicture");
116 bool upperCaseNames
= FALSE
;
117 // HTML background and text colours
118 char *backgroundImageString
= NULL
;
119 char *backgroundColourString
= copystring("255;255;255");
120 char *textColourString
= NULL
;
121 char *linkColourString
= NULL
;
122 char *followedLinkColourString
= NULL
;
123 bool combineSubSections
= FALSE
;
124 bool htmlWorkshopFiles
= FALSE
;
127 * International support
130 // Names to help with internationalisation
131 char *ContentsNameString
= copystring("Contents");
132 char *AbstractNameString
= copystring("Abstract");
133 char *GlossaryNameString
= copystring("Glossary");
134 char *ReferencesNameString
= copystring("References");
135 char *FiguresNameString
= copystring("List of Figures");
136 char *TablesNameString
= copystring("List of Tables");
137 char *FigureNameString
= copystring("Figure");
138 char *TableNameString
= copystring("Table");
139 char *IndexNameString
= copystring("Index");
140 char *ChapterNameString
= copystring("chapter");
141 char *SectionNameString
= copystring("section");
142 char *SubsectionNameString
= copystring("subsection");
143 char *SubsubsectionNameString
= copystring("subsubsection");
144 char *UpNameString
= copystring("Up");
153 int subsectionNo
= 0;
154 int subsubsectionNo
= 0;
163 FILE *CurrentOutput1
= NULL
;
164 FILE *CurrentOutput2
= NULL
;
168 int CurrentInputIndex
= 0;
170 char *TexFileRoot
= NULL
;
171 char *TexBibName
= NULL
; // Bibliography output file name
172 char *TexTmpBibName
= NULL
; // Temporary bibliography output file name
173 bool isSync
= FALSE
; // If TRUE, should not yield to other processes.
174 bool stopRunning
= FALSE
; // If TRUE, should abort.
176 static int currentColumn
= 0;
177 char *currentArgData
= NULL
;
178 bool haveArgData
= FALSE
; // If TRUE, we're simulating the data.
179 TexChunk
*currentArgument
= NULL
;
180 TexChunk
*nextChunk
= NULL
;
181 bool isArgOptional
= FALSE
;
184 TexChunk
*TopLevel
= NULL
;
185 // wxList MacroDefs(wxKEY_STRING);
186 wxHashTable
MacroDefs(wxKEY_STRING
);
187 wxStringList IgnorableInputFiles
; // Ignorable \input files, e.g. psbox.tex
188 char *BigBuffer
= NULL
; // For reading in large chunks of text
189 TexMacroDef
*SoloBlockDef
= NULL
;
190 TexMacroDef
*VerbatimMacroDef
= NULL
;
192 #define IncrementLineNumber() LineNumbers[CurrentInputIndex] ++
194 void TexOutput(char *s
, bool ordinaryText
)
198 // Update current column, but only if we're guaranteed to
199 // be ordinary text (not mark-up stuff)
202 for (i
= 0; i
< len
; i
++)
204 if (s
[i
] == 13 || s
[i
] == 10)
211 fprintf(CurrentOutput1
, "%s", s
);
213 fprintf(CurrentOutput2
, "%s", s
);
217 * Try to find a Latex macro, in one of the following forms:
218 * (1) \begin{} ... \end{}
219 * (2) \macroname{arg1}...{argn}
223 void ForbidWarning(TexMacroDef
*def
)
226 switch (def
->forbidden
)
230 sprintf(buf
, "Warning: it is recommended that command %s is not used.", def
->name
);
234 case FORBID_ABSOLUTELY
:
236 sprintf(buf
, "Error: command %s cannot be used and will lead to errors.", def
->name
);
245 TexMacroDef
*MatchMacro(char *buffer
, int *pos
, char **env
, bool *parseToBrace
)
247 *parseToBrace
= TRUE
;
249 TexMacroDef
*def
= NULL
;
252 // First, try to find begin{thing}
253 if (strncmp(buffer
+i
, "begin{", 6) == 0)
258 while ((isalpha(buffer
[j
]) || buffer
[j
] == '*') && ((j
- i
) < 39))
260 macroBuf
[j
-i
] = buffer
[j
];
264 def
= (TexMacroDef
*)MacroDefs
.Get(macroBuf
);
268 *pos
= j
+ 1; // BUGBUG Should this be + 1???
276 // Failed, so try to find macro from definition list
279 // First try getting a one-character macro, but ONLY
280 // if these TWO characters are not both alphabetical (could
281 // be a longer macro)
282 if (!(isalpha(buffer
[i
]) && isalpha(buffer
[i
+1])))
284 macroBuf
[0] = buffer
[i
];
287 def
= (TexMacroDef
*)MacroDefs
.Get(macroBuf
);
293 while ((isalpha(buffer
[j
]) || buffer
[j
] == '*') && ((j
- i
) < 39))
295 macroBuf
[j
-i
] = buffer
[j
];
299 def
= (TexMacroDef
*)MacroDefs
.Get(macroBuf
);
306 // We want to check whether this is a space-consuming macro
308 // No brace, e.g. \input thing.tex instead of \input{thing};
309 // or a numeric argument, such as \parindent0pt
310 if ((def
->no_args
> 0) && ((buffer
[i
] == 32) || (buffer
[i
] == '=') || (isdigit(buffer
[i
]))))
312 if ((buffer
[i
] == 32) || (buffer
[i
] == '='))
315 *parseToBrace
= FALSE
;
324 void EatWhiteSpace(char *buffer
, int *pos
)
326 int len
= strlen(buffer
);
328 bool keepGoing
= TRUE
;
329 bool moreLines
= TRUE
;
330 while ((j
< len
) && keepGoing
&&
331 (buffer
[j
] == 10 || buffer
[j
] == 13 || buffer
[j
] == ' ' || buffer
[j
] == 9))
338 moreLines
= read_a_line(buffer
);
339 len
= strlen(buffer
);
349 bool FindEndEnvironment(char *buffer
, int *pos
, char *env
)
353 // Try to find end{thing}
354 if ((strncmp(buffer
+i
, "end{", 4) == 0) &&
355 (strncmp(buffer
+i
+4, env
, strlen(env
)) == 0))
357 *pos
= i
+ 5 + strlen(env
);
363 bool readingVerbatim
= FALSE
;
364 bool readInVerbatim
= FALSE
; // Within a verbatim, but not nec. verbatiminput
366 // Switched this off because e.g. \verb${$ causes it to fail. There is no
367 // detection of \verb yet.
368 #define CHECK_BRACES 0
370 unsigned long leftCurly
= 0;
371 unsigned long rightCurly
= 0;
372 static wxString currentFileName
= "";
374 bool read_a_line(char *buf
)
376 if (CurrentInputIndex
< 0)
386 while (ch
!= EOF
&& ch
!= 10)
388 if (((i
== 14) && (strncmp(buf
, "\\end{verbatim}", 14) == 0)) ||
389 ((i
== 16) && (strncmp(buf
, "\\end{toocomplex}", 16) == 0)))
390 readInVerbatim
= FALSE
;
392 ch
= getc(Inputs
[CurrentInputIndex
]);
395 if (ch
== '{' && !readInVerbatim
)
397 if (ch
== '}' && !readInVerbatim
)
400 if (rightCurly
> leftCurly
)
403 errBuf
.Printf("An extra right Curly brace ('}') was detected at line %l inside file %s",LineNumbers
[CurrentInputIndex
], (const char*) currentFileName
.c_str());
404 OnError((char *)errBuf
.c_str());
406 // Reduce the count of right curly braces, so the mismatched count
407 // isn't reported on every line that has a '}' after the first mismatch
415 // Check for 2 consecutive newlines and replace with \par
416 if (ch
== 10 && !readInVerbatim
)
418 int ch1
= getc(Inputs
[CurrentInputIndex
]);
419 if ((ch1
== 10) || (ch1
== 13))
421 // Eliminate newline (10) following DOS linefeed
422 if (ch1
== 13) ch1
= getc(Inputs
[CurrentInputIndex
]);
424 IncrementLineNumber();
425 // strcat(buf, "\\par\n");
427 strcat(buf
, "\\par");
432 ungetc(ch1
, Inputs
[CurrentInputIndex
]);
440 // Convert embedded characters to RTF equivalents
454 case 0xf6:buf
[i
++]='o';break; // ö
455 case 0xe4:buf
[i
++]='a';break; // ä
456 case 0xfc:buf
[i
++]='u';break; // ü
457 case 0xd6:buf
[i
++]='O';break; // Ö
458 case 0xc4:buf
[i
++]='A';break; // Ä
459 case 0xdc:buf
[i
++]='U';break; // Ü
480 fclose(Inputs
[CurrentInputIndex
]);
481 Inputs
[CurrentInputIndex
] = NULL
;
482 if (CurrentInputIndex
> 0)
483 ch
= ' '; // No real end of file
484 CurrentInputIndex
--;
486 if (leftCurly
!= rightCurly
)
489 errBuf
.Printf("Curly braces do not match inside file %s\n%lu opens, %lu closes", (const char*) currentFileName
.c_str(),leftCurly
,rightCurly
);
490 OnError((char *)errBuf
.c_str());
497 readingVerbatim
= FALSE
;
498 readInVerbatim
= FALSE
;
499 strcat(buf
, "\\end{verbatim}\n");
504 IncrementLineNumber();
508 // Strip out comment environment
509 if (strncmp(buf
, "\\begin{comment}", 15) == 0)
511 while (strncmp(buf
, "\\end{comment}", 13) != 0)
513 return read_a_line(buf
);
515 // Read a verbatim input file as if it were a verbatim environment
516 else if (strncmp(buf
, "\\verbatiminput", 14) == 0)
519 char *fileName
= buf
+ wordLen
+ 1;
524 // thing}\par -- eliminate the \par!
525 if (strncmp((buf
+ strlen(buf
)-5), "\\par", 4) == 0)
531 if (buf
[j
-1] == '}') buf
[j
-1] = 0; // Ignore final brace
533 wxString actualFile
= TexPathList
.FindValidPath(fileName
);
534 currentFileName
= actualFile
;
535 if (actualFile
== "")
538 strcpy(errBuf
, "Could not find file: ");
539 strncat(errBuf
, fileName
, 100);
545 informStr
.Printf("Processing: %s",actualFile
.c_str());
546 OnInform((char *)informStr
.c_str());
547 CurrentInputIndex
++;
548 Inputs
[CurrentInputIndex
] = fopen(actualFile
, "r");
549 LineNumbers
[CurrentInputIndex
] = 1;
550 if (FileNames
[CurrentInputIndex
])
551 delete[] FileNames
[CurrentInputIndex
];
552 FileNames
[CurrentInputIndex
] = copystring(actualFile
);
554 if (!Inputs
[CurrentInputIndex
])
556 CurrentInputIndex
--;
557 OnError("Could not open verbatiminput file.");
561 readingVerbatim
= TRUE
;
562 readInVerbatim
= TRUE
;
563 strcpy(buf
, "\\begin{verbatim}\n");
569 else if (strncmp(buf
, "\\input", 6) == 0 || strncmp(buf
, "\\helpinput", 10) == 0 ||
570 strncmp(buf
, "\\include", 8) == 0)
573 if (strncmp(buf
, "\\input", 6) == 0)
576 if (strncmp(buf
, "\\include", 8) == 0)
581 char *fileName
= buf
+ wordLen
+ 1;
586 // \input{thing}\par -- eliminate the \par!
587 // if (strncmp((buf + strlen(buf)-5), "\\par", 4) == 0)
588 if (strncmp((buf
+ strlen(buf
)-4), "\\par", 4) == 0) // Bug fix 8/2/95 Ulrich Leodolter
595 if (buf
[j
-1] == '}') buf
[j
-1] = 0; // Ignore final brace
597 // Remove backslashes from name
598 wxString
fileNameStr(fileName
);
599 fileNameStr
.Replace("\\", "");
601 // Ignore some types of input files (e.g. macro definition files)
602 char *fileOnly
= FileNameFromPath((char*) (const char*) fileNameStr
);
603 currentFileName
= fileOnly
;
604 if (IgnorableInputFiles
.Member(fileOnly
))
605 return read_a_line(buf
);
607 wxString actualFile
= TexPathList
.FindValidPath(fileNameStr
);
608 if (actualFile
== "")
611 sprintf(buf2
, "%s.tex", (const char*) fileNameStr
);
612 actualFile
= TexPathList
.FindValidPath(buf2
);
614 currentFileName
= actualFile
;
616 if (actualFile
== "")
619 strcpy(errBuf
, "Could not find file: ");
620 strncat(errBuf
, fileName
, 100);
625 // Ensure that if this file includes another,
626 // then we look in the same directory as this one.
627 TexPathList
.EnsureFileAccessible(actualFile
);
630 informStr
.Printf("Processing: %s",actualFile
.c_str());
631 OnInform((char *)informStr
.c_str());
632 CurrentInputIndex
++;
633 Inputs
[CurrentInputIndex
] = fopen(actualFile
, "r");
634 LineNumbers
[CurrentInputIndex
] = 1;
635 if (FileNames
[CurrentInputIndex
])
636 delete[] FileNames
[CurrentInputIndex
];
637 FileNames
[CurrentInputIndex
] = copystring(actualFile
);
639 if (!Inputs
[CurrentInputIndex
])
642 sprintf(errBuf
, "Could not open include file %s", (const char*) actualFile
);
643 CurrentInputIndex
--;
647 bool succ
= read_a_line(buf
);
650 if (strncmp(buf
, "\\begin{verbatim}", 16) == 0 ||
651 strncmp(buf
, "\\begin{toocomplex}", 18) == 0)
652 readInVerbatim
= TRUE
;
653 else if (strncmp(buf
, "\\end{verbatim}", 14) == 0 ||
654 strncmp(buf
, "\\end{toocomplex}", 16) == 0)
655 readInVerbatim
= FALSE
;
658 if (ch
== EOF
&& leftCurly
!= rightCurly
)
661 errBuf
.Printf("Curly braces do not match inside file %s\n%lu opens, %lu closes", (const char*) currentFileName
.c_str(),leftCurly
,rightCurly
);
662 OnError((char *)errBuf
.c_str());
674 bool ParseNewCommand(char *buffer
, int *pos
)
676 if ((strncmp((buffer
+(*pos
)), "newcommand", 10) == 0) ||
677 (strncmp((buffer
+(*pos
)), "renewcommand", 12) == 0))
679 if (strncmp((buffer
+(*pos
)), "newcommand", 10) == 0)
684 char commandName
[100];
685 char commandValue
[1000];
688 while (buffer
[*pos
] != '}' && (buffer
[*pos
] != 0))
690 commandName
[i
] = buffer
[*pos
];
697 if (buffer
[*pos
] == '[')
700 noArgs
= (int)(buffer
[*pos
]) - 48;
701 *pos
+= 2; // read past argument and '['
707 char ch
= buffer
[*pos
];
718 if (!read_a_line(buffer
))
723 commandValue
[i
] = ch
;
729 CustomMacro
*macro
= new CustomMacro(commandName
, noArgs
, NULL
);
730 if (strlen(commandValue
) > 0)
731 macro
->macroBody
= copystring(commandValue
);
732 if (!CustomMacroList
.Find(commandName
))
734 CustomMacroList
.Append(commandName
, macro
);
735 AddMacroDef(ltCUSTOM_MACRO
, commandName
, noArgs
);
742 void MacroError(char *buffer
)
749 while (((ch
= buffer
[i
-1]) != '\n') && (ch
!= 0))
758 sprintf(errBuf
, "Could not find macro: %s at line %d, file %s",
759 macroBuf
, (int)(LineNumbers
[CurrentInputIndex
]-1), FileNames
[CurrentInputIndex
]);
765 * 'environment' specifies the name of the macro IFF if we're looking for the end
766 * of an environment, e.g. \end{itemize}. Otherwise it's NULL.
767 * 'parseToBrace' is TRUE if the argument should extend to the next right brace,
768 * e.g. in {\bf an argument} as opposed to \vskip 30pt
771 int ParseArg(TexChunk
*thisArg
, wxList
& children
, char *buffer
, int pos
, char *environment
, bool parseToBrace
, TexChunk
*customMacroArgs
)
774 if (stopRunning
) return pos
;
783 // Consume leading brace or square bracket, but ONLY if not following
784 // a space, because this could be e.g. {\large {\bf thing}} where {\bf thing}
785 // is the argument of \large AS WELL as being a block in its
789 if ((pos > 0) && (buffer[pos-1] != ' ') && buffer[pos] == '{')
793 if ((pos > 0) && (buffer[pos-1] != ' ') && (buffer[pos] == '[' || buffer[pos] == '('))
798 else if ((pos > 1) && (buffer[pos-1] != ' ') && (buffer[pos+1] == '[' || buffer[pos+1] == '('))
806 // If not parsing to brace, just read the next word
807 // (e.g. \vskip 20pt)
810 int ch
= buffer
[pos
];
811 while (!eof
&& ch
!= 13 && ch
!= 32 && ch
!= 10 &&
812 ch
!= 0 && ch
!= '{')
814 BigBuffer
[buf_ptr
] = ch
;
821 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_STRING
);
822 BigBuffer
[buf_ptr
] = 0;
824 chunk
->value
= copystring(BigBuffer
);
825 children
.Append((wxObject
*)chunk
);
832 len
= strlen(buffer
);
835 if (customMacroArgs
) return 0;
837 eof
= read_a_line(buffer
);
839 len
= strlen(buffer
);
840 // Check for verbatim (or toocomplex, which comes to the same thing)
841 if (strncmp(buffer
, "\\begin{verbatim}", 16) == 0 ||
842 strncmp(buffer
, "\\begin{toocomplex}", 18) == 0)
846 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_STRING
);
847 BigBuffer
[buf_ptr
] = 0;
849 chunk
->value
= copystring(BigBuffer
);
850 children
.Append((wxObject
*)chunk
);
855 eof
= read_a_line(buffer
);
856 while (!eof
&& (strncmp(buffer
, "\\end{verbatim}", 14) != 0) &&
857 (strncmp(buffer
, "\\end{toocomplex}", 16) != 0)
860 strcat(BigBuffer
, buffer
);
861 buf_ptr
+= strlen(buffer
);
862 eof
= read_a_line(buffer
);
864 eof
= read_a_line(buffer
);
867 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_MACRO
, VerbatimMacroDef
);
869 chunk
->macroId
= ltVERBATIM
;
870 TexChunk
*arg
= new TexChunk(CHUNK_TYPE_ARG
, VerbatimMacroDef
);
872 arg
->macroId
= ltVERBATIM
;
873 TexChunk
*str
= new TexChunk(CHUNK_TYPE_STRING
);
874 str
->value
= copystring(BigBuffer
);
876 children
.Append((wxObject
*)chunk
);
877 chunk
->children
.Append((wxObject
*)arg
);
878 arg
->children
.Append((wxObject
*)str
);
880 // Also want to include the following newline (is always a newline
881 // after a verbatim): EXCEPT in HTML
882 if (convertMode
!= TEX_HTML
)
884 TexMacroDef
*parDef
= (TexMacroDef
*)MacroDefs
.Get("\\");
885 TexChunk
*parChunk
= new TexChunk(CHUNK_TYPE_MACRO
, parDef
);
886 parChunk
->no_args
= 0;
887 parChunk
->macroId
= ltBACKSLASHCHAR
;
888 children
.Append((wxObject
*)parChunk
);
893 char ch
= buffer
[pos
];
894 // End of optional argument -- pretend it's right brace for simplicity
895 if (thisArg
->optional
&& (ch
== ']'))
901 case '}': // End of argument
905 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_STRING
);
906 BigBuffer
[buf_ptr
] = 0;
908 chunk
->value
= copystring(BigBuffer
);
909 children
.Append((wxObject
*)chunk
);
911 if (ch
== '}') pos
++;
917 if (buf_ptr
> 0) // Finish off the string we've read so far
919 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_STRING
);
920 BigBuffer
[buf_ptr
] = 0;
922 chunk
->value
= copystring(BigBuffer
);
923 children
.Append((wxObject
*)chunk
);
928 // Try matching \end{environment}
929 if (environment
&& FindEndEnvironment(buffer
, &pos
, environment
))
931 // Eliminate newline after an \end{} if possible
932 if (buffer
[pos
] == 13)
935 if (buffer
[pos
] == 10)
941 if (ParseNewCommand(buffer
, &pos
))
944 if (strncmp(buffer
+pos
, "special", 7) == 0)
957 int ch
= buffer
[pos
];
979 else if (ch
== '\\' && buffer
[pos
+1] == '}')
985 else if (ch
== '\\' && buffer
[pos
+1] == '{')
1000 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_MACRO
);
1002 chunk
->macroId
= ltSPECIAL
;
1003 TexMacroDef
*specialDef
= (TexMacroDef
*)MacroDefs
.Get("special");
1004 chunk
->def
= specialDef
;
1005 TexChunk
*arg
= new TexChunk(CHUNK_TYPE_ARG
, specialDef
);
1006 chunk
->children
.Append((wxObject
*)arg
);
1008 arg
->macroId
= chunk
->macroId
;
1010 // The value in the first argument.
1011 TexChunk
*argValue
= new TexChunk(CHUNK_TYPE_STRING
);
1012 arg
->children
.Append((wxObject
*)argValue
);
1014 argValue
->value
= copystring(wxBuffer
);
1016 children
.Append((wxObject
*)chunk
);
1018 else if (strncmp(buffer
+pos
, "verb", 4) == 0)
1021 if (buffer
[pos
] == '*')
1024 // Find the delimiter character
1025 int ch
= buffer
[pos
];
1027 // Now at start of verbatim text
1029 while ((buffer
[pos
] != ch
) && buffer
[pos
] != 0)
1031 char *val
= new char[pos
- j
+ 1];
1033 for (i
= j
; i
< pos
; i
++)
1035 val
[i
-j
] = buffer
[i
];
1041 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_MACRO
);
1043 chunk
->macroId
= ltVERB
;
1044 TexMacroDef
*verbDef
= (TexMacroDef
*)MacroDefs
.Get("verb");
1045 chunk
->def
= verbDef
;
1046 TexChunk
*arg
= new TexChunk(CHUNK_TYPE_ARG
, verbDef
);
1047 chunk
->children
.Append((wxObject
*)arg
);
1049 arg
->macroId
= chunk
->macroId
;
1051 // The value in the first argument.
1052 TexChunk
*argValue
= new TexChunk(CHUNK_TYPE_STRING
);
1053 arg
->children
.Append((wxObject
*)argValue
);
1055 argValue
->value
= val
;
1057 children
.Append((wxObject
*)chunk
);
1062 bool tmpParseToBrace
= TRUE
;
1063 TexMacroDef
*def
= MatchMacro(buffer
, &pos
, &env
, &tmpParseToBrace
);
1066 CustomMacro
*customMacro
= FindCustomMacro(def
->name
);
1068 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_MACRO
, def
);
1069 chunk
->no_args
= def
->no_args
;
1070 // chunk->name = copystring(def->name);
1071 chunk
->macroId
= def
->macroId
;
1074 children
.Append((wxObject
*)chunk
);
1076 // Eliminate newline after a \begin{} or a \\ if possible
1077 if (env
|| strcmp(def
->name
, "\\") == 0)
1078 if (buffer
[pos
] == 13)
1081 if (buffer
[pos
] == 10)
1085 pos
= ParseMacroBody(def
->name
, chunk
, chunk
->no_args
,
1086 buffer
, pos
, env
, tmpParseToBrace
, customMacroArgs
);
1088 // If custom macro, parse the body substituting the above found args.
1091 if (customMacro
->macroBody
)
1094 // strcpy(macroBuf, "{");
1095 strcpy(macroBuf
, customMacro
->macroBody
);
1096 strcat(macroBuf
, "}");
1097 ParseArg(thisArg
, children
, macroBuf
, 0, NULL
, TRUE
, chunk
);
1100 // delete chunk; // Might delete children
1105 MacroError(buffer
+pos
);
1110 // Parse constructs like {\bf thing} as if they were
1115 if (buffer
[pos
] == '\\')
1119 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_STRING
);
1120 BigBuffer
[buf_ptr
] = 0;
1122 chunk
->value
= copystring(BigBuffer
);
1123 children
.Append((wxObject
*)chunk
);
1128 bool tmpParseToBrace
;
1129 TexMacroDef
*def
= MatchMacro(buffer
, &pos
, &env
, &tmpParseToBrace
);
1132 CustomMacro
*customMacro
= FindCustomMacro(def
->name
);
1134 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_MACRO
, def
);
1135 chunk
->no_args
= def
->no_args
;
1136 // chunk->name = copystring(def->name);
1137 chunk
->macroId
= def
->macroId
;
1139 children
.Append((wxObject
*)chunk
);
1141 pos
= ParseMacroBody(def
->name
, chunk
, chunk
->no_args
,
1142 buffer
, pos
, NULL
, TRUE
, customMacroArgs
);
1144 // If custom macro, parse the body substituting the above found args.
1147 if (customMacro
->macroBody
)
1150 // strcpy(macroBuf, "{");
1151 strcpy(macroBuf
, customMacro
->macroBody
);
1152 strcat(macroBuf
, "}");
1153 ParseArg(thisArg
, children
, macroBuf
, 0, NULL
, TRUE
, chunk
);
1156 // delete chunk; // Might delete children
1161 MacroError(buffer
+pos
);
1167 * If all else fails, we assume that we have
1168 * a pair of braces on their own, so return a `dummy' macro
1169 * definition with just one argument to parse.
1173 SoloBlockDef
= new TexMacroDef(ltSOLO_BLOCK
, "solo block", 1, FALSE
);
1178 TexChunk
*chunk1
= new TexChunk(CHUNK_TYPE_STRING
);
1179 BigBuffer
[buf_ptr
] = 0;
1181 chunk1
->value
= copystring(BigBuffer
);
1182 children
.Append((wxObject
*)chunk1
);
1184 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_MACRO
, SoloBlockDef
);
1185 chunk
->no_args
= SoloBlockDef
->no_args
;
1186 // chunk->name = copystring(SoloBlockDef->name);
1187 chunk
->macroId
= SoloBlockDef
->macroId
;
1188 children
.Append((wxObject
*)chunk
);
1190 TexChunk
*arg
= new TexChunk(CHUNK_TYPE_ARG
, SoloBlockDef
);
1192 chunk
->children
.Append((wxObject
*)arg
);
1193 // arg->name = copystring(SoloBlockDef->name);
1195 arg
->macroId
= chunk
->macroId
;
1197 pos
= ParseArg(arg
, arg
->children
, buffer
, pos
, NULL
, TRUE
, customMacroArgs
);
1205 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_STRING
);
1206 BigBuffer
[buf_ptr
] = 0;
1208 chunk
->value
= copystring(BigBuffer
);
1209 children
.Append((wxObject
*)chunk
);
1214 if (buffer
[pos
] == '$')
1216 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_MACRO
);
1218 // chunk->name = copystring("$$");
1219 chunk
->macroId
= ltSPECIALDOUBLEDOLLAR
;
1220 children
.Append((wxObject
*)chunk
);
1225 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_MACRO
);
1227 // chunk->name = copystring("_$");
1228 chunk
->macroId
= ltSPECIALDOLLAR
;
1229 children
.Append((wxObject
*)chunk
);
1237 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_STRING
);
1238 BigBuffer
[buf_ptr
] = 0;
1240 chunk
->value
= copystring(BigBuffer
);
1241 children
.Append((wxObject
*)chunk
);
1245 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_MACRO
);
1247 // chunk->name = copystring("_~");
1248 chunk
->macroId
= ltSPECIALTILDE
;
1249 children
.Append((wxObject
*)chunk
);
1252 case '#': // Either treat as a special TeX character or as a macro arg
1256 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_STRING
);
1257 BigBuffer
[buf_ptr
] = 0;
1259 chunk
->value
= copystring(BigBuffer
);
1260 children
.Append((wxObject
*)chunk
);
1264 if (!customMacroArgs
)
1266 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_MACRO
);
1268 // chunk->name = copystring("_#");
1269 chunk
->macroId
= ltSPECIALHASH
;
1270 children
.Append((wxObject
*)chunk
);
1274 if (isdigit(buffer
[pos
]))
1276 int n
= buffer
[pos
] - 48;
1278 wxNode
*node
= customMacroArgs
->children
.Nth(n
-1);
1281 TexChunk
*argChunk
= (TexChunk
*)node
->Data();
1282 children
.Append((wxObject
*)new TexChunk(*argChunk
));
1290 // Remove white space before and after the ampersand,
1291 // since this is probably a table column separator with
1292 // some convenient -- but useless -- white space in the text.
1293 while ((buf_ptr
> 0) && ((BigBuffer
[buf_ptr
-1] == ' ') || (BigBuffer
[buf_ptr
-1] == 9)))
1298 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_STRING
);
1299 BigBuffer
[buf_ptr
] = 0;
1301 chunk
->value
= copystring(BigBuffer
);
1302 children
.Append((wxObject
*)chunk
);
1307 while (buffer
[pos
] == ' ' || buffer
[pos
] == 9)
1310 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_MACRO
);
1312 // chunk->name = copystring("_&");
1313 chunk
->macroId
= ltSPECIALAMPERSAND
;
1314 children
.Append((wxObject
*)chunk
);
1317 // Eliminate end-of-line comment
1321 while (ch
!= 10 && ch
!= 13 && ch
!= 0)
1326 if (buffer
[pos
] == 10 || buffer
[pos
] == 13)
1329 if (buffer
[pos
] == 10) pos
++; // Eliminate newline following DOS line feed
1336 BigBuffer
[buf_ptr
] = ' ';
1337 BigBuffer
[buf_ptr
+1] = 0;
1344 BigBuffer
[buf_ptr
] = ch
;
1345 BigBuffer
[buf_ptr
+1] = 0;
1356 * Consume as many arguments as the macro definition specifies
1360 int ParseMacroBody(char *macro_name
, TexChunk
*parent
,
1361 int no_args
, char *buffer
, int pos
,
1362 char *environment
, bool parseToBrace
,
1363 TexChunk
*customMacroArgs
)
1366 if (stopRunning
) return pos
;
1368 // Check for a first optional argument
1369 if (buffer
[pos
] == ' ' && buffer
[pos
+1] == '[')
1371 // Fool following code into thinking that this is definitely
1372 // an optional first argument. (If a space before a non-first argument,
1373 // [ is interpreted as a [, not an optional argument.)
1379 if (buffer
[pos
] == '[')
1385 for (i
= 0; i
< no_args
; i
++)
1388 TexChunk
*arg
= new TexChunk(CHUNK_TYPE_ARG
, parent
->def
);
1390 parent
->children
.Append((wxObject
*)arg
);
1391 // arg->name = copystring(macro_name);
1392 arg
->argn
= maxArgs
;
1393 arg
->macroId
= parent
->macroId
;
1395 // To parse the first arg of a 2 arg \begin{thing}{arg} ... \end{thing}
1396 // have to fool parser into thinking this is a regular kind of block.
1398 if ((no_args
== 2) && (i
== 0))
1401 actualEnv
= environment
;
1403 bool isOptional
= FALSE
;
1405 // Remove the first { of the argument so it doesn't get recognized as { ... }
1406 // EatWhiteSpace(buffer, &pos);
1409 // The reason for these tests is to not consume braces that don't
1410 // belong to this macro.
1411 // E.g. {\bf {\small thing}}
1412 if ((pos
> 0) && (buffer
[pos
-1] != ' ') && buffer
[pos
] == '{')
1415 if ((pos
> 0) && (buffer
[pos
-1] != ' ') && (buffer
[pos
] == '['))
1420 else if ((pos
> 1) && (buffer
[pos
-1] != ' ') && (buffer
[pos
+1] == '['))
1426 arg
->optional
= isOptional
;
1428 pos
= ParseArg(arg
, arg
->children
, buffer
, pos
, actualEnv
, parseToBrace
, customMacroArgs
);
1430 // If we've encountered an OPTIONAL argument, go another time around
1431 // the loop, because we've got more than we thought.
1432 // Hopefully optional args don't occur at the end of a macro use
1433 // or we might miss it.
1434 // Don't increment no of times round loop if the first optional arg
1435 // -- we already did it before the loop.
1436 if (arg
->optional
&& (i
> 0))
1439 parent
->no_args
= maxArgs
;
1441 // Tell each argument how many args there are (useful when processing an arg)
1442 wxNode
*node
= parent
->children
.First();
1445 TexChunk
*chunk
= (TexChunk
*)node
->Data();
1446 chunk
->no_args
= maxArgs
;
1447 node
= node
->Next();
1452 bool TexLoadFile(char *filename
)
1454 stopRunning
= FALSE
;
1455 strcpy(TexFileRoot
, filename
);
1456 StripExtension(TexFileRoot
);
1457 sprintf(TexBibName
, "%s.bb", TexFileRoot
);
1458 sprintf(TexTmpBibName
, "%s.bb1", TexFileRoot
);
1460 TexPathList
.EnsureFileAccessible(filename
);
1463 static char *line_buffer
= new char[600];
1465 static char *line_buffer
= new char[11000];
1468 Inputs
[0] = fopen(filename
, "r");
1470 FileNames
[0] = copystring(filename
);
1473 read_a_line(line_buffer
);
1474 ParseMacroBody("toplevel", TopLevel
, 1, line_buffer
, 0, NULL
, TRUE
);
1475 if (Inputs
[0]) fclose(Inputs
[0]);
1482 TexMacroDef::TexMacroDef(int the_id
, char *the_name
, int n
, bool ig
, bool forbidLevel
)
1484 name
= copystring(the_name
);
1488 forbidden
= forbidLevel
;
1491 TexMacroDef::~TexMacroDef(void)
1493 if (name
) delete[] name
;
1496 TexChunk::TexChunk(int the_type
, TexMacroDef
*the_def
)
1508 TexChunk::TexChunk(TexChunk
& toCopy
)
1511 no_args
= toCopy
.no_args
;
1513 macroId
= toCopy
.macroId
;
1516 // name = copystring(toCopy.name);
1522 value
= copystring(toCopy
.value
);
1526 optional
= toCopy
.optional
;
1527 wxNode
*node
= toCopy
.children
.First();
1530 TexChunk
*child
= (TexChunk
*)node
->Data();
1531 children
.Append((wxObject
*)new TexChunk(*child
));
1532 node
= node
->Next();
1536 TexChunk::~TexChunk(void)
1538 // if (name) delete[] name;
1539 if (value
) delete[] value
;
1540 wxNode
*node
= children
.First();
1543 TexChunk
*child
= (TexChunk
*)node
->Data();
1545 wxNode
*next
= node
->Next();
1551 bool IsArgOptional(void) // Is this argument an optional argument?
1553 return isArgOptional
;
1556 int GetNoArgs(void) // Number of args for this macro
1561 /* Gets the text of a chunk on request (must be for small arguments
1566 void GetArgData1(TexChunk
*chunk
)
1568 switch (chunk
->type
)
1570 case CHUNK_TYPE_MACRO
:
1572 TexMacroDef
*def
= chunk
->def
;
1573 if (def
&& def
->ignore
)
1576 if (def
&& (strcmp(def
->name
, "solo block") != 0))
1578 strcat(currentArgData
, "\\");
1579 strcat(currentArgData
, def
->name
);
1582 wxNode
*node
= chunk
->children
.First();
1585 TexChunk
*child_chunk
= (TexChunk
*)node
->Data();
1586 strcat(currentArgData
, "{");
1587 GetArgData1(child_chunk
);
1588 strcat(currentArgData
, "}");
1589 node
= node
->Next();
1593 case CHUNK_TYPE_ARG
:
1595 wxNode
*node
= chunk
->children
.First();
1598 TexChunk
*child_chunk
= (TexChunk
*)node
->Data();
1599 GetArgData1(child_chunk
);
1600 node
= node
->Next();
1604 case CHUNK_TYPE_STRING
:
1607 strcat(currentArgData
, chunk
->value
);
1613 char *GetArgData(TexChunk
*chunk
)
1615 currentArgData
[0] = 0;
1616 GetArgData1(currentArgument
);
1617 haveArgData
= FALSE
;
1618 return currentArgData
;
1621 char *GetArgData(void)
1625 currentArgData
[0] = 0;
1626 GetArgData1(currentArgument
);
1628 return currentArgData
;
1631 TexChunk
*GetArgChunk(void)
1633 return currentArgument
;
1636 TexChunk
*GetNextChunk(void) // Look ahead to the next chunk
1641 TexChunk
*GetTopLevelChunk(void)
1646 int GetCurrentColumn(void)
1648 return currentColumn
;
1652 * Traverses document calling functions to allow the client to
1653 * write out the appropriate stuff
1657 void TraverseFromChunk(TexChunk
*chunk
, wxNode
*thisNode
, bool childrenOnly
)
1660 if (stopRunning
) return;
1662 switch (chunk
->type
)
1664 case CHUNK_TYPE_MACRO
:
1666 TexMacroDef
*def
= chunk
->def
;
1667 if (def
&& def
->ignore
)
1671 OnMacro(chunk
->macroId
, chunk
->no_args
, TRUE
);
1673 wxNode
*node
= chunk
->children
.First();
1676 TexChunk
*child_chunk
= (TexChunk
*)node
->Data();
1677 TraverseFromChunk(child_chunk
, node
);
1678 node
= node
->Next();
1681 if (thisNode
&& thisNode
->Next()) nextChunk
= (TexChunk
*)thisNode
->Next()->Data();
1684 OnMacro(chunk
->macroId
, chunk
->no_args
, FALSE
);
1687 case CHUNK_TYPE_ARG
:
1689 currentArgument
= chunk
;
1691 isArgOptional
= chunk
->optional
;
1692 noArgs
= chunk
->no_args
;
1694 // If OnArgument returns FALSE, don't output.
1696 if (childrenOnly
|| OnArgument(chunk
->macroId
, chunk
->argn
, TRUE
))
1698 wxNode
*node
= chunk
->children
.First();
1701 TexChunk
*child_chunk
= (TexChunk
*)node
->Data();
1702 TraverseFromChunk(child_chunk
, node
);
1703 node
= node
->Next();
1707 currentArgument
= chunk
;
1709 if (thisNode
&& thisNode
->Next()) nextChunk
= (TexChunk
*)thisNode
->Next()->Data();
1711 isArgOptional
= chunk
->optional
;
1712 noArgs
= chunk
->no_args
;
1715 (void)OnArgument(chunk
->macroId
, chunk
->argn
, FALSE
);
1718 case CHUNK_TYPE_STRING
:
1720 extern int issuedNewParagraph
;
1721 extern int forbidResetPar
;
1722 if (chunk
->value
&& (forbidResetPar
== 0))
1724 // If non-whitespace text, we no longer have a new paragraph.
1725 if (issuedNewParagraph
&& !((chunk
->value
[0] == 10 || chunk
->value
[0] == 13 || chunk
->value
[0] == 32)
1726 && chunk
->value
[1] == 0))
1727 issuedNewParagraph
= FALSE
;
1728 TexOutput(chunk
->value
, TRUE
);
1735 void TraverseDocument(void)
1737 TraverseFromChunk(TopLevel
, NULL
);
1740 void SetCurrentOutput(FILE *fd
)
1742 CurrentOutput1
= fd
;
1743 CurrentOutput2
= NULL
;
1746 void SetCurrentOutputs(FILE *fd1
, FILE *fd2
)
1748 CurrentOutput1
= fd1
;
1749 CurrentOutput2
= fd2
;
1752 void AddMacroDef(int the_id
, char *name
, int n
, bool ignore
, bool forbid
)
1754 MacroDefs
.Put(name
, new TexMacroDef(the_id
, name
, n
, ignore
, forbid
));
1757 void TexInitialize(int bufSize
)
1759 InitialiseColourTable();
1761 TexPathList
.AddEnvList("TEXINPUT");
1764 TexPathList
.AddEnvList("TEXINPUTS");
1767 for (i
= 0; i
< 15; i
++)
1771 FileNames
[i
] = NULL
;
1774 IgnorableInputFiles
.Add("psbox.tex");
1775 BigBuffer
= new char[(bufSize
*1000)];
1776 currentArgData
= new char[2000];
1777 TexFileRoot
= new char[300];
1778 TexBibName
= new char[300];
1779 TexTmpBibName
= new char[300];
1780 AddMacroDef(ltTOPLEVEL
, "toplevel", 1);
1781 TopLevel
= new TexChunk(CHUNK_TYPE_MACRO
);
1782 // TopLevel->name = copystring("toplevel");
1783 TopLevel
->macroId
= ltTOPLEVEL
;
1784 TopLevel
->no_args
= 1;
1785 VerbatimMacroDef
= (TexMacroDef
*)MacroDefs
.Get("verbatim");
1788 void TexCleanUp(void)
1791 for (i
= 0; i
< 15; i
++)
1797 subsubsectionNo
= 0;
1800 CurrentOutput1
= NULL
;
1801 CurrentOutput2
= NULL
;
1802 CurrentInputIndex
= 0;
1803 haveArgData
= FALSE
;
1808 TopLevel
= new TexChunk(CHUNK_TYPE_MACRO
);
1809 // TopLevel->name = copystring("toplevel");
1810 TopLevel
->macroId
= ltTOPLEVEL
;
1811 TopLevel
->no_args
= 1;
1813 DocumentTitle
= NULL
;
1814 DocumentAuthor
= NULL
;
1815 DocumentDate
= NULL
;
1816 DocumentStyle
= LATEX_REPORT
;
1817 MinorDocumentStyle
= 0;
1818 BibliographyStyleString
= copystring("plain");
1819 DocumentStyleString
= copystring("report");
1820 MinorDocumentStyleString
= NULL
;
1821 /* Don't want to remove custom macros after each pass.
1823 wxNode *node = CustomMacroList.First();
1826 CustomMacro *macro = (CustomMacro *)node->Data();
1829 node = CustomMacroList.First();
1832 TexReferences
.BeginFind();
1833 wxNode
*node
= TexReferences
.Next();
1836 TexRef
*ref
= (TexRef
*)node
->Data();
1838 node
= TexReferences
.Next();
1840 TexReferences
.Clear();
1842 node
= BibList
.First();
1845 BibEntry
*entry
= (BibEntry
*)node
->Data();
1848 node
= BibList
.First();
1850 CitationList
.Clear();
1851 ResetTopicCounter();
1854 // There is likely to be one set of macros used by all utilities.
1855 void DefineDefaultMacros(void)
1857 // Put names which subsume other names at the TOP
1858 // so they get recognized first
1860 AddMacroDef(ltACCENT_GRAVE
, "`", 1);
1861 AddMacroDef(ltACCENT_ACUTE
, "'", 1);
1862 AddMacroDef(ltACCENT_CARET
, "^", 1);
1863 AddMacroDef(ltACCENT_UMLAUT
, "\"", 1);
1864 AddMacroDef(ltACCENT_TILDE
, "~", 1);
1865 AddMacroDef(ltACCENT_DOT
, ".", 1);
1866 AddMacroDef(ltACCENT_CADILLA
, "c", 1);
1867 AddMacroDef(ltSMALLSPACE1
, ",", 0);
1868 AddMacroDef(ltSMALLSPACE2
, ";", 0);
1870 AddMacroDef(ltABSTRACT
, "abstract", 1);
1871 AddMacroDef(ltADDCONTENTSLINE
, "addcontentsline", 3);
1872 AddMacroDef(ltADDTOCOUNTER
, "addtocounter", 2);
1873 AddMacroDef(ltALEPH
, "aleph", 0);
1874 AddMacroDef(ltALPHA
, "alpha", 0);
1875 AddMacroDef(ltALPH1
, "alph", 1);
1876 AddMacroDef(ltALPH2
, "Alph", 1);
1877 AddMacroDef(ltANGLE
, "angle", 0);
1878 AddMacroDef(ltAPPENDIX
, "appendix", 0);
1879 AddMacroDef(ltAPPROX
, "approx", 0);
1880 AddMacroDef(ltARABIC
, "arabic", 1);
1881 AddMacroDef(ltARRAY
, "array", 1);
1882 AddMacroDef(ltAST
, "ast", 0);
1883 AddMacroDef(ltASYMP
, "asymp", 0);
1884 AddMacroDef(ltAUTHOR
, "author", 1);
1886 AddMacroDef(ltBACKGROUNDCOLOUR
, "backgroundcolour", 1);
1887 AddMacroDef(ltBACKGROUNDIMAGE
, "backgroundimage", 1);
1888 AddMacroDef(ltBACKGROUND
, "background", 1);
1889 AddMacroDef(ltBACKSLASHRAW
, "backslashraw", 0);
1890 AddMacroDef(ltBACKSLASH
, "backslash", 0);
1891 AddMacroDef(ltBASELINESKIP
, "baselineskip", 1);
1892 AddMacroDef(ltBCOL
, "bcol", 2);
1893 AddMacroDef(ltBETA
, "beta", 0);
1894 AddMacroDef(ltBFSERIES
, "bfseries", 1);
1895 AddMacroDef(ltBF
, "bf", 1);
1896 AddMacroDef(ltBIBITEM
, "bibitem", 2); // For convenience, bibitem has 2 args: label and item.
1897 // The Latex syntax permits writing as 2 args.
1898 AddMacroDef(ltBIBLIOGRAPHYSTYLE
, "bibliographystyle", 1);
1899 AddMacroDef(ltBIBLIOGRAPHY
, "bibliography", 1);
1900 AddMacroDef(ltBIGTRIANGLEDOWN
, "bigtriangledown", 0);
1901 AddMacroDef(ltBOT
, "bot", 0);
1902 AddMacroDef(ltBOXIT
, "boxit", 1);
1903 AddMacroDef(ltBOX
, "box", 0);
1904 AddMacroDef(ltBRCLEAR
, "brclear", 0);
1905 AddMacroDef(ltBULLET
, "bullet", 0);
1907 AddMacroDef(ltCAPTIONSTAR
, "caption*", 1);
1908 AddMacroDef(ltCAPTION
, "caption", 1);
1909 AddMacroDef(ltCAP
, "cap", 0);
1910 AddMacroDef(ltCDOTS
, "cdots", 0);
1911 AddMacroDef(ltCDOT
, "cdot", 0);
1912 AddMacroDef(ltCENTERLINE
, "centerline", 1);
1913 AddMacroDef(ltCENTERING
, "centering", 0);
1914 AddMacroDef(ltCENTER
, "center", 1);
1915 AddMacroDef(ltCEXTRACT
, "cextract", 0);
1916 AddMacroDef(ltCHAPTERHEADING
, "chapterheading", 1);
1917 AddMacroDef(ltCHAPTERSTAR
, "chapter*", 1);
1918 AddMacroDef(ltCHAPTER
, "chapter", 1);
1919 AddMacroDef(ltCHI
, "chi", 0);
1920 AddMacroDef(ltCINSERT
, "cinsert", 0);
1921 AddMacroDef(ltCIRC
, "circ", 0);
1922 AddMacroDef(ltCITE
, "cite", 1);
1923 AddMacroDef(ltCLASS
, "class", 1);
1924 AddMacroDef(ltCLEARDOUBLEPAGE
, "cleardoublepage", 0);
1925 AddMacroDef(ltCLEARPAGE
, "clearpage", 0);
1926 AddMacroDef(ltCLINE
, "cline", 1);
1927 AddMacroDef(ltCLIPSFUNC
, "clipsfunc", 3);
1928 AddMacroDef(ltCLUBSUIT
, "clubsuit", 0);
1929 AddMacroDef(ltCOLUMNSEP
, "columnsep", 1);
1930 AddMacroDef(ltCOMMENT
, "comment", 1, TRUE
);
1931 AddMacroDef(ltCONG
, "cong", 0);
1932 AddMacroDef(ltCOPYRIGHT
, "copyright", 0);
1933 AddMacroDef(ltCPARAM
, "cparam", 2);
1934 AddMacroDef(ltCHEAD
, "chead", 1);
1935 AddMacroDef(ltCFOOT
, "cfoot", 1);
1936 AddMacroDef(ltCUP
, "cup", 0);
1938 AddMacroDef(ltDASHV
, "dashv", 0);
1939 AddMacroDef(ltDATE
, "date", 1);
1940 AddMacroDef(ltDELTA
, "delta", 0);
1941 AddMacroDef(ltCAP_DELTA
, "Delta", 0);
1942 AddMacroDef(ltDEFINECOLOUR
, "definecolour", 4);
1943 AddMacroDef(ltDEFINECOLOR
, "definecolor", 4);
1944 AddMacroDef(ltDESCRIPTION
, "description", 1);
1945 AddMacroDef(ltDESTRUCT
, "destruct", 1);
1946 AddMacroDef(ltDIAMOND2
, "diamond2", 0);
1947 AddMacroDef(ltDIAMOND
, "diamond", 0);
1948 AddMacroDef(ltDIV
, "div", 0);
1949 AddMacroDef(ltDOCUMENTCLASS
, "documentclass", 1);
1950 AddMacroDef(ltDOCUMENTSTYLE
, "documentstyle", 1);
1951 AddMacroDef(ltDOCUMENT
, "document", 1);
1952 AddMacroDef(ltDOUBLESPACE
, "doublespace", 1);
1953 AddMacroDef(ltDOTEQ
, "doteq", 0);
1954 AddMacroDef(ltDOWNARROW
, "downarrow", 0);
1955 AddMacroDef(ltDOWNARROW2
, "Downarrow", 0);
1957 AddMacroDef(ltEMPTYSET
, "emptyset", 0);
1958 AddMacroDef(ltEMPH
, "emph", 1);
1959 AddMacroDef(ltEM
, "em", 1);
1960 AddMacroDef(ltENUMERATE
, "enumerate", 1);
1961 AddMacroDef(ltEPSILON
, "epsilon", 0);
1962 AddMacroDef(ltEQUATION
, "equation", 1);
1963 AddMacroDef(ltEQUIV
, "equiv", 0);
1964 AddMacroDef(ltETA
, "eta", 0);
1965 AddMacroDef(ltEVENSIDEMARGIN
, "evensidemargin", 1);
1966 AddMacroDef(ltEXISTS
, "exists", 0);
1968 AddMacroDef(ltFBOX
, "fbox", 1);
1969 AddMacroDef(ltFCOL
, "fcol", 2);
1970 AddMacroDef(ltFIGURE
, "figure", 1);
1971 AddMacroDef(ltFIGURESTAR
, "figure*", 1);
1972 AddMacroDef(ltFLUSHLEFT
, "flushleft", 1);
1973 AddMacroDef(ltFLUSHRIGHT
, "flushright", 1);
1974 AddMacroDef(ltFOLLOWEDLINKCOLOUR
, "followedlinkcolour", 1);
1975 AddMacroDef(ltFOOTHEIGHT
, "footheight", 1);
1976 AddMacroDef(ltFOOTNOTEPOPUP
, "footnotepopup", 2);
1977 AddMacroDef(ltFOOTNOTE
, "footnote", 1);
1978 AddMacroDef(ltFOOTSKIP
, "footskip", 1);
1979 AddMacroDef(ltFORALL
, "forall", 0);
1980 AddMacroDef(ltFRAMEBOX
, "framebox", 1);
1981 AddMacroDef(ltFROWN
, "frown", 0);
1982 AddMacroDef(ltFUNCTIONSECTION
, "functionsection", 1);
1983 AddMacroDef(ltFUNC
, "func", 3);
1984 AddMacroDef(ltFOOTNOTESIZE
, "footnotesize", 0);
1985 AddMacroDef(ltFANCYPLAIN
, "fancyplain", 2);
1987 AddMacroDef(ltGAMMA
, "gamma", 0);
1988 AddMacroDef(ltCAP_GAMMA
, "Gamma", 0);
1989 AddMacroDef(ltGEQ
, "geq", 0);
1990 AddMacroDef(ltGE
, "ge", 0);
1991 AddMacroDef(ltGG
, "gg", 0);
1992 AddMacroDef(ltGLOSSARY
, "glossary", 1);
1993 AddMacroDef(ltGLOSS
, "gloss", 1);
1995 AddMacroDef(ltHEADHEIGHT
, "headheight", 1);
1996 AddMacroDef(ltHEARTSUIT
, "heartsuit", 0);
1997 AddMacroDef(ltHELPGLOSSARY
, "helpglossary", 1);
1998 AddMacroDef(ltHELPIGNORE
, "helpignore", 1, TRUE
);
1999 AddMacroDef(ltHELPONLY
, "helponly", 1);
2000 AddMacroDef(ltHELPINPUT
, "helpinput", 1);
2001 AddMacroDef(ltHELPFONTFAMILY
, "helpfontfamily", 1);
2002 AddMacroDef(ltHELPFONTSIZE
, "helpfontsize", 1);
2003 AddMacroDef(ltHELPREFN
, "helprefn", 2);
2004 AddMacroDef(ltHELPREF
, "helpref", 2);
2005 AddMacroDef(ltHFILL
, "hfill", 0);
2006 AddMacroDef(ltHLINE
, "hline", 0);
2007 AddMacroDef(ltHRULE
, "hrule", 0);
2008 AddMacroDef(ltHSPACESTAR
, "hspace*", 1);
2009 AddMacroDef(ltHSPACE
, "hspace", 1);
2010 AddMacroDef(ltHSKIPSTAR
, "hskip*", 1);
2011 AddMacroDef(ltHSKIP
, "hskip", 1);
2012 AddMacroDef(lthuge
, "huge", 1);
2013 AddMacroDef(ltHuge
, "Huge", 1);
2014 AddMacroDef(ltHUGE
, "HUGE", 1);
2015 AddMacroDef(ltHTMLIGNORE
, "htmlignore", 1);
2016 AddMacroDef(ltHTMLONLY
, "htmlonly", 1);
2018 AddMacroDef(ltIM
, "im", 0);
2019 AddMacroDef(ltINCLUDEONLY
, "includeonly", 1);
2020 AddMacroDef(ltINCLUDE
, "include", 1);
2021 AddMacroDef(ltINDENTED
, "indented", 2);
2022 AddMacroDef(ltINDEX
, "index", 1);
2023 AddMacroDef(ltINPUT
, "input", 1, TRUE
);
2024 AddMacroDef(ltIOTA
, "iota", 0);
2025 AddMacroDef(ltITEMIZE
, "itemize", 1);
2026 AddMacroDef(ltITEM
, "item", 0);
2027 AddMacroDef(ltIMAGEMAP
, "imagemap", 3);
2028 AddMacroDef(ltIMAGEL
, "imagel", 2);
2029 AddMacroDef(ltIMAGER
, "imager", 2);
2030 AddMacroDef(ltIMAGE
, "image", 2);
2031 AddMacroDef(ltIN
, "in", 0);
2032 AddMacroDef(ltINFTY
, "infty", 0);
2033 AddMacroDef(ltITSHAPE
, "itshape", 1);
2034 AddMacroDef(ltIT
, "it", 1);
2035 AddMacroDef(ltITEMSEP
, "itemsep", 1);
2036 AddMacroDef(ltINSERTATLEVEL
, "insertatlevel", 2);
2038 AddMacroDef(ltKAPPA
, "kappa", 0);
2039 AddMacroDef(ltKILL
, "kill", 0);
2041 AddMacroDef(ltLABEL
, "label", 1);
2042 AddMacroDef(ltLAMBDA
, "lambda", 0);
2043 AddMacroDef(ltCAP_LAMBDA
, "Lambda", 0);
2044 AddMacroDef(ltlarge
, "large", 1);
2045 AddMacroDef(ltLarge
, "Large", 1);
2046 AddMacroDef(ltLARGE
, "LARGE", 1);
2047 AddMacroDef(ltLATEXIGNORE
, "latexignore", 1);
2048 AddMacroDef(ltLATEXONLY
, "latexonly", 1);
2049 AddMacroDef(ltLATEX
, "LaTeX", 0);
2050 AddMacroDef(ltLBOX
, "lbox", 1);
2051 AddMacroDef(ltLBRACERAW
, "lbraceraw", 0);
2052 AddMacroDef(ltLDOTS
, "ldots", 0);
2053 AddMacroDef(ltLEQ
, "leq", 0);
2054 AddMacroDef(ltLE
, "le", 0);
2055 AddMacroDef(ltLEFTARROW
, "leftarrow", 0);
2056 AddMacroDef(ltLEFTRIGHTARROW
, "leftrightarrow", 0);
2057 AddMacroDef(ltLEFTARROW2
, "Leftarrow", 0);
2058 AddMacroDef(ltLEFTRIGHTARROW2
, "Leftrightarrow", 0);
2059 AddMacroDef(ltLINEBREAK
, "linebreak", 0);
2060 AddMacroDef(ltLINKCOLOUR
, "linkcolour", 1);
2061 AddMacroDef(ltLISTOFFIGURES
, "listoffigures", 0);
2062 AddMacroDef(ltLISTOFTABLES
, "listoftables", 0);
2063 AddMacroDef(ltLHEAD
, "lhead", 1);
2064 AddMacroDef(ltLFOOT
, "lfoot", 1);
2065 AddMacroDef(ltLOWERCASE
, "lowercase", 1);
2066 AddMacroDef(ltLL
, "ll", 0);
2068 AddMacroDef(ltMAKEGLOSSARY
, "makeglossary", 0);
2069 AddMacroDef(ltMAKEINDEX
, "makeindex", 0);
2070 AddMacroDef(ltMAKETITLE
, "maketitle", 0);
2071 AddMacroDef(ltMARKRIGHT
, "markright", 1);
2072 AddMacroDef(ltMARKBOTH
, "markboth", 2);
2073 AddMacroDef(ltMARGINPARWIDTH
, "marginparwidth", 1);
2074 AddMacroDef(ltMARGINPARSEP
, "marginparsep", 1);
2075 AddMacroDef(ltMARGINPARODD
, "marginparodd", 1);
2076 AddMacroDef(ltMARGINPAREVEN
, "marginpareven", 1);
2077 AddMacroDef(ltMARGINPAR
, "marginpar", 1);
2078 AddMacroDef(ltMBOX
, "mbox", 1);
2079 AddMacroDef(ltMDSERIES
, "mdseries", 1);
2080 AddMacroDef(ltMEMBERSECTION
, "membersection", 1);
2081 AddMacroDef(ltMEMBER
, "member", 2);
2082 AddMacroDef(ltMID
, "mid", 0);
2083 AddMacroDef(ltMODELS
, "models", 0);
2084 AddMacroDef(ltMP
, "mp", 0);
2085 AddMacroDef(ltMULTICOLUMN
, "multicolumn", 3);
2086 AddMacroDef(ltMU
, "mu", 0);
2088 AddMacroDef(ltNABLA
, "nabla", 0);
2089 AddMacroDef(ltNEG
, "neg", 0);
2090 AddMacroDef(ltNEQ
, "neq", 0);
2091 AddMacroDef(ltNEWCOUNTER
, "newcounter", 1, FALSE
, (bool)FORBID_ABSOLUTELY
);
2092 AddMacroDef(ltNEWLINE
, "newline", 0);
2093 AddMacroDef(ltNEWPAGE
, "newpage", 0);
2094 AddMacroDef(ltNI
, "ni", 0);
2095 AddMacroDef(ltNOCITE
, "nocite", 1);
2096 AddMacroDef(ltNOINDENT
, "noindent", 0);
2097 AddMacroDef(ltNOLINEBREAK
, "nolinebreak", 0);
2098 AddMacroDef(ltNOPAGEBREAK
, "nopagebreak", 0);
2099 AddMacroDef(ltNORMALSIZE
, "normalsize", 1);
2100 AddMacroDef(ltNORMALBOX
, "normalbox", 1);
2101 AddMacroDef(ltNORMALBOXD
, "normalboxd", 1);
2102 AddMacroDef(ltNOTEQ
, "noteq", 0);
2103 AddMacroDef(ltNOTIN
, "notin", 0);
2104 AddMacroDef(ltNOTSUBSET
, "notsubset", 0);
2105 AddMacroDef(ltNU
, "nu", 0);
2107 AddMacroDef(ltODDSIDEMARGIN
, "oddsidemargin", 1);
2108 AddMacroDef(ltOMEGA
, "omega", 0);
2109 AddMacroDef(ltCAP_OMEGA
, "Omega", 0);
2110 AddMacroDef(ltONECOLUMN
, "onecolumn", 0);
2111 AddMacroDef(ltOPLUS
, "oplus", 0);
2112 AddMacroDef(ltOSLASH
, "oslash", 0);
2113 AddMacroDef(ltOTIMES
, "otimes", 0);
2115 AddMacroDef(ltPAGEBREAK
, "pagebreak", 0);
2116 AddMacroDef(ltPAGEREF
, "pageref", 1);
2117 AddMacroDef(ltPAGESTYLE
, "pagestyle", 1);
2118 AddMacroDef(ltPAGENUMBERING
, "pagenumbering", 1);
2119 AddMacroDef(ltPARAGRAPHSTAR
, "paragraph*", 1);
2120 AddMacroDef(ltPARAGRAPH
, "paragraph", 1);
2121 AddMacroDef(ltPARALLEL
, "parallel", 0);
2122 AddMacroDef(ltPARAM
, "param", 2);
2123 AddMacroDef(ltPARINDENT
, "parindent", 1);
2124 AddMacroDef(ltPARSKIP
, "parskip", 1);
2125 AddMacroDef(ltPARTIAL
, "partial", 0);
2126 AddMacroDef(ltPARTSTAR
, "part*", 1);
2127 AddMacroDef(ltPART
, "part", 1);
2128 AddMacroDef(ltPAR
, "par", 0);
2129 AddMacroDef(ltPERP
, "perp", 0);
2130 AddMacroDef(ltPHI
, "phi", 0);
2131 AddMacroDef(ltCAP_PHI
, "Phi", 0);
2132 AddMacroDef(ltPFUNC
, "pfunc", 3);
2133 AddMacroDef(ltPICTURE
, "picture", 1);
2134 AddMacroDef(ltPI
, "pi", 0);
2135 AddMacroDef(ltCAP_PI
, "Pi", 0);
2136 AddMacroDef(ltPM
, "pm", 0);
2137 AddMacroDef(ltPOPREFONLY
, "poprefonly", 1);
2138 AddMacroDef(ltPOPREF
, "popref", 2);
2139 AddMacroDef(ltPOUNDS
, "pounds", 0);
2140 AddMacroDef(ltPREC
, "prec", 0);
2141 AddMacroDef(ltPRECEQ
, "preceq", 0);
2142 AddMacroDef(ltPRINTINDEX
, "printindex", 0);
2143 AddMacroDef(ltPROPTO
, "propto", 0);
2144 AddMacroDef(ltPSBOXTO
, "psboxto", 1, FALSE
, (bool)FORBID_ABSOLUTELY
);
2145 AddMacroDef(ltPSBOX
, "psbox", 1, FALSE
, (bool)FORBID_ABSOLUTELY
);
2146 AddMacroDef(ltPSI
, "psi", 0);
2147 AddMacroDef(ltCAP_PSI
, "Psi", 0);
2149 AddMacroDef(ltQUOTE
, "quote", 1);
2150 AddMacroDef(ltQUOTATION
, "quotation", 1);
2152 AddMacroDef(ltRAGGEDBOTTOM
, "raggedbottom", 0);
2153 AddMacroDef(ltRAGGEDLEFT
, "raggedleft", 0);
2154 AddMacroDef(ltRAGGEDRIGHT
, "raggedright", 0);
2155 AddMacroDef(ltRBRACERAW
, "rbraceraw", 0);
2156 AddMacroDef(ltREF
, "ref", 1);
2157 AddMacroDef(ltREGISTERED
, "registered", 0);
2158 AddMacroDef(ltRE
, "we", 0);
2159 AddMacroDef(ltRHO
, "rho", 0);
2160 AddMacroDef(ltRIGHTARROW
, "rightarrow", 0);
2161 AddMacroDef(ltRIGHTARROW2
, "rightarrow2", 0);
2162 AddMacroDef(ltRMFAMILY
, "rmfamily", 1);
2163 AddMacroDef(ltRM
, "rm", 1);
2164 AddMacroDef(ltROMAN
, "roman", 1);
2165 AddMacroDef(ltROMAN2
, "Roman", 1);
2166 // AddMacroDef(lt"row", 1);
2167 AddMacroDef(ltRTFSP
, "rtfsp", 0);
2168 AddMacroDef(ltRTFIGNORE
, "rtfignore", 1);
2169 AddMacroDef(ltRTFONLY
, "rtfonly", 1);
2170 AddMacroDef(ltRULEDROW
, "ruledrow", 1);
2171 AddMacroDef(ltDRULED
, "druled", 1);
2172 AddMacroDef(ltRULE
, "rule", 2);
2173 AddMacroDef(ltRHEAD
, "rhead", 1);
2174 AddMacroDef(ltRFOOT
, "rfoot", 1);
2175 AddMacroDef(ltROW
, "row", 1);
2177 AddMacroDef(ltSCSHAPE
, "scshape", 1);
2178 AddMacroDef(ltSC
, "sc", 1);
2179 AddMacroDef(ltSECTIONHEADING
, "sectionheading", 1);
2180 AddMacroDef(ltSECTIONSTAR
, "section*", 1);
2181 AddMacroDef(ltSECTION
, "section", 1);
2182 AddMacroDef(ltSETCOUNTER
, "setcounter", 2);
2183 AddMacroDef(ltSFFAMILY
, "sffamily", 1);
2184 AddMacroDef(ltSF
, "sf", 1);
2185 AddMacroDef(ltSHARP
, "sharp", 0);
2186 AddMacroDef(ltSHORTCITE
, "shortcite", 1);
2187 AddMacroDef(ltSIGMA
, "sigma", 0);
2188 AddMacroDef(ltCAP_SIGMA
, "Sigma", 0);
2189 AddMacroDef(ltSIM
, "sim", 0);
2190 AddMacroDef(ltSIMEQ
, "simeq", 0);
2191 AddMacroDef(ltSINGLESPACE
, "singlespace", 1);
2192 AddMacroDef(ltSIZEDBOX
, "sizedbox", 2);
2193 AddMacroDef(ltSIZEDBOXD
, "sizedboxd", 2);
2194 AddMacroDef(ltSLOPPYPAR
, "sloppypar", 1);
2195 AddMacroDef(ltSLOPPY
, "sloppy", 0);
2196 AddMacroDef(ltSLSHAPE
, "slshape", 1);
2197 AddMacroDef(ltSL
, "sl", 1);
2198 AddMacroDef(ltSMALL
, "small", 1);
2199 AddMacroDef(ltSMILE
, "smile", 0);
2200 AddMacroDef(ltSS
, "ss", 0);
2201 AddMacroDef(ltSTAR
, "star", 0);
2202 AddMacroDef(ltSUBITEM
, "subitem", 0);
2203 AddMacroDef(ltSUBPARAGRAPHSTAR
, "subparagraph*", 1);
2204 AddMacroDef(ltSUBPARAGRAPH
, "subparagraph", 1);
2205 AddMacroDef(ltSPECIAL
, "special", 1);
2206 AddMacroDef(ltSUBSECTIONSTAR
, "subsection*", 1);
2207 AddMacroDef(ltSUBSECTION
, "subsection", 1);
2208 AddMacroDef(ltSUBSETEQ
, "subseteq", 0);
2209 AddMacroDef(ltSUBSET
, "subset", 0);
2210 AddMacroDef(ltSUCC
, "succ", 0);
2211 AddMacroDef(ltSUCCEQ
, "succeq", 0);
2212 AddMacroDef(ltSUPSETEQ
, "supseteq", 0);
2213 AddMacroDef(ltSUPSET
, "supset", 0);
2214 AddMacroDef(ltSUBSUBSECTIONSTAR
,"subsubsection*", 1);
2215 AddMacroDef(ltSUBSUBSECTION
, "subsubsection", 1);
2216 AddMacroDef(ltSUPERTABULAR
, "supertabular", 2, FALSE
);
2217 AddMacroDef(ltSURD
, "surd", 0);
2218 AddMacroDef(ltSCRIPTSIZE
, "scriptsize", 1);
2219 AddMacroDef(ltSETHEADER
, "setheader", 6);
2220 AddMacroDef(ltSETFOOTER
, "setfooter", 6);
2221 AddMacroDef(ltSETHOTSPOTCOLOUR
, "sethotspotcolour", 1);
2222 AddMacroDef(ltSETHOTSPOTCOLOR
, "sethotspotcolor", 1);
2223 AddMacroDef(ltSETHOTSPOTUNDERLINE
, "sethotspotunderline", 1);
2224 AddMacroDef(ltSETTRANSPARENCY
, "settransparency", 1);
2225 AddMacroDef(ltSPADESUIT
, "spadesuit", 0);
2227 AddMacroDef(ltTABBING
, "tabbing", 2);
2228 AddMacroDef(ltTABLEOFCONTENTS
, "tableofcontents", 0);
2229 AddMacroDef(ltTABLE
, "table", 1);
2230 AddMacroDef(ltTABULAR
, "tabular", 2, FALSE
);
2231 AddMacroDef(ltTAB
, "tab", 0);
2232 AddMacroDef(ltTAU
, "tau", 0);
2233 AddMacroDef(ltTEXTRM
, "textrm", 1);
2234 AddMacroDef(ltTEXTSF
, "textsf", 1);
2235 AddMacroDef(ltTEXTTT
, "texttt", 1);
2236 AddMacroDef(ltTEXTBF
, "textbf", 1);
2237 AddMacroDef(ltTEXTIT
, "textit", 1);
2238 AddMacroDef(ltTEXTSL
, "textsl", 1);
2239 AddMacroDef(ltTEXTSC
, "textsc", 1);
2240 AddMacroDef(ltTEXTWIDTH
, "textwidth", 1);
2241 AddMacroDef(ltTEXTHEIGHT
, "textheight", 1);
2242 AddMacroDef(ltTEXTCOLOUR
, "textcolour", 1);
2243 AddMacroDef(ltTEX
, "TeX", 0);
2244 AddMacroDef(ltTHEBIBLIOGRAPHY
, "thebibliography", 2);
2245 AddMacroDef(ltTHETA
, "theta", 0);
2246 AddMacroDef(ltTIMES
, "times", 0);
2247 AddMacroDef(ltCAP_THETA
, "Theta", 0);
2248 AddMacroDef(ltTITLEPAGE
, "titlepage", 1);
2249 AddMacroDef(ltTITLE
, "title", 1);
2250 AddMacroDef(ltTINY
, "tiny", 1);
2251 AddMacroDef(ltTODAY
, "today", 0);
2252 AddMacroDef(ltTOPMARGIN
, "topmargin", 1);
2253 AddMacroDef(ltTOPSKIP
, "topskip", 1);
2254 AddMacroDef(ltTRIANGLE
, "triangle", 0);
2255 AddMacroDef(ltTTFAMILY
, "ttfamily", 1);
2256 AddMacroDef(ltTT
, "tt", 1);
2257 AddMacroDef(ltTYPEIN
, "typein", 1);
2258 AddMacroDef(ltTYPEOUT
, "typeout", 1);
2259 AddMacroDef(ltTWOCOLWIDTHA
, "twocolwidtha", 1);
2260 AddMacroDef(ltTWOCOLWIDTHB
, "twocolwidthb", 1);
2261 AddMacroDef(ltTWOCOLSPACING
, "twocolspacing", 1);
2262 AddMacroDef(ltTWOCOLITEMRULED
, "twocolitemruled", 2);
2263 AddMacroDef(ltTWOCOLITEM
, "twocolitem", 2);
2264 AddMacroDef(ltTWOCOLLIST
, "twocollist", 1);
2265 AddMacroDef(ltTWOCOLUMN
, "twocolumn", 0);
2266 AddMacroDef(ltTHEPAGE
, "thepage", 0);
2267 AddMacroDef(ltTHECHAPTER
, "thechapter", 0);
2268 AddMacroDef(ltTHESECTION
, "thesection", 0);
2269 AddMacroDef(ltTHISPAGESTYLE
, "thispagestyle", 1);
2271 AddMacroDef(ltUNDERLINE
, "underline", 1);
2272 AddMacroDef(ltUPSILON
, "upsilon", 0);
2273 AddMacroDef(ltCAP_UPSILON
, "Upsilon", 0);
2274 AddMacroDef(ltUPARROW
, "uparrow", 0);
2275 AddMacroDef(ltUPARROW2
, "Uparrow", 0);
2276 AddMacroDef(ltUPPERCASE
, "uppercase", 1);
2277 AddMacroDef(ltUPSHAPE
, "upshape", 1);
2278 AddMacroDef(ltURLREF
, "urlref", 2);
2279 AddMacroDef(ltUSEPACKAGE
, "usepackage", 1);
2281 AddMacroDef(ltVAREPSILON
, "varepsilon", 0);
2282 AddMacroDef(ltVARPHI
, "varphi", 0);
2283 AddMacroDef(ltVARPI
, "varpi", 0);
2284 AddMacroDef(ltVARRHO
, "varrho", 0);
2285 AddMacroDef(ltVARSIGMA
, "varsigma", 0);
2286 AddMacroDef(ltVARTHETA
, "vartheta", 0);
2287 AddMacroDef(ltVDOTS
, "vdots", 0);
2288 AddMacroDef(ltVEE
, "vee", 0);
2289 AddMacroDef(ltVERBATIMINPUT
, "verbatiminput", 1);
2290 AddMacroDef(ltVERBATIM
, "verbatim", 1);
2291 AddMacroDef(ltVERBSTAR
, "verb*", 1);
2292 AddMacroDef(ltVERB
, "verb", 1);
2293 AddMacroDef(ltVERSE
, "verse", 1);
2294 AddMacroDef(ltVFILL
, "vfill", 0);
2295 AddMacroDef(ltVLINE
, "vline", 0);
2296 AddMacroDef(ltVOID
, "void", 0);
2297 AddMacroDef(ltVDASH
, "vdash", 0);
2298 AddMacroDef(ltVRULE
, "vrule", 0);
2299 AddMacroDef(ltVSPACESTAR
, "vspace*", 1);
2300 AddMacroDef(ltVSKIPSTAR
, "vskip*", 1);
2301 AddMacroDef(ltVSPACE
, "vspace", 1);
2302 AddMacroDef(ltVSKIP
, "vskip", 1);
2304 AddMacroDef(ltWEDGE
, "wedge", 0);
2305 AddMacroDef(ltWXCLIPS
, "wxclips", 0);
2306 AddMacroDef(ltWINHELPIGNORE
, "winhelpignore", 1);
2307 AddMacroDef(ltWINHELPONLY
, "winhelponly", 1);
2308 AddMacroDef(ltWP
, "wp", 0);
2310 AddMacroDef(ltXI
, "xi", 0);
2311 AddMacroDef(ltCAP_XI
, "Xi", 0);
2312 AddMacroDef(ltXLPIGNORE
, "xlpignore", 1);
2313 AddMacroDef(ltXLPONLY
, "xlponly", 1);
2315 AddMacroDef(ltZETA
, "zeta", 0);
2317 AddMacroDef(ltSPACE
, " ", 0);
2318 AddMacroDef(ltBACKSLASHCHAR
, "\\", 0);
2319 AddMacroDef(ltPIPE
, "|", 0);
2320 AddMacroDef(ltFORWARDSLASH
, "/", 0);
2321 AddMacroDef(ltUNDERSCORE
, "_", 0);
2322 AddMacroDef(ltAMPERSAND
, "&", 0);
2323 AddMacroDef(ltPERCENT
, "%", 0);
2324 AddMacroDef(ltDOLLAR
, "$", 0);
2325 AddMacroDef(ltHASH
, "#", 0);
2326 AddMacroDef(ltLPARENTH
, "(", 0);
2327 AddMacroDef(ltRPARENTH
, ")", 0);
2328 AddMacroDef(ltLBRACE
, "{", 0);
2329 AddMacroDef(ltRBRACE
, "}", 0);
2330 // AddMacroDef(ltEQUALS, "=", 0);
2331 AddMacroDef(ltRANGLEBRA
, ">", 0);
2332 AddMacroDef(ltLANGLEBRA
, "<", 0);
2333 AddMacroDef(ltPLUS
, "+", 0);
2334 AddMacroDef(ltDASH
, "-", 0);
2335 AddMacroDef(ltAT_SYMBOL
, "@", 0);
2336 // AddMacroDef(ltSINGLEQUOTE, "'", 0);
2337 // AddMacroDef(ltBACKQUOTE, "`", 0);
2341 * Default behaviour, should be called by client if can't match locally.
2345 // Called on start/end of macro examination
2346 void DefaultOnMacro(int macroId
, int no_args
, bool start
)
2350 // Default behaviour for abstract
2355 // Write the heading
2356 FakeCurrentSection(AbstractNameString
);
2357 OnMacro(ltPAR
, 0, TRUE
);
2358 OnMacro(ltPAR
, 0, FALSE
);
2362 if (DocumentStyle
== LATEX_ARTICLE
)
2370 // Default behaviour for glossary
2371 case ltHELPGLOSSARY
:
2375 // Write the heading
2376 FakeCurrentSection(GlossaryNameString
);
2377 OnMacro(ltPAR
, 0, TRUE
);
2378 OnMacro(ltPAR
, 0, FALSE
);
2379 if ((convertMode
== TEX_RTF
) && !winHelp
)
2381 OnMacro(ltPAR
, 0, TRUE
);
2382 OnMacro(ltPAR
, 0, FALSE
);
2387 case ltSPECIALAMPERSAND
:
2394 TexOutput("<<", TRUE
);
2398 TexOutput(">>", TRUE
);
2402 TexOutput("~", TRUE
);
2406 TexOutput("~", TRUE
);
2408 case ltSPECIALTILDE
:
2410 TexOutput(" ", TRUE
);
2414 TexOutput("_", TRUE
);
2418 TexOutput("#", TRUE
);
2422 TexOutput("&", TRUE
);
2426 TexOutput(" ", TRUE
);
2430 TexOutput("|", TRUE
);
2434 TexOutput("%", TRUE
);
2438 TexOutput("$", TRUE
);
2442 TexOutput("", TRUE
);
2446 TexOutput("", TRUE
);
2450 TexOutput("{", TRUE
);
2454 TexOutput("}", TRUE
);
2458 TexOutput("(c)", TRUE
);
2462 TexOutput("(r)", TRUE
);
2466 TexOutput("\\", TRUE
);
2471 TexOutput("...", TRUE
);
2475 TexOutput("|", TRUE
);
2479 TexOutput("LaTeX", TRUE
);
2483 TexOutput("TeX", TRUE
);
2487 TexOutput("£", TRUE
);
2489 case ltSPECIALDOUBLEDOLLAR
: // Interpret as center
2490 OnMacro(ltCENTER
, no_args
, start
);
2496 OnMacro(ltIT
, no_args
, start
);
2499 case ltPARAGRAPHSTAR
:
2500 case ltSUBPARAGRAPH
:
2501 case ltSUBPARAGRAPHSTAR
:
2502 OnMacro(ltSUBSUBSECTION
, no_args
, start
);
2510 TexOutput(ctime(&when
), TRUE
);
2521 if (start
) TexOutput("alpha");
2524 if (start
) TexOutput("beta");
2527 if (start
) TexOutput("gamma");
2530 if (start
) TexOutput("delta");
2534 if (start
) TexOutput("epsilon");
2537 if (start
) TexOutput("zeta");
2540 if (start
) TexOutput("eta");
2544 if (start
) TexOutput("theta");
2547 if (start
) TexOutput("iota");
2550 if (start
) TexOutput("kappa");
2553 if (start
) TexOutput("lambda");
2556 if (start
) TexOutput("mu");
2559 if (start
) TexOutput("nu");
2562 if (start
) TexOutput("xi");
2566 if (start
) TexOutput("pi");
2570 if (start
) TexOutput("rho");
2574 if (start
) TexOutput("sigma");
2577 if (start
) TexOutput("tau");
2580 if (start
) TexOutput("upsilon");
2584 if (start
) TexOutput("phi");
2587 if (start
) TexOutput("chi");
2590 if (start
) TexOutput("psi");
2593 if (start
) TexOutput("omega");
2596 if (start
) TexOutput("GAMMA");
2599 if (start
) TexOutput("DELTA");
2602 if (start
) TexOutput("THETA");
2605 if (start
) TexOutput("LAMBDA");
2608 if (start
) TexOutput("XI");
2611 if (start
) TexOutput("PI");
2614 if (start
) TexOutput("SIGMA");
2617 if (start
) TexOutput("UPSILON");
2620 if (start
) TexOutput("PHI");
2623 if (start
) TexOutput("PSI");
2626 if (start
) TexOutput("OMEGA");
2629 // Binary operation symbols
2632 if (start
) TexOutput("<=");
2635 if (start
) TexOutput("<<");
2638 if (start
) TexOutput("SUBSET");
2641 if (start
) TexOutput("SUBSETEQ");
2644 if (start
) TexOutput("IN");
2647 if (start
) TexOutput("VDASH");
2650 if (start
) TexOutput("MODELS");
2654 if (start
) TexOutput(">=");
2657 if (start
) TexOutput(">>");
2660 if (start
) TexOutput("SUPSET");
2663 if (start
) TexOutput("SUPSETEQ");
2666 if (start
) TexOutput("NI");
2669 if (start
) TexOutput("DASHV");
2672 if (start
) TexOutput("PERP");
2675 if (start
) TexOutput("NEQ");
2678 if (start
) TexOutput("DOTEQ");
2681 if (start
) TexOutput("APPROX");
2684 if (start
) TexOutput("CONG");
2687 if (start
) TexOutput("EQUIV");
2690 if (start
) TexOutput("PROPTO");
2693 if (start
) TexOutput("PREC");
2696 if (start
) TexOutput("PRECEQ");
2699 if (start
) TexOutput("|");
2702 if (start
) TexOutput("~");
2705 if (start
) TexOutput("SIMEQ");
2708 if (start
) TexOutput("ASYMP");
2711 if (start
) TexOutput(":-)");
2714 if (start
) TexOutput(":-(");
2717 if (start
) TexOutput("SUCC");
2720 if (start
) TexOutput("SUCCEQ");
2723 if (start
) TexOutput("|");
2726 // Negated relation symbols
2728 if (start
) TexOutput("!=");
2731 if (start
) TexOutput("NOTIN");
2734 if (start
) TexOutput("NOTSUBSET");
2739 if (start
) TexOutput("<--");
2742 if (start
) TexOutput("<==");
2745 if (start
) TexOutput("-->");
2748 if (start
) TexOutput("==>");
2750 case ltLEFTRIGHTARROW
:
2751 if (start
) TexOutput("<-->");
2753 case ltLEFTRIGHTARROW2
:
2754 if (start
) TexOutput("<==>");
2757 if (start
) TexOutput("UPARROW");
2760 if (start
) TexOutput("UPARROW2");
2763 if (start
) TexOutput("DOWNARROW");
2766 if (start
) TexOutput("DOWNARROW2");
2768 // Miscellaneous symbols
2770 if (start
) TexOutput("ALEPH");
2773 if (start
) TexOutput("WP");
2776 if (start
) TexOutput("RE");
2779 if (start
) TexOutput("IM");
2782 if (start
) TexOutput("EMPTYSET");
2785 if (start
) TexOutput("NABLA");
2788 if (start
) TexOutput("SURD");
2791 if (start
) TexOutput("PARTIAL");
2794 if (start
) TexOutput("BOT");
2797 if (start
) TexOutput("FORALL");
2800 if (start
) TexOutput("EXISTS");
2803 if (start
) TexOutput("NEG");
2806 if (start
) TexOutput("SHARP");
2809 if (start
) TexOutput("ANGLE");
2812 if (start
) TexOutput("TRIANGLE");
2815 if (start
) TexOutput("CLUBSUIT");
2818 if (start
) TexOutput("DIAMONDSUIT");
2821 if (start
) TexOutput("HEARTSUIT");
2824 if (start
) TexOutput("SPADESUIT");
2827 if (start
) TexOutput("INFTY");
2830 if (start
) TexOutput("PM");
2833 if (start
) TexOutput("MP");
2836 if (start
) TexOutput("TIMES");
2839 if (start
) TexOutput("DIV");
2842 if (start
) TexOutput("CDOT");
2845 if (start
) TexOutput("AST");
2848 if (start
) TexOutput("STAR");
2851 if (start
) TexOutput("CAP");
2854 if (start
) TexOutput("CUP");
2857 if (start
) TexOutput("VEE");
2860 if (start
) TexOutput("WEDGE");
2863 if (start
) TexOutput("CIRC");
2866 if (start
) TexOutput("BULLET");
2869 if (start
) TexOutput("DIAMOND");
2872 if (start
) TexOutput("OSLASH");
2875 if (start
) TexOutput("BOX");
2878 if (start
) TexOutput("DIAMOND2");
2880 case ltBIGTRIANGLEDOWN
:
2881 if (start
) TexOutput("BIGTRIANGLEDOWN");
2884 if (start
) TexOutput("OPLUS");
2887 if (start
) TexOutput("OTIMES");
2890 if (start
) TexOutput("s");
2892 case ltBACKSLASHRAW
:
2893 if (start
) TexOutput("\\");
2896 if (start
) TexOutput("{");
2899 if (start
) TexOutput("}");
2903 if (start
) TexOutput(" ");
2910 // Called on start/end of argument examination
2911 bool DefaultOnArgument(int macroId
, int arg_no
, bool start
)
2917 if (arg_no
== 1 && start
)
2919 char *refName
= GetArgData();
2922 TexRef
*texRef
= FindReference(refName
);
2925 // Must strip the 'section' or 'chapter' or 'figure' text
2926 // from a normal 'ref' reference
2928 strcpy(buf
, texRef
->sectionNumber
);
2929 int len
= strlen(buf
);
2931 if (strcmp(buf
, "??") != 0)
2943 TexOutput(texRef
->sectionNumber
+ i
, TRUE
);
2948 TexOutput("??", TRUE
);
2949 sprintf(buf
, "Warning: unresolved reference %s.", refName
);
2953 else TexOutput("??", TRUE
);
2965 if (start
&& (arg_no
== 1))
2966 DocumentAuthor
= GetArgChunk();
2972 if (start
&& (arg_no
== 1))
2973 DocumentDate
= GetArgChunk();
2979 if (start
&& (arg_no
== 1))
2980 DocumentTitle
= GetArgChunk();
2984 case ltDOCUMENTCLASS
:
2985 case ltDOCUMENTSTYLE
:
2987 if (start
&& !IsArgOptional())
2989 DocumentStyleString
= copystring(GetArgData());
2990 if (strncmp(DocumentStyleString
, "art", 3) == 0)
2991 DocumentStyle
= LATEX_ARTICLE
;
2992 else if (strncmp(DocumentStyleString
, "rep", 3) == 0)
2993 DocumentStyle
= LATEX_REPORT
;
2994 else if (strncmp(DocumentStyleString
, "book", 4) == 0 ||
2995 strncmp(DocumentStyleString
, "thesis", 6) == 0)
2996 DocumentStyle
= LATEX_BOOK
;
2997 else if (strncmp(DocumentStyleString
, "letter", 6) == 0)
2998 DocumentStyle
= LATEX_LETTER
;
2999 else if (strncmp(DocumentStyleString
, "slides", 6) == 0)
3000 DocumentStyle
= LATEX_SLIDES
;
3002 if (StringMatch("10", DocumentStyleString
))
3004 else if (StringMatch("11", DocumentStyleString
))
3006 else if (StringMatch("12", DocumentStyleString
))
3009 OnMacro(ltHELPFONTSIZE
, 1, TRUE
);
3010 sprintf(currentArgData
, "%d", normalFont
);
3012 OnArgument(ltHELPFONTSIZE
, 1, TRUE
);
3013 OnArgument(ltHELPFONTSIZE
, 1, FALSE
);
3014 haveArgData
= FALSE
;
3015 OnMacro(ltHELPFONTSIZE
, 1, FALSE
);
3017 else if (start
&& IsArgOptional())
3019 MinorDocumentStyleString
= copystring(GetArgData());
3021 if (StringMatch("10", MinorDocumentStyleString
))
3023 else if (StringMatch("11", MinorDocumentStyleString
))
3025 else if (StringMatch("12", MinorDocumentStyleString
))
3031 case ltBIBLIOGRAPHYSTYLE
:
3033 if (start
&& !IsArgOptional())
3034 BibliographyStyleString
= copystring(GetArgData());
3040 if (start
&& !IsArgOptional())
3042 if (PageStyle
) delete[] PageStyle
;
3043 PageStyle
= copystring(GetArgData());
3051 if (start && !IsArgOptional())
3052 LeftHeader = GetArgChunk();
3058 if (start && !IsArgOptional())
3059 LeftFooter = GetArgChunk();
3065 if (start && !IsArgOptional())
3066 CentreHeader = GetArgChunk();
3072 if (start && !IsArgOptional())
3073 CentreFooter = GetArgChunk();
3079 if (start && !IsArgOptional())
3080 RightHeader = GetArgChunk();
3086 if (start && !IsArgOptional())
3087 RightFooter = GetArgChunk();
3095 if (start
&& !IsArgOptional())
3097 char *citeKeys
= GetArgData();
3099 char *citeKey
= ParseMultifieldString(citeKeys
, &pos
);
3102 AddCitation(citeKey
);
3103 TexRef
*ref
= FindReference(citeKey
);
3106 TexOutput(ref
->sectionNumber
, TRUE
);
3107 if (strcmp(ref
->sectionNumber
, "??") == 0)
3110 sprintf(buf
, "Warning: unresolved citation %s.", citeKey
);
3114 citeKey
= ParseMultifieldString(citeKeys
, &pos
);
3117 TexOutput(", ", TRUE
);
3126 if (start
&& !IsArgOptional())
3128 char *citeKey
= GetArgData();
3129 AddCitation(citeKey
);
3134 case ltHELPFONTSIZE
:
3138 char *data
= GetArgData();
3139 if (strcmp(data
, "10") == 0)
3141 else if (strcmp(data
, "11") == 0)
3143 else if (strcmp(data
, "12") == 0)
3153 TexOutput(" ??", TRUE
);
3160 if (start
&& arg_no
== 1)
3162 char *data
= GetArgData();
3163 ParSkip
= ParseUnitArgument(data
);
3170 if (start
&& arg_no
== 1)
3172 char *data
= GetArgData();
3173 ParIndent
= ParseUnitArgument(data
);
3180 return OnArgument(ltIT
, arg_no
, start
);
3183 case ltSPECIALDOUBLEDOLLAR
:
3185 return OnArgument(ltCENTER
, arg_no
, start
);
3189 case ltPARAGRAPHSTAR
:
3190 case ltSUBPARAGRAPH
:
3191 case ltSUBPARAGRAPHSTAR
:
3193 return OnArgument(ltSUBSUBSECTION
, arg_no
, start
);
3199 OnInform(GetArgData());
3205 TexOutput(" (", TRUE
);
3207 TexOutput(")", TRUE
);
3210 case ltBIBLIOGRAPHY
:
3218 if ((fd
= fopen(TexBibName
, "r")))
3224 TexOutput(smallBuf
);
3232 OnInform("Run Tex2RTF again to include bibliography.");
3235 // Read in the .bib file, resolve all known references, write out the RTF.
3236 char *allFiles
= GetArgData();
3238 char *bibFile
= ParseMultifieldString(allFiles
, &pos
);
3242 strcpy(fileBuf
, bibFile
);
3243 wxString actualFile
= TexPathList
.FindValidPath(fileBuf
);
3244 if (actualFile
== "")
3246 strcat(fileBuf
, ".bib");
3247 actualFile
= TexPathList
.FindValidPath(fileBuf
);
3249 if (actualFile
!= "")
3251 if (!ReadBib((char*) (const char*) actualFile
))
3254 sprintf(buf
, ".bib file %s not found or malformed", (const char*) actualFile
);
3261 sprintf(buf
, ".bib file %s not found", fileBuf
);
3264 bibFile
= ParseMultifieldString(allFiles
, &pos
);
3267 ResolveBibReferences();
3269 // Write it a new bib section in the appropriate format.
3270 FILE *save1
= CurrentOutput1
;
3271 FILE *save2
= CurrentOutput2
;
3272 FILE *Biblio
= fopen(TexTmpBibName
, "w");
3273 SetCurrentOutput(Biblio
);
3276 if (wxFileExists(TexTmpBibName
))
3278 if (wxFileExists(TexBibName
)) wxRemoveFile(TexBibName
);
3279 wxRenameFile(TexTmpBibName
, TexBibName
);
3281 SetCurrentOutputs(save1
, save2
);
3288 if (start
&& (arg_no
== 3))
3298 if (start
&& (arg_no
== 1))
3300 char *s
= GetArgData();
3303 char *s1
= copystring(s
);
3305 for (i
= 0; i
< (int)strlen(s
); i
++)
3306 s1
[i
] = toupper(s
[i
]);
3319 if (start
&& (arg_no
== 1))
3321 char *s
= GetArgData();
3324 char *s1
= copystring(s
);
3326 for (i
= 0; i
< (int)strlen(s
); i
++)
3327 s1
[i
] = tolower(s
[i
]);
3340 if (start
&& (arg_no
== 1))
3342 char *s
= GetArgData();
3345 char *s1
= copystring(s
);
3347 for (i
= 0; i
< (int)strlen(s
); i
++)
3348 s1
[i
] = toupper(s
[i
]);
3359 case ltPOPREF
: // Ignore second argument by default
3361 if (start
&& (arg_no
== 1))
3371 return ((convertMode
== TEX_XLP
) ? FALSE
: TRUE
);
3374 return ((convertMode
!= TEX_XLP
) ? FALSE
: TRUE
);
3377 return ((convertMode
== TEX_HTML
) ? FALSE
: TRUE
);
3380 return ((convertMode
!= TEX_HTML
) ? FALSE
: TRUE
);
3383 return (((convertMode
== TEX_RTF
) && !winHelp
) ? FALSE
: TRUE
);
3386 return (!((convertMode
== TEX_RTF
) && !winHelp
) ? FALSE
: TRUE
);
3388 case ltWINHELPIGNORE
:
3389 return (winHelp
? FALSE
: TRUE
);
3392 return (!winHelp
? FALSE
: TRUE
);
3407 case ltADDTOCOUNTER
:
3408 case ltADDCONTENTSLINE
:
3412 case ltBASELINESKIP
:
3421 case ltPAGENUMBERING
:
3433 case ltTHISPAGESTYLE
:
3436 case ltEVENSIDEMARGIN
:
3437 case ltODDSIDEMARGIN
:
3439 case ltMARGINPARWIDTH
:
3440 case ltMARGINPARSEP
:
3441 case ltMARGINPAREVEN
:
3442 case ltMARGINPARODD
:
3443 case ltTWOCOLWIDTHA
:
3444 case ltTWOCOLWIDTHB
:
3445 case ltTWOCOLSPACING
:
3452 case ltSETHOTSPOTCOLOUR
:
3453 case ltSETHOTSPOTCOLOR
:
3454 case ltSETHOTSPOTUNDERLINE
:
3455 case ltSETTRANSPARENCY
:
3458 case ltBACKGROUNDCOLOUR
:
3459 case ltBACKGROUNDIMAGE
:
3461 case ltFOLLOWEDLINKCOLOUR
:
3468 case ltINSERTATLEVEL
:
3472 case ltSUPERTABULAR
:
3481 if (arg_no
== 2) return TRUE
;
3488 if (arg_no
== 2) return TRUE
;
3492 case ltDEFINECOLOUR
:
3495 static int redVal
= 0;
3496 static int greenVal
= 0;
3497 static int blueVal
= 0;
3498 static char *colourName
= NULL
;
3505 if (colourName
) delete[] colourName
;
3506 colourName
= copystring(GetArgData());
3511 redVal
= atoi(GetArgData());
3516 greenVal
= atoi(GetArgData());
3521 blueVal
= atoi(GetArgData());
3522 AddColour(colourName
, redVal
, greenVal
, blueVal
);
3538 if (IsArgOptional())