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
;
126 extern int passNumber
;
128 extern wxHashTable TexReferences
;
131 * International support
134 // Names to help with internationalisation
135 char *ContentsNameString
= copystring("Contents");
136 char *AbstractNameString
= copystring("Abstract");
137 char *GlossaryNameString
= copystring("Glossary");
138 char *ReferencesNameString
= copystring("References");
139 char *FiguresNameString
= copystring("List of Figures");
140 char *TablesNameString
= copystring("List of Tables");
141 char *FigureNameString
= copystring("Figure");
142 char *TableNameString
= copystring("Table");
143 char *IndexNameString
= copystring("Index");
144 char *ChapterNameString
= copystring("chapter");
145 char *SectionNameString
= copystring("section");
146 char *SubsectionNameString
= copystring("subsection");
147 char *SubsubsectionNameString
= copystring("subsubsection");
148 char *UpNameString
= copystring("Up");
157 int subsectionNo
= 0;
158 int subsubsectionNo
= 0;
167 FILE *CurrentOutput1
= NULL
;
168 FILE *CurrentOutput2
= NULL
;
172 int CurrentInputIndex
= 0;
174 char *TexFileRoot
= NULL
;
175 char *TexBibName
= NULL
; // Bibliography output file name
176 char *TexTmpBibName
= NULL
; // Temporary bibliography output file name
177 bool isSync
= FALSE
; // If TRUE, should not yield to other processes.
178 bool stopRunning
= FALSE
; // If TRUE, should abort.
180 static int currentColumn
= 0;
181 char *currentArgData
= NULL
;
182 bool haveArgData
= FALSE
; // If TRUE, we're simulating the data.
183 TexChunk
*currentArgument
= NULL
;
184 TexChunk
*nextChunk
= NULL
;
185 bool isArgOptional
= FALSE
;
188 TexChunk
*TopLevel
= NULL
;
189 // wxList MacroDefs(wxKEY_STRING);
190 wxHashTable
MacroDefs(wxKEY_STRING
);
191 wxStringList IgnorableInputFiles
; // Ignorable \input files, e.g. psbox.tex
192 char *BigBuffer
= NULL
; // For reading in large chunks of text
193 TexMacroDef
*SoloBlockDef
= NULL
;
194 TexMacroDef
*VerbatimMacroDef
= NULL
;
196 #define IncrementLineNumber() LineNumbers[CurrentInputIndex] ++
199 TexRef::TexRef(char *label
, char *file
, char *section
, char *sectionN
)
201 refLabel
= copystring(label
);
202 refFile
= file
? copystring(file
) : (char*) NULL
;
203 sectionNumber
= section
? copystring(section
) : copystring("??");
204 sectionName
= sectionN
? copystring(sectionN
) : copystring("??");
207 TexRef::~TexRef(void)
209 delete [] refLabel
; refLabel
= NULL
;
210 delete [] refFile
; refFile
= NULL
;
211 delete [] sectionNumber
; sectionNumber
= NULL
;
212 delete [] sectionName
; sectionName
= NULL
;
216 CustomMacro::~CustomMacro()
224 void TexOutput(char *s
, bool ordinaryText
)
228 // Update current column, but only if we're guaranteed to
229 // be ordinary text (not mark-up stuff)
232 for (i
= 0; i
< len
; i
++)
234 if (s
[i
] == 13 || s
[i
] == 10)
241 fprintf(CurrentOutput1
, "%s", s
);
243 fprintf(CurrentOutput2
, "%s", s
);
247 * Try to find a Latex macro, in one of the following forms:
248 * (1) \begin{} ... \end{}
249 * (2) \macroname{arg1}...{argn}
253 void ForbidWarning(TexMacroDef
*def
)
256 switch (def
->forbidden
)
260 sprintf(buf
, "Warning: it is recommended that command %s is not used.", def
->name
);
264 case FORBID_ABSOLUTELY
:
266 sprintf(buf
, "Error: command %s cannot be used and will lead to errors.", def
->name
);
275 TexMacroDef
*MatchMacro(char *buffer
, int *pos
, char **env
, bool *parseToBrace
)
277 *parseToBrace
= TRUE
;
279 TexMacroDef
*def
= NULL
;
282 // First, try to find begin{thing}
283 if (strncmp(buffer
+i
, "begin{", 6) == 0)
288 while ((isalpha(buffer
[j
]) || buffer
[j
] == '*') && ((j
- i
) < 39))
290 macroBuf
[j
-i
] = buffer
[j
];
294 def
= (TexMacroDef
*)MacroDefs
.Get(macroBuf
);
298 *pos
= j
+ 1; // BUGBUG Should this be + 1???
306 // Failed, so try to find macro from definition list
309 // First try getting a one-character macro, but ONLY
310 // if these TWO characters are not both alphabetical (could
311 // be a longer macro)
312 if (!(isalpha(buffer
[i
]) && isalpha(buffer
[i
+1])))
314 macroBuf
[0] = buffer
[i
];
317 def
= (TexMacroDef
*)MacroDefs
.Get(macroBuf
);
323 while ((isalpha(buffer
[j
]) || buffer
[j
] == '*') && ((j
- i
) < 39))
325 macroBuf
[j
-i
] = buffer
[j
];
329 def
= (TexMacroDef
*)MacroDefs
.Get(macroBuf
);
336 // We want to check whether this is a space-consuming macro
338 // No brace, e.g. \input thing.tex instead of \input{thing};
339 // or a numeric argument, such as \parindent0pt
340 if ((def
->no_args
> 0) && ((buffer
[i
] == 32) || (buffer
[i
] == '=') || (isdigit(buffer
[i
]))))
342 if ((buffer
[i
] == 32) || (buffer
[i
] == '='))
345 *parseToBrace
= FALSE
;
354 void EatWhiteSpace(char *buffer
, int *pos
)
356 int len
= strlen(buffer
);
358 bool keepGoing
= TRUE
;
359 bool moreLines
= TRUE
;
360 while ((j
< len
) && keepGoing
&&
361 (buffer
[j
] == 10 || buffer
[j
] == 13 || buffer
[j
] == ' ' || buffer
[j
] == 9))
368 moreLines
= read_a_line(buffer
);
369 len
= strlen(buffer
);
379 bool FindEndEnvironment(char *buffer
, int *pos
, char *env
)
383 // Try to find end{thing}
384 if ((strncmp(buffer
+i
, "end{", 4) == 0) &&
385 (strncmp(buffer
+i
+4, env
, strlen(env
)) == 0))
387 *pos
= i
+ 5 + strlen(env
);
393 bool readingVerbatim
= FALSE
;
394 bool readInVerbatim
= FALSE
; // Within a verbatim, but not nec. verbatiminput
396 // Switched this off because e.g. \verb${$ causes it to fail. There is no
397 // detection of \verb yet.
398 #define CHECK_BRACES 1
400 unsigned long leftCurly
= 0;
401 unsigned long rightCurly
= 0;
402 static wxString currentFileName
= "";
404 bool read_a_line(char *buf
)
406 if (CurrentInputIndex
< 0)
416 while (ch
!= EOF
&& ch
!= 10)
418 if (((i
== 14) && (strncmp(buf
, "\\end{verbatim}", 14) == 0)) ||
419 ((i
== 16) && (strncmp(buf
, "\\end{toocomplex}", 16) == 0)))
420 readInVerbatim
= FALSE
;
422 ch
= getc(Inputs
[CurrentInputIndex
]);
425 if (ch
== '{' && !readInVerbatim
)
427 if (ch
== '}' && !readInVerbatim
)
430 if (rightCurly
> leftCurly
)
433 errBuf
.Printf("An extra right Curly brace ('}') was detected at line %lu inside file %s",LineNumbers
[CurrentInputIndex
], (const char*) currentFileName
.c_str());
434 OnError((char *)errBuf
.c_str());
436 // Reduce the count of right curly braces, so the mismatched count
437 // isn't reported on every line that has a '}' after the first mismatch
445 // Check for 2 consecutive newlines and replace with \par
446 if (ch
== 10 && !readInVerbatim
)
448 int ch1
= getc(Inputs
[CurrentInputIndex
]);
449 if ((ch1
== 10) || (ch1
== 13))
451 // Eliminate newline (10) following DOS linefeed
452 if (ch1
== 13) ch1
= getc(Inputs
[CurrentInputIndex
]);
454 IncrementLineNumber();
455 // strcat(buf, "\\par\n");
457 strcat(buf
, "\\par");
462 ungetc(ch1
, Inputs
[CurrentInputIndex
]);
470 // Convert embedded characters to RTF equivalents
484 case 0xf6:buf
[i
++]='o';break; // ö
485 case 0xe4:buf
[i
++]='a';break; // ä
486 case 0xfc:buf
[i
++]='u';break; // ü
487 case 0xd6:buf
[i
++]='O';break; // Ö
488 case 0xc4:buf
[i
++]='A';break; // Ä
489 case 0xdc:buf
[i
++]='U';break; // Ü
510 fclose(Inputs
[CurrentInputIndex
]);
511 Inputs
[CurrentInputIndex
] = NULL
;
512 if (CurrentInputIndex
> 0)
513 ch
= ' '; // No real end of file
514 CurrentInputIndex
--;
516 if (leftCurly
!= rightCurly
)
519 errBuf
.Printf("Curly braces do not match inside file %s\n%lu opens, %lu closes", (const char*) currentFileName
.c_str(),leftCurly
,rightCurly
);
520 OnError((char *)errBuf
.c_str());
527 readingVerbatim
= FALSE
;
528 readInVerbatim
= FALSE
;
529 strcat(buf
, "\\end{verbatim}\n");
534 IncrementLineNumber();
538 // Strip out comment environment
539 if (strncmp(buf
, "\\begin{comment}", 15) == 0)
541 while (strncmp(buf
, "\\end{comment}", 13) != 0)
543 return read_a_line(buf
);
545 // Read a verbatim input file as if it were a verbatim environment
546 else if (strncmp(buf
, "\\verbatiminput", 14) == 0)
549 char *fileName
= buf
+ wordLen
+ 1;
554 // thing}\par -- eliminate the \par!
555 if (strncmp((buf
+ strlen(buf
)-5), "\\par", 4) == 0)
561 if (buf
[j
-1] == '}') buf
[j
-1] = 0; // Ignore final brace
563 wxString actualFile
= TexPathList
.FindValidPath(fileName
);
564 currentFileName
= actualFile
;
565 if (actualFile
== "")
568 strcpy(errBuf
, "Could not find file: ");
569 strncat(errBuf
, fileName
, 100);
575 informStr
.Printf("Processing: %s",actualFile
.c_str());
576 OnInform((char *)informStr
.c_str());
577 CurrentInputIndex
++;
578 Inputs
[CurrentInputIndex
] = fopen(actualFile
, "r");
579 LineNumbers
[CurrentInputIndex
] = 1;
580 if (FileNames
[CurrentInputIndex
])
581 delete[] FileNames
[CurrentInputIndex
];
582 FileNames
[CurrentInputIndex
] = copystring(actualFile
);
584 if (!Inputs
[CurrentInputIndex
])
586 CurrentInputIndex
--;
587 OnError("Could not open verbatiminput file.");
591 readingVerbatim
= TRUE
;
592 readInVerbatim
= TRUE
;
593 strcpy(buf
, "\\begin{verbatim}\n");
599 else if (strncmp(buf
, "\\input", 6) == 0 || strncmp(buf
, "\\helpinput", 10) == 0 ||
600 strncmp(buf
, "\\include", 8) == 0)
603 if (strncmp(buf
, "\\input", 6) == 0)
606 if (strncmp(buf
, "\\include", 8) == 0)
611 char *fileName
= buf
+ wordLen
+ 1;
616 // \input{thing}\par -- eliminate the \par!
617 // if (strncmp((buf + strlen(buf)-5), "\\par", 4) == 0)
618 if (strncmp((buf
+ strlen(buf
)-4), "\\par", 4) == 0) // Bug fix 8/2/95 Ulrich Leodolter
625 if (buf
[j
-1] == '}') buf
[j
-1] = 0; // Ignore final brace
627 // Remove backslashes from name
628 wxString
fileNameStr(fileName
);
629 fileNameStr
.Replace("\\", "");
631 // Ignore some types of input files (e.g. macro definition files)
632 char *fileOnly
= FileNameFromPath((char*) (const char*) fileNameStr
);
633 currentFileName
= fileOnly
;
634 if (IgnorableInputFiles
.Member(fileOnly
))
635 return read_a_line(buf
);
637 wxString actualFile
= TexPathList
.FindValidPath(fileNameStr
);
638 if (actualFile
== "")
641 sprintf(buf2
, "%s.tex", (const char*) fileNameStr
);
642 actualFile
= TexPathList
.FindValidPath(buf2
);
644 currentFileName
= actualFile
;
646 if (actualFile
== "")
649 strcpy(errBuf
, "Could not find file: ");
650 strncat(errBuf
, fileName
, 100);
655 // Ensure that if this file includes another,
656 // then we look in the same directory as this one.
657 TexPathList
.EnsureFileAccessible(actualFile
);
660 informStr
.Printf("Processing: %s",actualFile
.c_str());
661 OnInform((char *)informStr
.c_str());
662 CurrentInputIndex
++;
663 Inputs
[CurrentInputIndex
] = fopen(actualFile
, "r");
664 LineNumbers
[CurrentInputIndex
] = 1;
665 if (FileNames
[CurrentInputIndex
])
666 delete[] FileNames
[CurrentInputIndex
];
667 FileNames
[CurrentInputIndex
] = copystring(actualFile
);
669 if (!Inputs
[CurrentInputIndex
])
672 sprintf(errBuf
, "Could not open include file %s", (const char*) actualFile
);
673 CurrentInputIndex
--;
677 bool succ
= read_a_line(buf
);
680 if (strncmp(buf
, "\\begin{verbatim}", 16) == 0 ||
681 strncmp(buf
, "\\begin{toocomplex}", 18) == 0)
682 readInVerbatim
= TRUE
;
683 else if (strncmp(buf
, "\\end{verbatim}", 14) == 0 ||
684 strncmp(buf
, "\\end{toocomplex}", 16) == 0)
685 readInVerbatim
= FALSE
;
688 if (ch
== EOF
&& leftCurly
!= rightCurly
)
691 errBuf
.Printf("Curly braces do not match inside file %s\n%lu opens, %lu closes", (const char*) currentFileName
.c_str(),leftCurly
,rightCurly
);
692 OnError((char *)errBuf
.c_str());
704 bool ParseNewCommand(char *buffer
, int *pos
)
706 if ((strncmp((buffer
+(*pos
)), "newcommand", 10) == 0) ||
707 (strncmp((buffer
+(*pos
)), "renewcommand", 12) == 0))
709 if (strncmp((buffer
+(*pos
)), "newcommand", 10) == 0)
714 char commandName
[100];
715 char commandValue
[1000];
718 while (buffer
[*pos
] != '}' && (buffer
[*pos
] != 0))
720 commandName
[i
] = buffer
[*pos
];
727 if (buffer
[*pos
] == '[')
730 noArgs
= (int)(buffer
[*pos
]) - 48;
731 *pos
+= 2; // read past argument and '['
737 char ch
= buffer
[*pos
];
748 if (!read_a_line(buffer
))
753 commandValue
[i
] = ch
;
759 CustomMacro
*macro
= new CustomMacro(commandName
, noArgs
, NULL
);
760 if (strlen(commandValue
) > 0)
761 macro
->macroBody
= copystring(commandValue
);
762 if (!CustomMacroList
.Find(commandName
))
764 CustomMacroList
.Append(commandName
, macro
);
765 AddMacroDef(ltCUSTOM_MACRO
, commandName
, noArgs
);
772 void MacroError(char *buffer
)
779 while (((ch
= buffer
[i
-1]) != '\n') && (ch
!= 0))
788 sprintf(errBuf
, "Could not find macro: %s at line %d, file %s",
789 macroBuf
, (int)(LineNumbers
[CurrentInputIndex
]-1), FileNames
[CurrentInputIndex
]);
795 * 'environment' specifies the name of the macro IFF if we're looking for the end
796 * of an environment, e.g. \end{itemize}. Otherwise it's NULL.
797 * 'parseToBrace' is TRUE if the argument should extend to the next right brace,
798 * e.g. in {\bf an argument} as opposed to \vskip 30pt
801 int ParseArg(TexChunk
*thisArg
, wxList
& children
, char *buffer
, int pos
, char *environment
, bool parseToBrace
, TexChunk
*customMacroArgs
)
804 if (stopRunning
) return pos
;
813 // Consume leading brace or square bracket, but ONLY if not following
814 // a space, because this could be e.g. {\large {\bf thing}} where {\bf thing}
815 // is the argument of \large AS WELL as being a block in its
819 if ((pos > 0) && (buffer[pos-1] != ' ') && buffer[pos] == '{')
823 if ((pos > 0) && (buffer[pos-1] != ' ') && (buffer[pos] == '[' || buffer[pos] == '('))
828 else if ((pos > 1) && (buffer[pos-1] != ' ') && (buffer[pos+1] == '[' || buffer[pos+1] == '('))
836 // If not parsing to brace, just read the next word
837 // (e.g. \vskip 20pt)
840 int ch
= buffer
[pos
];
841 while (!eof
&& ch
!= 13 && ch
!= 32 && ch
!= 10 &&
842 ch
!= 0 && ch
!= '{')
844 BigBuffer
[buf_ptr
] = ch
;
851 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_STRING
);
852 BigBuffer
[buf_ptr
] = 0;
854 chunk
->value
= copystring(BigBuffer
);
855 children
.Append((wxObject
*)chunk
);
862 len
= strlen(buffer
);
865 if (customMacroArgs
) return 0;
867 eof
= read_a_line(buffer
);
869 len
= strlen(buffer
);
870 // Check for verbatim (or toocomplex, which comes to the same thing)
871 if (strncmp(buffer
, "\\begin{verbatim}", 16) == 0 ||
872 strncmp(buffer
, "\\begin{toocomplex}", 18) == 0)
876 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_STRING
);
877 BigBuffer
[buf_ptr
] = 0;
879 chunk
->value
= copystring(BigBuffer
);
880 children
.Append((wxObject
*)chunk
);
885 eof
= read_a_line(buffer
);
886 while (!eof
&& (strncmp(buffer
, "\\end{verbatim}", 14) != 0) &&
887 (strncmp(buffer
, "\\end{toocomplex}", 16) != 0)
890 strcat(BigBuffer
, buffer
);
891 buf_ptr
+= strlen(buffer
);
892 eof
= read_a_line(buffer
);
894 eof
= read_a_line(buffer
);
897 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_MACRO
, VerbatimMacroDef
);
899 chunk
->macroId
= ltVERBATIM
;
900 TexChunk
*arg
= new TexChunk(CHUNK_TYPE_ARG
, VerbatimMacroDef
);
902 arg
->macroId
= ltVERBATIM
;
903 TexChunk
*str
= new TexChunk(CHUNK_TYPE_STRING
);
904 str
->value
= copystring(BigBuffer
);
906 children
.Append((wxObject
*)chunk
);
907 chunk
->children
.Append((wxObject
*)arg
);
908 arg
->children
.Append((wxObject
*)str
);
910 // Also want to include the following newline (is always a newline
911 // after a verbatim): EXCEPT in HTML
912 if (convertMode
!= TEX_HTML
)
914 TexMacroDef
*parDef
= (TexMacroDef
*)MacroDefs
.Get("\\");
915 TexChunk
*parChunk
= new TexChunk(CHUNK_TYPE_MACRO
, parDef
);
916 parChunk
->no_args
= 0;
917 parChunk
->macroId
= ltBACKSLASHCHAR
;
918 children
.Append((wxObject
*)parChunk
);
923 char ch
= buffer
[pos
];
924 // End of optional argument -- pretend it's right brace for simplicity
925 if (thisArg
->optional
&& (ch
== ']'))
931 case '}': // End of argument
935 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_STRING
);
936 BigBuffer
[buf_ptr
] = 0;
938 chunk
->value
= copystring(BigBuffer
);
939 children
.Append((wxObject
*)chunk
);
941 if (ch
== '}') pos
++;
947 if (buf_ptr
> 0) // Finish off the string we've read so far
949 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_STRING
);
950 BigBuffer
[buf_ptr
] = 0;
952 chunk
->value
= copystring(BigBuffer
);
953 children
.Append((wxObject
*)chunk
);
958 // Try matching \end{environment}
959 if (environment
&& FindEndEnvironment(buffer
, &pos
, environment
))
961 // Eliminate newline after an \end{} if possible
962 if (buffer
[pos
] == 13)
965 if (buffer
[pos
] == 10)
971 if (ParseNewCommand(buffer
, &pos
))
974 if (strncmp(buffer
+pos
, "special", 7) == 0)
987 int ch
= buffer
[pos
];
1009 else if (ch
== '\\' && buffer
[pos
+1] == '}')
1015 else if (ch
== '\\' && buffer
[pos
+1] == '{')
1030 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_MACRO
);
1032 chunk
->macroId
= ltSPECIAL
;
1033 TexMacroDef
*specialDef
= (TexMacroDef
*)MacroDefs
.Get("special");
1034 chunk
->def
= specialDef
;
1035 TexChunk
*arg
= new TexChunk(CHUNK_TYPE_ARG
, specialDef
);
1036 chunk
->children
.Append((wxObject
*)arg
);
1038 arg
->macroId
= chunk
->macroId
;
1040 // The value in the first argument.
1041 TexChunk
*argValue
= new TexChunk(CHUNK_TYPE_STRING
);
1042 arg
->children
.Append((wxObject
*)argValue
);
1044 argValue
->value
= copystring(wxBuffer
);
1046 children
.Append((wxObject
*)chunk
);
1048 else if (strncmp(buffer
+pos
, "verb", 4) == 0)
1051 if (buffer
[pos
] == '*')
1054 // Find the delimiter character
1055 int ch
= buffer
[pos
];
1057 // Now at start of verbatim text
1059 while ((buffer
[pos
] != ch
) && buffer
[pos
] != 0)
1061 char *val
= new char[pos
- j
+ 1];
1063 for (i
= j
; i
< pos
; i
++)
1065 val
[i
-j
] = buffer
[i
];
1071 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_MACRO
);
1073 chunk
->macroId
= ltVERB
;
1074 TexMacroDef
*verbDef
= (TexMacroDef
*)MacroDefs
.Get("verb");
1075 chunk
->def
= verbDef
;
1076 TexChunk
*arg
= new TexChunk(CHUNK_TYPE_ARG
, verbDef
);
1077 chunk
->children
.Append((wxObject
*)arg
);
1079 arg
->macroId
= chunk
->macroId
;
1081 // The value in the first argument.
1082 TexChunk
*argValue
= new TexChunk(CHUNK_TYPE_STRING
);
1083 arg
->children
.Append((wxObject
*)argValue
);
1085 argValue
->value
= val
;
1087 children
.Append((wxObject
*)chunk
);
1092 bool tmpParseToBrace
= TRUE
;
1093 TexMacroDef
*def
= MatchMacro(buffer
, &pos
, &env
, &tmpParseToBrace
);
1096 CustomMacro
*customMacro
= FindCustomMacro(def
->name
);
1098 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_MACRO
, def
);
1099 chunk
->no_args
= def
->no_args
;
1100 // chunk->name = copystring(def->name);
1101 chunk
->macroId
= def
->macroId
;
1104 children
.Append((wxObject
*)chunk
);
1106 // Eliminate newline after a \begin{} or a \\ if possible
1107 if (env
|| strcmp(def
->name
, "\\") == 0)
1108 if (buffer
[pos
] == 13)
1111 if (buffer
[pos
] == 10)
1115 pos
= ParseMacroBody(def
->name
, chunk
, chunk
->no_args
,
1116 buffer
, pos
, env
, tmpParseToBrace
, customMacroArgs
);
1118 // If custom macro, parse the body substituting the above found args.
1121 if (customMacro
->macroBody
)
1124 // strcpy(macroBuf, "{");
1125 strcpy(macroBuf
, customMacro
->macroBody
);
1126 strcat(macroBuf
, "}");
1127 ParseArg(thisArg
, children
, macroBuf
, 0, NULL
, TRUE
, chunk
);
1130 // delete chunk; // Might delete children
1135 MacroError(buffer
+pos
);
1140 // Parse constructs like {\bf thing} as if they were
1145 if (buffer
[pos
] == '\\')
1149 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_STRING
);
1150 BigBuffer
[buf_ptr
] = 0;
1152 chunk
->value
= copystring(BigBuffer
);
1153 children
.Append((wxObject
*)chunk
);
1158 bool tmpParseToBrace
;
1159 TexMacroDef
*def
= MatchMacro(buffer
, &pos
, &env
, &tmpParseToBrace
);
1162 CustomMacro
*customMacro
= FindCustomMacro(def
->name
);
1164 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_MACRO
, def
);
1165 chunk
->no_args
= def
->no_args
;
1166 // chunk->name = copystring(def->name);
1167 chunk
->macroId
= def
->macroId
;
1169 children
.Append((wxObject
*)chunk
);
1171 pos
= ParseMacroBody(def
->name
, chunk
, chunk
->no_args
,
1172 buffer
, pos
, NULL
, TRUE
, customMacroArgs
);
1174 // If custom macro, parse the body substituting the above found args.
1177 if (customMacro
->macroBody
)
1180 // strcpy(macroBuf, "{");
1181 strcpy(macroBuf
, customMacro
->macroBody
);
1182 strcat(macroBuf
, "}");
1183 ParseArg(thisArg
, children
, macroBuf
, 0, NULL
, TRUE
, chunk
);
1186 // delete chunk; // Might delete children
1191 MacroError(buffer
+pos
);
1197 * If all else fails, we assume that we have
1198 * a pair of braces on their own, so return a `dummy' macro
1199 * definition with just one argument to parse.
1203 SoloBlockDef
= new TexMacroDef(ltSOLO_BLOCK
, "solo block", 1, FALSE
);
1208 TexChunk
*chunk1
= new TexChunk(CHUNK_TYPE_STRING
);
1209 BigBuffer
[buf_ptr
] = 0;
1211 chunk1
->value
= copystring(BigBuffer
);
1212 children
.Append((wxObject
*)chunk1
);
1214 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_MACRO
, SoloBlockDef
);
1215 chunk
->no_args
= SoloBlockDef
->no_args
;
1216 // chunk->name = copystring(SoloBlockDef->name);
1217 chunk
->macroId
= SoloBlockDef
->macroId
;
1218 children
.Append((wxObject
*)chunk
);
1220 TexChunk
*arg
= new TexChunk(CHUNK_TYPE_ARG
, SoloBlockDef
);
1222 chunk
->children
.Append((wxObject
*)arg
);
1223 // arg->name = copystring(SoloBlockDef->name);
1225 arg
->macroId
= chunk
->macroId
;
1227 pos
= ParseArg(arg
, arg
->children
, buffer
, pos
, NULL
, TRUE
, customMacroArgs
);
1235 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_STRING
);
1236 BigBuffer
[buf_ptr
] = 0;
1238 chunk
->value
= copystring(BigBuffer
);
1239 children
.Append((wxObject
*)chunk
);
1244 if (buffer
[pos
] == '$')
1246 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_MACRO
);
1248 // chunk->name = copystring("$$");
1249 chunk
->macroId
= ltSPECIALDOUBLEDOLLAR
;
1250 children
.Append((wxObject
*)chunk
);
1255 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_MACRO
);
1257 // chunk->name = copystring("_$");
1258 chunk
->macroId
= ltSPECIALDOLLAR
;
1259 children
.Append((wxObject
*)chunk
);
1267 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_STRING
);
1268 BigBuffer
[buf_ptr
] = 0;
1270 chunk
->value
= copystring(BigBuffer
);
1271 children
.Append((wxObject
*)chunk
);
1275 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_MACRO
);
1277 // chunk->name = copystring("_~");
1278 chunk
->macroId
= ltSPECIALTILDE
;
1279 children
.Append((wxObject
*)chunk
);
1282 case '#': // Either treat as a special TeX character or as a macro arg
1286 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_STRING
);
1287 BigBuffer
[buf_ptr
] = 0;
1289 chunk
->value
= copystring(BigBuffer
);
1290 children
.Append((wxObject
*)chunk
);
1294 if (!customMacroArgs
)
1296 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_MACRO
);
1298 // chunk->name = copystring("_#");
1299 chunk
->macroId
= ltSPECIALHASH
;
1300 children
.Append((wxObject
*)chunk
);
1304 if (isdigit(buffer
[pos
]))
1306 int n
= buffer
[pos
] - 48;
1308 wxNode
*node
= customMacroArgs
->children
.Nth(n
-1);
1311 TexChunk
*argChunk
= (TexChunk
*)node
->Data();
1312 children
.Append((wxObject
*)new TexChunk(*argChunk
));
1320 // Remove white space before and after the ampersand,
1321 // since this is probably a table column separator with
1322 // some convenient -- but useless -- white space in the text.
1323 while ((buf_ptr
> 0) && ((BigBuffer
[buf_ptr
-1] == ' ') || (BigBuffer
[buf_ptr
-1] == 9)))
1328 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_STRING
);
1329 BigBuffer
[buf_ptr
] = 0;
1331 chunk
->value
= copystring(BigBuffer
);
1332 children
.Append((wxObject
*)chunk
);
1337 while (buffer
[pos
] == ' ' || buffer
[pos
] == 9)
1340 TexChunk
*chunk
= new TexChunk(CHUNK_TYPE_MACRO
);
1342 // chunk->name = copystring("_&");
1343 chunk
->macroId
= ltSPECIALAMPERSAND
;
1344 children
.Append((wxObject
*)chunk
);
1347 // Eliminate end-of-line comment
1351 while (ch
!= 10 && ch
!= 13 && ch
!= 0)
1356 if (buffer
[pos
] == 10 || buffer
[pos
] == 13)
1359 if (buffer
[pos
] == 10) pos
++; // Eliminate newline following DOS line feed
1366 BigBuffer
[buf_ptr
] = ' ';
1367 BigBuffer
[buf_ptr
+1] = 0;
1374 BigBuffer
[buf_ptr
] = ch
;
1375 BigBuffer
[buf_ptr
+1] = 0;
1386 * Consume as many arguments as the macro definition specifies
1390 int ParseMacroBody(char *macro_name
, TexChunk
*parent
,
1391 int no_args
, char *buffer
, int pos
,
1392 char *environment
, bool parseToBrace
,
1393 TexChunk
*customMacroArgs
)
1396 if (stopRunning
) return pos
;
1398 // Check for a first optional argument
1399 if (buffer
[pos
] == ' ' && buffer
[pos
+1] == '[')
1401 // Fool following code into thinking that this is definitely
1402 // an optional first argument. (If a space before a non-first argument,
1403 // [ is interpreted as a [, not an optional argument.)
1409 if (buffer
[pos
] == '[')
1415 for (i
= 0; i
< no_args
; i
++)
1418 TexChunk
*arg
= new TexChunk(CHUNK_TYPE_ARG
, parent
->def
);
1420 parent
->children
.Append((wxObject
*)arg
);
1421 // arg->name = copystring(macro_name);
1422 arg
->argn
= maxArgs
;
1423 arg
->macroId
= parent
->macroId
;
1425 // To parse the first arg of a 2 arg \begin{thing}{arg} ... \end{thing}
1426 // have to fool parser into thinking this is a regular kind of block.
1428 if ((no_args
== 2) && (i
== 0))
1431 actualEnv
= environment
;
1433 bool isOptional
= FALSE
;
1435 // Remove the first { of the argument so it doesn't get recognized as { ... }
1436 // EatWhiteSpace(buffer, &pos);
1439 // The reason for these tests is to not consume braces that don't
1440 // belong to this macro.
1441 // E.g. {\bf {\small thing}}
1442 if ((pos
> 0) && (buffer
[pos
-1] != ' ') && buffer
[pos
] == '{')
1445 if ((pos
> 0) && (buffer
[pos
-1] != ' ') && (buffer
[pos
] == '['))
1450 else if ((pos
> 1) && (buffer
[pos
-1] != ' ') && (buffer
[pos
+1] == '['))
1456 arg
->optional
= isOptional
;
1458 pos
= ParseArg(arg
, arg
->children
, buffer
, pos
, actualEnv
, parseToBrace
, customMacroArgs
);
1460 // If we've encountered an OPTIONAL argument, go another time around
1461 // the loop, because we've got more than we thought.
1462 // Hopefully optional args don't occur at the end of a macro use
1463 // or we might miss it.
1464 // Don't increment no of times round loop if the first optional arg
1465 // -- we already did it before the loop.
1466 if (arg
->optional
&& (i
> 0))
1469 parent
->no_args
= maxArgs
;
1471 // Tell each argument how many args there are (useful when processing an arg)
1472 wxNode
*node
= parent
->children
.First();
1475 TexChunk
*chunk
= (TexChunk
*)node
->Data();
1476 chunk
->no_args
= maxArgs
;
1477 node
= node
->Next();
1482 bool TexLoadFile(char *filename
)
1484 static char *line_buffer
;
1485 stopRunning
= FALSE
;
1486 strcpy(TexFileRoot
, filename
);
1487 StripExtension(TexFileRoot
);
1488 sprintf(TexBibName
, "%s.bb", TexFileRoot
);
1489 sprintf(TexTmpBibName
, "%s.bb1", TexFileRoot
);
1491 TexPathList
.EnsureFileAccessible(filename
);
1496 line_buffer
= new char[600];
1498 line_buffer
= new char[11000];
1501 Inputs
[0] = fopen(filename
, "r");
1503 FileNames
[0] = copystring(filename
);
1506 read_a_line(line_buffer
);
1507 ParseMacroBody("toplevel", TopLevel
, 1, line_buffer
, 0, NULL
, TRUE
);
1508 if (Inputs
[0]) fclose(Inputs
[0]);
1515 TexMacroDef::TexMacroDef(int the_id
, char *the_name
, int n
, bool ig
, bool forbidLevel
)
1517 name
= copystring(the_name
);
1521 forbidden
= forbidLevel
;
1524 TexMacroDef::~TexMacroDef(void)
1526 if (name
) delete[] name
;
1529 TexChunk::TexChunk(int the_type
, TexMacroDef
*the_def
)
1541 TexChunk::TexChunk(TexChunk
& toCopy
)
1544 no_args
= toCopy
.no_args
;
1546 macroId
= toCopy
.macroId
;
1549 // name = copystring(toCopy.name);
1555 value
= copystring(toCopy
.value
);
1559 optional
= toCopy
.optional
;
1560 wxNode
*node
= toCopy
.children
.First();
1563 TexChunk
*child
= (TexChunk
*)node
->Data();
1564 children
.Append((wxObject
*)new TexChunk(*child
));
1565 node
= node
->Next();
1569 TexChunk::~TexChunk(void)
1571 // if (name) delete[] name;
1572 if (value
) delete[] value
;
1573 wxNode
*node
= children
.First();
1576 TexChunk
*child
= (TexChunk
*)node
->Data();
1578 wxNode
*next
= node
->Next();
1584 bool IsArgOptional(void) // Is this argument an optional argument?
1586 return isArgOptional
;
1589 int GetNoArgs(void) // Number of args for this macro
1594 /* Gets the text of a chunk on request (must be for small arguments
1599 void GetArgData1(TexChunk
*chunk
)
1601 switch (chunk
->type
)
1603 case CHUNK_TYPE_MACRO
:
1605 TexMacroDef
*def
= chunk
->def
;
1606 if (def
&& def
->ignore
)
1609 if (def
&& (strcmp(def
->name
, "solo block") != 0))
1611 strcat(currentArgData
, "\\");
1612 strcat(currentArgData
, def
->name
);
1615 wxNode
*node
= chunk
->children
.First();
1618 TexChunk
*child_chunk
= (TexChunk
*)node
->Data();
1619 strcat(currentArgData
, "{");
1620 GetArgData1(child_chunk
);
1621 strcat(currentArgData
, "}");
1622 node
= node
->Next();
1626 case CHUNK_TYPE_ARG
:
1628 wxNode
*node
= chunk
->children
.First();
1631 TexChunk
*child_chunk
= (TexChunk
*)node
->Data();
1632 GetArgData1(child_chunk
);
1633 node
= node
->Next();
1637 case CHUNK_TYPE_STRING
:
1640 strcat(currentArgData
, chunk
->value
);
1646 char *GetArgData(TexChunk
*chunk
)
1648 currentArgData
[0] = 0;
1649 GetArgData1(currentArgument
);
1650 haveArgData
= FALSE
;
1651 return currentArgData
;
1654 char *GetArgData(void)
1658 currentArgData
[0] = 0;
1659 GetArgData1(currentArgument
);
1661 return currentArgData
;
1664 TexChunk
*GetArgChunk(void)
1666 return currentArgument
;
1669 TexChunk
*GetNextChunk(void) // Look ahead to the next chunk
1674 TexChunk
*GetTopLevelChunk(void)
1679 int GetCurrentColumn(void)
1681 return currentColumn
;
1685 * Traverses document calling functions to allow the client to
1686 * write out the appropriate stuff
1690 void TraverseFromChunk(TexChunk
*chunk
, wxNode
*thisNode
, bool childrenOnly
)
1693 if (stopRunning
) return;
1695 switch (chunk
->type
)
1697 case CHUNK_TYPE_MACRO
:
1699 TexMacroDef
*def
= chunk
->def
;
1700 if (def
&& def
->ignore
)
1704 OnMacro(chunk
->macroId
, chunk
->no_args
, TRUE
);
1706 wxNode
*node
= chunk
->children
.First();
1709 TexChunk
*child_chunk
= (TexChunk
*)node
->Data();
1710 TraverseFromChunk(child_chunk
, node
);
1711 node
= node
->Next();
1714 if (thisNode
&& thisNode
->Next()) nextChunk
= (TexChunk
*)thisNode
->Next()->Data();
1717 OnMacro(chunk
->macroId
, chunk
->no_args
, FALSE
);
1720 case CHUNK_TYPE_ARG
:
1722 currentArgument
= chunk
;
1724 isArgOptional
= chunk
->optional
;
1725 noArgs
= chunk
->no_args
;
1727 // If OnArgument returns FALSE, don't output.
1729 if (childrenOnly
|| OnArgument(chunk
->macroId
, chunk
->argn
, TRUE
))
1731 wxNode
*node
= chunk
->children
.First();
1734 TexChunk
*child_chunk
= (TexChunk
*)node
->Data();
1735 TraverseFromChunk(child_chunk
, node
);
1736 node
= node
->Next();
1740 currentArgument
= chunk
;
1742 if (thisNode
&& thisNode
->Next()) nextChunk
= (TexChunk
*)thisNode
->Next()->Data();
1744 isArgOptional
= chunk
->optional
;
1745 noArgs
= chunk
->no_args
;
1748 (void)OnArgument(chunk
->macroId
, chunk
->argn
, FALSE
);
1751 case CHUNK_TYPE_STRING
:
1753 extern int issuedNewParagraph
;
1754 extern int forbidResetPar
;
1755 if (chunk
->value
&& (forbidResetPar
== 0))
1757 // If non-whitespace text, we no longer have a new paragraph.
1758 if (issuedNewParagraph
&& !((chunk
->value
[0] == 10 || chunk
->value
[0] == 13 || chunk
->value
[0] == 32)
1759 && chunk
->value
[1] == 0))
1760 issuedNewParagraph
= FALSE
;
1761 TexOutput(chunk
->value
, TRUE
);
1768 void TraverseDocument(void)
1770 TraverseFromChunk(TopLevel
, NULL
);
1773 void SetCurrentOutput(FILE *fd
)
1775 CurrentOutput1
= fd
;
1776 CurrentOutput2
= NULL
;
1779 void SetCurrentOutputs(FILE *fd1
, FILE *fd2
)
1781 CurrentOutput1
= fd1
;
1782 CurrentOutput2
= fd2
;
1785 void AddMacroDef(int the_id
, char *name
, int n
, bool ignore
, bool forbid
)
1787 MacroDefs
.Put(name
, new TexMacroDef(the_id
, name
, n
, ignore
, forbid
));
1790 void TexInitialize(int bufSize
)
1792 InitialiseColourTable();
1794 TexPathList
.AddEnvList("TEXINPUT");
1797 TexPathList
.AddEnvList("TEXINPUTS");
1800 for (i
= 0; i
< 15; i
++)
1804 FileNames
[i
] = NULL
;
1807 IgnorableInputFiles
.Add("psbox.tex");
1808 BigBuffer
= new char[(bufSize
*1000)];
1809 currentArgData
= new char[2000];
1810 TexFileRoot
= new char[300];
1811 TexBibName
= new char[300];
1812 TexTmpBibName
= new char[300];
1813 AddMacroDef(ltTOPLEVEL
, "toplevel", 1);
1814 TopLevel
= new TexChunk(CHUNK_TYPE_MACRO
);
1815 // TopLevel->name = copystring("toplevel");
1816 TopLevel
->macroId
= ltTOPLEVEL
;
1817 TopLevel
->no_args
= 1;
1818 VerbatimMacroDef
= (TexMacroDef
*)MacroDefs
.Get("verbatim");
1821 void TexCleanUp(void)
1824 for (i
= 0; i
< 15; i
++)
1830 subsubsectionNo
= 0;
1833 CurrentOutput1
= NULL
;
1834 CurrentOutput2
= NULL
;
1835 CurrentInputIndex
= 0;
1836 haveArgData
= FALSE
;
1841 TopLevel
= new TexChunk(CHUNK_TYPE_MACRO
);
1842 // TopLevel->name = copystring("toplevel");
1843 TopLevel
->macroId
= ltTOPLEVEL
;
1844 TopLevel
->no_args
= 1;
1846 DocumentTitle
= NULL
;
1847 DocumentAuthor
= NULL
;
1848 DocumentDate
= NULL
;
1849 DocumentStyle
= LATEX_REPORT
;
1850 MinorDocumentStyle
= 0;
1851 BibliographyStyleString
= copystring("plain");
1852 DocumentStyleString
= copystring("report");
1853 MinorDocumentStyleString
= NULL
;
1855 // gt - Changed this so if this is the final pass
1856 // then we DO want to remove these macros, so that
1857 // memory is not MASSIVELY leaked if the user
1858 // does not exit the program, but instead runs
1859 // the program again
1860 if ((passNumber
== 1 && !runTwice
) ||
1861 (passNumber
== 2 && runTwice
))
1863 /* Don't want to remove custom macros after each pass.*/
1865 wxNode
*node
= CustomMacroList
.First();
1868 CustomMacro
*macro
= (CustomMacro
*)node
->Data();
1871 node
= CustomMacroList
.First();
1875 TexReferences
.BeginFind();
1876 wxNode
*node
= TexReferences
.Next();
1879 TexRef
*ref
= (TexRef
*)node
->Data();
1881 node
= TexReferences
.Next();
1883 TexReferences
.Clear();
1885 node
= BibList
.First();
1888 BibEntry
*entry
= (BibEntry
*)node
->Data();
1891 node
= BibList
.First();
1893 CitationList
.Clear();
1894 ResetTopicCounter();
1897 // There is likely to be one set of macros used by all utilities.
1898 void DefineDefaultMacros(void)
1900 // Put names which subsume other names at the TOP
1901 // so they get recognized first
1903 AddMacroDef(ltACCENT_GRAVE
, "`", 1);
1904 AddMacroDef(ltACCENT_ACUTE
, "'", 1);
1905 AddMacroDef(ltACCENT_CARET
, "^", 1);
1906 AddMacroDef(ltACCENT_UMLAUT
, "\"", 1);
1907 AddMacroDef(ltACCENT_TILDE
, "~", 1);
1908 AddMacroDef(ltACCENT_DOT
, ".", 1);
1909 AddMacroDef(ltACCENT_CADILLA
, "c", 1);
1910 AddMacroDef(ltSMALLSPACE1
, ",", 0);
1911 AddMacroDef(ltSMALLSPACE2
, ";", 0);
1913 AddMacroDef(ltABSTRACT
, "abstract", 1);
1914 AddMacroDef(ltADDCONTENTSLINE
, "addcontentsline", 3);
1915 AddMacroDef(ltADDTOCOUNTER
, "addtocounter", 2);
1916 AddMacroDef(ltALEPH
, "aleph", 0);
1917 AddMacroDef(ltALPHA
, "alpha", 0);
1918 AddMacroDef(ltALPH1
, "alph", 1);
1919 AddMacroDef(ltALPH2
, "Alph", 1);
1920 AddMacroDef(ltANGLE
, "angle", 0);
1921 AddMacroDef(ltAPPENDIX
, "appendix", 0);
1922 AddMacroDef(ltAPPROX
, "approx", 0);
1923 AddMacroDef(ltARABIC
, "arabic", 1);
1924 AddMacroDef(ltARRAY
, "array", 1);
1925 AddMacroDef(ltAST
, "ast", 0);
1926 AddMacroDef(ltASYMP
, "asymp", 0);
1927 AddMacroDef(ltAUTHOR
, "author", 1);
1929 AddMacroDef(ltBACKGROUNDCOLOUR
, "backgroundcolour", 1);
1930 AddMacroDef(ltBACKGROUNDIMAGE
, "backgroundimage", 1);
1931 AddMacroDef(ltBACKGROUND
, "background", 1);
1932 AddMacroDef(ltBACKSLASHRAW
, "backslashraw", 0);
1933 AddMacroDef(ltBACKSLASH
, "backslash", 0);
1934 AddMacroDef(ltBASELINESKIP
, "baselineskip", 1);
1935 AddMacroDef(ltBCOL
, "bcol", 2);
1936 AddMacroDef(ltBETA
, "beta", 0);
1937 AddMacroDef(ltBFSERIES
, "bfseries", 1);
1938 AddMacroDef(ltBF
, "bf", 1);
1939 AddMacroDef(ltBIBITEM
, "bibitem", 2); // For convenience, bibitem has 2 args: label and item.
1940 // The Latex syntax permits writing as 2 args.
1941 AddMacroDef(ltBIBLIOGRAPHYSTYLE
, "bibliographystyle", 1);
1942 AddMacroDef(ltBIBLIOGRAPHY
, "bibliography", 1);
1943 AddMacroDef(ltBIGTRIANGLEDOWN
, "bigtriangledown", 0);
1944 AddMacroDef(ltBOT
, "bot", 0);
1945 AddMacroDef(ltBOXIT
, "boxit", 1);
1946 AddMacroDef(ltBOX
, "box", 0);
1947 AddMacroDef(ltBRCLEAR
, "brclear", 0);
1948 AddMacroDef(ltBULLET
, "bullet", 0);
1950 AddMacroDef(ltCAPTIONSTAR
, "caption*", 1);
1951 AddMacroDef(ltCAPTION
, "caption", 1);
1952 AddMacroDef(ltCAP
, "cap", 0);
1953 AddMacroDef(ltCDOTS
, "cdots", 0);
1954 AddMacroDef(ltCDOT
, "cdot", 0);
1955 AddMacroDef(ltCENTERLINE
, "centerline", 1);
1956 AddMacroDef(ltCENTERING
, "centering", 0);
1957 AddMacroDef(ltCENTER
, "center", 1);
1958 AddMacroDef(ltCEXTRACT
, "cextract", 0);
1959 AddMacroDef(ltCHAPTERHEADING
, "chapterheading", 1);
1960 AddMacroDef(ltCHAPTERSTAR
, "chapter*", 1);
1961 AddMacroDef(ltCHAPTER
, "chapter", 1);
1962 AddMacroDef(ltCHI
, "chi", 0);
1963 AddMacroDef(ltCINSERT
, "cinsert", 0);
1964 AddMacroDef(ltCIRC
, "circ", 0);
1965 AddMacroDef(ltCITE
, "cite", 1);
1966 AddMacroDef(ltCLASS
, "class", 1);
1967 AddMacroDef(ltCLEARDOUBLEPAGE
, "cleardoublepage", 0);
1968 AddMacroDef(ltCLEARPAGE
, "clearpage", 0);
1969 AddMacroDef(ltCLINE
, "cline", 1);
1970 AddMacroDef(ltCLIPSFUNC
, "clipsfunc", 3);
1971 AddMacroDef(ltCLUBSUIT
, "clubsuit", 0);
1972 AddMacroDef(ltCOLUMNSEP
, "columnsep", 1);
1973 AddMacroDef(ltCOMMENT
, "comment", 1, TRUE
);
1974 AddMacroDef(ltCONG
, "cong", 0);
1975 AddMacroDef(ltCOPYRIGHT
, "copyright", 0);
1976 AddMacroDef(ltCPARAM
, "cparam", 2);
1977 AddMacroDef(ltCHEAD
, "chead", 1);
1978 AddMacroDef(ltCFOOT
, "cfoot", 1);
1979 AddMacroDef(ltCUP
, "cup", 0);
1981 AddMacroDef(ltDASHV
, "dashv", 0);
1982 AddMacroDef(ltDATE
, "date", 1);
1983 AddMacroDef(ltDELTA
, "delta", 0);
1984 AddMacroDef(ltCAP_DELTA
, "Delta", 0);
1985 AddMacroDef(ltDEFINECOLOUR
, "definecolour", 4);
1986 AddMacroDef(ltDEFINECOLOR
, "definecolor", 4);
1987 AddMacroDef(ltDESCRIPTION
, "description", 1);
1988 AddMacroDef(ltDESTRUCT
, "destruct", 1);
1989 AddMacroDef(ltDIAMOND2
, "diamond2", 0);
1990 AddMacroDef(ltDIAMOND
, "diamond", 0);
1991 AddMacroDef(ltDIV
, "div", 0);
1992 AddMacroDef(ltDOCUMENTCLASS
, "documentclass", 1);
1993 AddMacroDef(ltDOCUMENTSTYLE
, "documentstyle", 1);
1994 AddMacroDef(ltDOCUMENT
, "document", 1);
1995 AddMacroDef(ltDOUBLESPACE
, "doublespace", 1);
1996 AddMacroDef(ltDOTEQ
, "doteq", 0);
1997 AddMacroDef(ltDOWNARROW
, "downarrow", 0);
1998 AddMacroDef(ltDOWNARROW2
, "Downarrow", 0);
2000 AddMacroDef(ltEMPTYSET
, "emptyset", 0);
2001 AddMacroDef(ltEMPH
, "emph", 1);
2002 AddMacroDef(ltEM
, "em", 1);
2003 AddMacroDef(ltENUMERATE
, "enumerate", 1);
2004 AddMacroDef(ltEPSILON
, "epsilon", 0);
2005 AddMacroDef(ltEQUATION
, "equation", 1);
2006 AddMacroDef(ltEQUIV
, "equiv", 0);
2007 AddMacroDef(ltETA
, "eta", 0);
2008 AddMacroDef(ltEVENSIDEMARGIN
, "evensidemargin", 1);
2009 AddMacroDef(ltEXISTS
, "exists", 0);
2011 AddMacroDef(ltFBOX
, "fbox", 1);
2012 AddMacroDef(ltFCOL
, "fcol", 2);
2013 AddMacroDef(ltFIGURE
, "figure", 1);
2014 AddMacroDef(ltFIGURESTAR
, "figure*", 1);
2015 AddMacroDef(ltFLUSHLEFT
, "flushleft", 1);
2016 AddMacroDef(ltFLUSHRIGHT
, "flushright", 1);
2017 AddMacroDef(ltFOLLOWEDLINKCOLOUR
, "followedlinkcolour", 1);
2018 AddMacroDef(ltFOOTHEIGHT
, "footheight", 1);
2019 AddMacroDef(ltFOOTNOTEPOPUP
, "footnotepopup", 2);
2020 AddMacroDef(ltFOOTNOTE
, "footnote", 1);
2021 AddMacroDef(ltFOOTSKIP
, "footskip", 1);
2022 AddMacroDef(ltFORALL
, "forall", 0);
2023 AddMacroDef(ltFRAMEBOX
, "framebox", 1);
2024 AddMacroDef(ltFROWN
, "frown", 0);
2025 AddMacroDef(ltFUNCTIONSECTION
, "functionsection", 1);
2026 AddMacroDef(ltFUNC
, "func", 3);
2027 AddMacroDef(ltFOOTNOTESIZE
, "footnotesize", 0);
2028 AddMacroDef(ltFANCYPLAIN
, "fancyplain", 2);
2030 AddMacroDef(ltGAMMA
, "gamma", 0);
2031 AddMacroDef(ltCAP_GAMMA
, "Gamma", 0);
2032 AddMacroDef(ltGEQ
, "geq", 0);
2033 AddMacroDef(ltGE
, "ge", 0);
2034 AddMacroDef(ltGG
, "gg", 0);
2035 AddMacroDef(ltGLOSSARY
, "glossary", 1);
2036 AddMacroDef(ltGLOSS
, "gloss", 1);
2038 AddMacroDef(ltHEADHEIGHT
, "headheight", 1);
2039 AddMacroDef(ltHEARTSUIT
, "heartsuit", 0);
2040 AddMacroDef(ltHELPGLOSSARY
, "helpglossary", 1);
2041 AddMacroDef(ltHELPIGNORE
, "helpignore", 1, TRUE
);
2042 AddMacroDef(ltHELPONLY
, "helponly", 1);
2043 AddMacroDef(ltHELPINPUT
, "helpinput", 1);
2044 AddMacroDef(ltHELPFONTFAMILY
, "helpfontfamily", 1);
2045 AddMacroDef(ltHELPFONTSIZE
, "helpfontsize", 1);
2046 AddMacroDef(ltHELPREFN
, "helprefn", 2);
2047 AddMacroDef(ltHELPREF
, "helpref", 2);
2048 AddMacroDef(ltHFILL
, "hfill", 0);
2049 AddMacroDef(ltHLINE
, "hline", 0);
2050 AddMacroDef(ltHRULE
, "hrule", 0);
2051 AddMacroDef(ltHSPACESTAR
, "hspace*", 1);
2052 AddMacroDef(ltHSPACE
, "hspace", 1);
2053 AddMacroDef(ltHSKIPSTAR
, "hskip*", 1);
2054 AddMacroDef(ltHSKIP
, "hskip", 1);
2055 AddMacroDef(lthuge
, "huge", 1);
2056 AddMacroDef(ltHuge
, "Huge", 1);
2057 AddMacroDef(ltHUGE
, "HUGE", 1);
2058 AddMacroDef(ltHTMLIGNORE
, "htmlignore", 1);
2059 AddMacroDef(ltHTMLONLY
, "htmlonly", 1);
2061 AddMacroDef(ltIM
, "im", 0);
2062 AddMacroDef(ltINCLUDEONLY
, "includeonly", 1);
2063 AddMacroDef(ltINCLUDE
, "include", 1);
2064 AddMacroDef(ltINDENTED
, "indented", 2);
2065 AddMacroDef(ltINDEX
, "index", 1);
2066 AddMacroDef(ltINPUT
, "input", 1, TRUE
);
2067 AddMacroDef(ltIOTA
, "iota", 0);
2068 AddMacroDef(ltITEMIZE
, "itemize", 1);
2069 AddMacroDef(ltITEM
, "item", 0);
2070 AddMacroDef(ltIMAGEMAP
, "imagemap", 3);
2071 AddMacroDef(ltIMAGEL
, "imagel", 2);
2072 AddMacroDef(ltIMAGER
, "imager", 2);
2073 AddMacroDef(ltIMAGE
, "image", 2);
2074 AddMacroDef(ltIN
, "in", 0);
2075 AddMacroDef(ltINFTY
, "infty", 0);
2076 AddMacroDef(ltITSHAPE
, "itshape", 1);
2077 AddMacroDef(ltIT
, "it", 1);
2078 AddMacroDef(ltITEMSEP
, "itemsep", 1);
2079 AddMacroDef(ltINSERTATLEVEL
, "insertatlevel", 2);
2081 AddMacroDef(ltKAPPA
, "kappa", 0);
2082 AddMacroDef(ltKILL
, "kill", 0);
2084 AddMacroDef(ltLABEL
, "label", 1);
2085 AddMacroDef(ltLAMBDA
, "lambda", 0);
2086 AddMacroDef(ltCAP_LAMBDA
, "Lambda", 0);
2087 AddMacroDef(ltlarge
, "large", 1);
2088 AddMacroDef(ltLarge
, "Large", 1);
2089 AddMacroDef(ltLARGE
, "LARGE", 1);
2090 AddMacroDef(ltLATEXIGNORE
, "latexignore", 1);
2091 AddMacroDef(ltLATEXONLY
, "latexonly", 1);
2092 AddMacroDef(ltLATEX
, "LaTeX", 0);
2093 AddMacroDef(ltLBOX
, "lbox", 1);
2094 AddMacroDef(ltLBRACERAW
, "lbraceraw", 0);
2095 AddMacroDef(ltLDOTS
, "ldots", 0);
2096 AddMacroDef(ltLEQ
, "leq", 0);
2097 AddMacroDef(ltLE
, "le", 0);
2098 AddMacroDef(ltLEFTARROW
, "leftarrow", 0);
2099 AddMacroDef(ltLEFTRIGHTARROW
, "leftrightarrow", 0);
2100 AddMacroDef(ltLEFTARROW2
, "Leftarrow", 0);
2101 AddMacroDef(ltLEFTRIGHTARROW2
, "Leftrightarrow", 0);
2102 AddMacroDef(ltLINEBREAK
, "linebreak", 0);
2103 AddMacroDef(ltLINKCOLOUR
, "linkcolour", 1);
2104 AddMacroDef(ltLISTOFFIGURES
, "listoffigures", 0);
2105 AddMacroDef(ltLISTOFTABLES
, "listoftables", 0);
2106 AddMacroDef(ltLHEAD
, "lhead", 1);
2107 AddMacroDef(ltLFOOT
, "lfoot", 1);
2108 AddMacroDef(ltLOWERCASE
, "lowercase", 1);
2109 AddMacroDef(ltLL
, "ll", 0);
2111 AddMacroDef(ltMAKEGLOSSARY
, "makeglossary", 0);
2112 AddMacroDef(ltMAKEINDEX
, "makeindex", 0);
2113 AddMacroDef(ltMAKETITLE
, "maketitle", 0);
2114 AddMacroDef(ltMARKRIGHT
, "markright", 1);
2115 AddMacroDef(ltMARKBOTH
, "markboth", 2);
2116 AddMacroDef(ltMARGINPARWIDTH
, "marginparwidth", 1);
2117 AddMacroDef(ltMARGINPARSEP
, "marginparsep", 1);
2118 AddMacroDef(ltMARGINPARODD
, "marginparodd", 1);
2119 AddMacroDef(ltMARGINPAREVEN
, "marginpareven", 1);
2120 AddMacroDef(ltMARGINPAR
, "marginpar", 1);
2121 AddMacroDef(ltMBOX
, "mbox", 1);
2122 AddMacroDef(ltMDSERIES
, "mdseries", 1);
2123 AddMacroDef(ltMEMBERSECTION
, "membersection", 1);
2124 AddMacroDef(ltMEMBER
, "member", 2);
2125 AddMacroDef(ltMID
, "mid", 0);
2126 AddMacroDef(ltMODELS
, "models", 0);
2127 AddMacroDef(ltMP
, "mp", 0);
2128 AddMacroDef(ltMULTICOLUMN
, "multicolumn", 3);
2129 AddMacroDef(ltMU
, "mu", 0);
2131 AddMacroDef(ltNABLA
, "nabla", 0);
2132 AddMacroDef(ltNEG
, "neg", 0);
2133 AddMacroDef(ltNEQ
, "neq", 0);
2134 AddMacroDef(ltNEWCOUNTER
, "newcounter", 1, FALSE
, (bool)FORBID_ABSOLUTELY
);
2135 AddMacroDef(ltNEWLINE
, "newline", 0);
2136 AddMacroDef(ltNEWPAGE
, "newpage", 0);
2137 AddMacroDef(ltNI
, "ni", 0);
2138 AddMacroDef(ltNOCITE
, "nocite", 1);
2139 AddMacroDef(ltNOINDENT
, "noindent", 0);
2140 AddMacroDef(ltNOLINEBREAK
, "nolinebreak", 0);
2141 AddMacroDef(ltNOPAGEBREAK
, "nopagebreak", 0);
2142 AddMacroDef(ltNORMALSIZE
, "normalsize", 1);
2143 AddMacroDef(ltNORMALBOX
, "normalbox", 1);
2144 AddMacroDef(ltNORMALBOXD
, "normalboxd", 1);
2145 AddMacroDef(ltNOTEQ
, "noteq", 0);
2146 AddMacroDef(ltNOTIN
, "notin", 0);
2147 AddMacroDef(ltNOTSUBSET
, "notsubset", 0);
2148 AddMacroDef(ltNU
, "nu", 0);
2150 AddMacroDef(ltODDSIDEMARGIN
, "oddsidemargin", 1);
2151 AddMacroDef(ltOMEGA
, "omega", 0);
2152 AddMacroDef(ltCAP_OMEGA
, "Omega", 0);
2153 AddMacroDef(ltONECOLUMN
, "onecolumn", 0);
2154 AddMacroDef(ltOPLUS
, "oplus", 0);
2155 AddMacroDef(ltOSLASH
, "oslash", 0);
2156 AddMacroDef(ltOTIMES
, "otimes", 0);
2158 AddMacroDef(ltPAGEBREAK
, "pagebreak", 0);
2159 AddMacroDef(ltPAGEREF
, "pageref", 1);
2160 AddMacroDef(ltPAGESTYLE
, "pagestyle", 1);
2161 AddMacroDef(ltPAGENUMBERING
, "pagenumbering", 1);
2162 AddMacroDef(ltPARAGRAPHSTAR
, "paragraph*", 1);
2163 AddMacroDef(ltPARAGRAPH
, "paragraph", 1);
2164 AddMacroDef(ltPARALLEL
, "parallel", 0);
2165 AddMacroDef(ltPARAM
, "param", 2);
2166 AddMacroDef(ltPARINDENT
, "parindent", 1);
2167 AddMacroDef(ltPARSKIP
, "parskip", 1);
2168 AddMacroDef(ltPARTIAL
, "partial", 0);
2169 AddMacroDef(ltPARTSTAR
, "part*", 1);
2170 AddMacroDef(ltPART
, "part", 1);
2171 AddMacroDef(ltPAR
, "par", 0);
2172 AddMacroDef(ltPERP
, "perp", 0);
2173 AddMacroDef(ltPHI
, "phi", 0);
2174 AddMacroDef(ltCAP_PHI
, "Phi", 0);
2175 AddMacroDef(ltPFUNC
, "pfunc", 3);
2176 AddMacroDef(ltPICTURE
, "picture", 1);
2177 AddMacroDef(ltPI
, "pi", 0);
2178 AddMacroDef(ltCAP_PI
, "Pi", 0);
2179 AddMacroDef(ltPM
, "pm", 0);
2180 AddMacroDef(ltPOPREFONLY
, "poprefonly", 1);
2181 AddMacroDef(ltPOPREF
, "popref", 2);
2182 AddMacroDef(ltPOUNDS
, "pounds", 0);
2183 AddMacroDef(ltPREC
, "prec", 0);
2184 AddMacroDef(ltPRECEQ
, "preceq", 0);
2185 AddMacroDef(ltPRINTINDEX
, "printindex", 0);
2186 AddMacroDef(ltPROPTO
, "propto", 0);
2187 AddMacroDef(ltPSBOXTO
, "psboxto", 1, FALSE
, (bool)FORBID_ABSOLUTELY
);
2188 AddMacroDef(ltPSBOX
, "psbox", 1, FALSE
, (bool)FORBID_ABSOLUTELY
);
2189 AddMacroDef(ltPSI
, "psi", 0);
2190 AddMacroDef(ltCAP_PSI
, "Psi", 0);
2192 AddMacroDef(ltQUOTE
, "quote", 1);
2193 AddMacroDef(ltQUOTATION
, "quotation", 1);
2195 AddMacroDef(ltRAGGEDBOTTOM
, "raggedbottom", 0);
2196 AddMacroDef(ltRAGGEDLEFT
, "raggedleft", 0);
2197 AddMacroDef(ltRAGGEDRIGHT
, "raggedright", 0);
2198 AddMacroDef(ltRBRACERAW
, "rbraceraw", 0);
2199 AddMacroDef(ltREF
, "ref", 1);
2200 AddMacroDef(ltREGISTERED
, "registered", 0);
2201 AddMacroDef(ltRE
, "we", 0);
2202 AddMacroDef(ltRHO
, "rho", 0);
2203 AddMacroDef(ltRIGHTARROW
, "rightarrow", 0);
2204 AddMacroDef(ltRIGHTARROW2
, "rightarrow2", 0);
2205 AddMacroDef(ltRMFAMILY
, "rmfamily", 1);
2206 AddMacroDef(ltRM
, "rm", 1);
2207 AddMacroDef(ltROMAN
, "roman", 1);
2208 AddMacroDef(ltROMAN2
, "Roman", 1);
2209 // AddMacroDef(lt"row", 1);
2210 AddMacroDef(ltRTFSP
, "rtfsp", 0);
2211 AddMacroDef(ltRTFIGNORE
, "rtfignore", 1);
2212 AddMacroDef(ltRTFONLY
, "rtfonly", 1);
2213 AddMacroDef(ltRULEDROW
, "ruledrow", 1);
2214 AddMacroDef(ltDRULED
, "druled", 1);
2215 AddMacroDef(ltRULE
, "rule", 2);
2216 AddMacroDef(ltRHEAD
, "rhead", 1);
2217 AddMacroDef(ltRFOOT
, "rfoot", 1);
2218 AddMacroDef(ltROW
, "row", 1);
2220 AddMacroDef(ltSCSHAPE
, "scshape", 1);
2221 AddMacroDef(ltSC
, "sc", 1);
2222 AddMacroDef(ltSECTIONHEADING
, "sectionheading", 1);
2223 AddMacroDef(ltSECTIONSTAR
, "section*", 1);
2224 AddMacroDef(ltSECTION
, "section", 1);
2225 AddMacroDef(ltSETCOUNTER
, "setcounter", 2);
2226 AddMacroDef(ltSFFAMILY
, "sffamily", 1);
2227 AddMacroDef(ltSF
, "sf", 1);
2228 AddMacroDef(ltSHARP
, "sharp", 0);
2229 AddMacroDef(ltSHORTCITE
, "shortcite", 1);
2230 AddMacroDef(ltSIGMA
, "sigma", 0);
2231 AddMacroDef(ltCAP_SIGMA
, "Sigma", 0);
2232 AddMacroDef(ltSIM
, "sim", 0);
2233 AddMacroDef(ltSIMEQ
, "simeq", 0);
2234 AddMacroDef(ltSINGLESPACE
, "singlespace", 1);
2235 AddMacroDef(ltSIZEDBOX
, "sizedbox", 2);
2236 AddMacroDef(ltSIZEDBOXD
, "sizedboxd", 2);
2237 AddMacroDef(ltSLOPPYPAR
, "sloppypar", 1);
2238 AddMacroDef(ltSLOPPY
, "sloppy", 0);
2239 AddMacroDef(ltSLSHAPE
, "slshape", 1);
2240 AddMacroDef(ltSL
, "sl", 1);
2241 AddMacroDef(ltSMALL
, "small", 1);
2242 AddMacroDef(ltSMILE
, "smile", 0);
2243 AddMacroDef(ltSS
, "ss", 0);
2244 AddMacroDef(ltSTAR
, "star", 0);
2245 AddMacroDef(ltSUBITEM
, "subitem", 0);
2246 AddMacroDef(ltSUBPARAGRAPHSTAR
, "subparagraph*", 1);
2247 AddMacroDef(ltSUBPARAGRAPH
, "subparagraph", 1);
2248 AddMacroDef(ltSPECIAL
, "special", 1);
2249 AddMacroDef(ltSUBSECTIONSTAR
, "subsection*", 1);
2250 AddMacroDef(ltSUBSECTION
, "subsection", 1);
2251 AddMacroDef(ltSUBSETEQ
, "subseteq", 0);
2252 AddMacroDef(ltSUBSET
, "subset", 0);
2253 AddMacroDef(ltSUCC
, "succ", 0);
2254 AddMacroDef(ltSUCCEQ
, "succeq", 0);
2255 AddMacroDef(ltSUPSETEQ
, "supseteq", 0);
2256 AddMacroDef(ltSUPSET
, "supset", 0);
2257 AddMacroDef(ltSUBSUBSECTIONSTAR
,"subsubsection*", 1);
2258 AddMacroDef(ltSUBSUBSECTION
, "subsubsection", 1);
2259 AddMacroDef(ltSUPERTABULAR
, "supertabular", 2, FALSE
);
2260 AddMacroDef(ltSURD
, "surd", 0);
2261 AddMacroDef(ltSCRIPTSIZE
, "scriptsize", 1);
2262 AddMacroDef(ltSETHEADER
, "setheader", 6);
2263 AddMacroDef(ltSETFOOTER
, "setfooter", 6);
2264 AddMacroDef(ltSETHOTSPOTCOLOUR
, "sethotspotcolour", 1);
2265 AddMacroDef(ltSETHOTSPOTCOLOR
, "sethotspotcolor", 1);
2266 AddMacroDef(ltSETHOTSPOTUNDERLINE
, "sethotspotunderline", 1);
2267 AddMacroDef(ltSETTRANSPARENCY
, "settransparency", 1);
2268 AddMacroDef(ltSPADESUIT
, "spadesuit", 0);
2270 AddMacroDef(ltTABBING
, "tabbing", 2);
2271 AddMacroDef(ltTABLEOFCONTENTS
, "tableofcontents", 0);
2272 AddMacroDef(ltTABLE
, "table", 1);
2273 AddMacroDef(ltTABULAR
, "tabular", 2, FALSE
);
2274 AddMacroDef(ltTAB
, "tab", 0);
2275 AddMacroDef(ltTAU
, "tau", 0);
2276 AddMacroDef(ltTEXTRM
, "textrm", 1);
2277 AddMacroDef(ltTEXTSF
, "textsf", 1);
2278 AddMacroDef(ltTEXTTT
, "texttt", 1);
2279 AddMacroDef(ltTEXTBF
, "textbf", 1);
2280 AddMacroDef(ltTEXTIT
, "textit", 1);
2281 AddMacroDef(ltTEXTSL
, "textsl", 1);
2282 AddMacroDef(ltTEXTSC
, "textsc", 1);
2283 AddMacroDef(ltTEXTWIDTH
, "textwidth", 1);
2284 AddMacroDef(ltTEXTHEIGHT
, "textheight", 1);
2285 AddMacroDef(ltTEXTCOLOUR
, "textcolour", 1);
2286 AddMacroDef(ltTEX
, "TeX", 0);
2287 AddMacroDef(ltTHEBIBLIOGRAPHY
, "thebibliography", 2);
2288 AddMacroDef(ltTHETA
, "theta", 0);
2289 AddMacroDef(ltTIMES
, "times", 0);
2290 AddMacroDef(ltCAP_THETA
, "Theta", 0);
2291 AddMacroDef(ltTITLEPAGE
, "titlepage", 1);
2292 AddMacroDef(ltTITLE
, "title", 1);
2293 AddMacroDef(ltTINY
, "tiny", 1);
2294 AddMacroDef(ltTODAY
, "today", 0);
2295 AddMacroDef(ltTOPMARGIN
, "topmargin", 1);
2296 AddMacroDef(ltTOPSKIP
, "topskip", 1);
2297 AddMacroDef(ltTRIANGLE
, "triangle", 0);
2298 AddMacroDef(ltTTFAMILY
, "ttfamily", 1);
2299 AddMacroDef(ltTT
, "tt", 1);
2300 AddMacroDef(ltTYPEIN
, "typein", 1);
2301 AddMacroDef(ltTYPEOUT
, "typeout", 1);
2302 AddMacroDef(ltTWOCOLWIDTHA
, "twocolwidtha", 1);
2303 AddMacroDef(ltTWOCOLWIDTHB
, "twocolwidthb", 1);
2304 AddMacroDef(ltTWOCOLSPACING
, "twocolspacing", 1);
2305 AddMacroDef(ltTWOCOLITEMRULED
, "twocolitemruled", 2);
2306 AddMacroDef(ltTWOCOLITEM
, "twocolitem", 2);
2307 AddMacroDef(ltTWOCOLLIST
, "twocollist", 1);
2308 AddMacroDef(ltTWOCOLUMN
, "twocolumn", 0);
2309 AddMacroDef(ltTHEPAGE
, "thepage", 0);
2310 AddMacroDef(ltTHECHAPTER
, "thechapter", 0);
2311 AddMacroDef(ltTHESECTION
, "thesection", 0);
2312 AddMacroDef(ltTHISPAGESTYLE
, "thispagestyle", 1);
2314 AddMacroDef(ltUNDERLINE
, "underline", 1);
2315 AddMacroDef(ltUPSILON
, "upsilon", 0);
2316 AddMacroDef(ltCAP_UPSILON
, "Upsilon", 0);
2317 AddMacroDef(ltUPARROW
, "uparrow", 0);
2318 AddMacroDef(ltUPARROW2
, "Uparrow", 0);
2319 AddMacroDef(ltUPPERCASE
, "uppercase", 1);
2320 AddMacroDef(ltUPSHAPE
, "upshape", 1);
2321 AddMacroDef(ltURLREF
, "urlref", 2);
2322 AddMacroDef(ltUSEPACKAGE
, "usepackage", 1);
2324 AddMacroDef(ltVAREPSILON
, "varepsilon", 0);
2325 AddMacroDef(ltVARPHI
, "varphi", 0);
2326 AddMacroDef(ltVARPI
, "varpi", 0);
2327 AddMacroDef(ltVARRHO
, "varrho", 0);
2328 AddMacroDef(ltVARSIGMA
, "varsigma", 0);
2329 AddMacroDef(ltVARTHETA
, "vartheta", 0);
2330 AddMacroDef(ltVDOTS
, "vdots", 0);
2331 AddMacroDef(ltVEE
, "vee", 0);
2332 AddMacroDef(ltVERBATIMINPUT
, "verbatiminput", 1);
2333 AddMacroDef(ltVERBATIM
, "verbatim", 1);
2334 AddMacroDef(ltVERBSTAR
, "verb*", 1);
2335 AddMacroDef(ltVERB
, "verb", 1);
2336 AddMacroDef(ltVERSE
, "verse", 1);
2337 AddMacroDef(ltVFILL
, "vfill", 0);
2338 AddMacroDef(ltVLINE
, "vline", 0);
2339 AddMacroDef(ltVOID
, "void", 0);
2340 AddMacroDef(ltVDASH
, "vdash", 0);
2341 AddMacroDef(ltVRULE
, "vrule", 0);
2342 AddMacroDef(ltVSPACESTAR
, "vspace*", 1);
2343 AddMacroDef(ltVSKIPSTAR
, "vskip*", 1);
2344 AddMacroDef(ltVSPACE
, "vspace", 1);
2345 AddMacroDef(ltVSKIP
, "vskip", 1);
2347 AddMacroDef(ltWEDGE
, "wedge", 0);
2348 AddMacroDef(ltWXCLIPS
, "wxclips", 0);
2349 AddMacroDef(ltWINHELPIGNORE
, "winhelpignore", 1);
2350 AddMacroDef(ltWINHELPONLY
, "winhelponly", 1);
2351 AddMacroDef(ltWP
, "wp", 0);
2353 AddMacroDef(ltXI
, "xi", 0);
2354 AddMacroDef(ltCAP_XI
, "Xi", 0);
2355 AddMacroDef(ltXLPIGNORE
, "xlpignore", 1);
2356 AddMacroDef(ltXLPONLY
, "xlponly", 1);
2358 AddMacroDef(ltZETA
, "zeta", 0);
2360 AddMacroDef(ltSPACE
, " ", 0);
2361 AddMacroDef(ltBACKSLASHCHAR
, "\\", 0);
2362 AddMacroDef(ltPIPE
, "|", 0);
2363 AddMacroDef(ltFORWARDSLASH
, "/", 0);
2364 AddMacroDef(ltUNDERSCORE
, "_", 0);
2365 AddMacroDef(ltAMPERSAND
, "&", 0);
2366 AddMacroDef(ltPERCENT
, "%", 0);
2367 AddMacroDef(ltDOLLAR
, "$", 0);
2368 AddMacroDef(ltHASH
, "#", 0);
2369 AddMacroDef(ltLPARENTH
, "(", 0);
2370 AddMacroDef(ltRPARENTH
, ")", 0);
2371 AddMacroDef(ltLBRACE
, "{", 0);
2372 AddMacroDef(ltRBRACE
, "}", 0);
2373 // AddMacroDef(ltEQUALS, "=", 0);
2374 AddMacroDef(ltRANGLEBRA
, ">", 0);
2375 AddMacroDef(ltLANGLEBRA
, "<", 0);
2376 AddMacroDef(ltPLUS
, "+", 0);
2377 AddMacroDef(ltDASH
, "-", 0);
2378 AddMacroDef(ltAT_SYMBOL
, "@", 0);
2379 // AddMacroDef(ltSINGLEQUOTE, "'", 0);
2380 // AddMacroDef(ltBACKQUOTE, "`", 0);
2384 * Default behaviour, should be called by client if can't match locally.
2388 // Called on start/end of macro examination
2389 void DefaultOnMacro(int macroId
, int no_args
, bool start
)
2393 // Default behaviour for abstract
2398 // Write the heading
2399 FakeCurrentSection(AbstractNameString
);
2400 OnMacro(ltPAR
, 0, TRUE
);
2401 OnMacro(ltPAR
, 0, FALSE
);
2405 if (DocumentStyle
== LATEX_ARTICLE
)
2413 // Default behaviour for glossary
2414 case ltHELPGLOSSARY
:
2418 // Write the heading
2419 FakeCurrentSection(GlossaryNameString
);
2420 OnMacro(ltPAR
, 0, TRUE
);
2421 OnMacro(ltPAR
, 0, FALSE
);
2422 if ((convertMode
== TEX_RTF
) && !winHelp
)
2424 OnMacro(ltPAR
, 0, TRUE
);
2425 OnMacro(ltPAR
, 0, FALSE
);
2430 case ltSPECIALAMPERSAND
:
2437 TexOutput("<<", TRUE
);
2441 TexOutput(">>", TRUE
);
2445 TexOutput("~", TRUE
);
2449 TexOutput("~", TRUE
);
2451 case ltSPECIALTILDE
:
2453 TexOutput(" ", TRUE
);
2457 TexOutput("_", TRUE
);
2461 TexOutput("#", TRUE
);
2465 TexOutput("&", TRUE
);
2469 TexOutput(" ", TRUE
);
2473 TexOutput("|", TRUE
);
2477 TexOutput("%", TRUE
);
2481 TexOutput("$", TRUE
);
2485 TexOutput("", TRUE
);
2489 TexOutput("", TRUE
);
2493 TexOutput("{", TRUE
);
2497 TexOutput("}", TRUE
);
2501 TexOutput("(c)", TRUE
);
2505 TexOutput("(r)", TRUE
);
2509 TexOutput("\\", TRUE
);
2514 TexOutput("...", TRUE
);
2518 TexOutput("|", TRUE
);
2522 TexOutput("LaTeX", TRUE
);
2526 TexOutput("TeX", TRUE
);
2530 TexOutput("£", TRUE
);
2532 case ltSPECIALDOUBLEDOLLAR
: // Interpret as center
2533 OnMacro(ltCENTER
, no_args
, start
);
2539 OnMacro(ltIT
, no_args
, start
);
2542 case ltPARAGRAPHSTAR
:
2543 case ltSUBPARAGRAPH
:
2544 case ltSUBPARAGRAPHSTAR
:
2545 OnMacro(ltSUBSUBSECTION
, no_args
, start
);
2553 TexOutput(ctime(&when
), TRUE
);
2564 if (start
) TexOutput("alpha");
2567 if (start
) TexOutput("beta");
2570 if (start
) TexOutput("gamma");
2573 if (start
) TexOutput("delta");
2577 if (start
) TexOutput("epsilon");
2580 if (start
) TexOutput("zeta");
2583 if (start
) TexOutput("eta");
2587 if (start
) TexOutput("theta");
2590 if (start
) TexOutput("iota");
2593 if (start
) TexOutput("kappa");
2596 if (start
) TexOutput("lambda");
2599 if (start
) TexOutput("mu");
2602 if (start
) TexOutput("nu");
2605 if (start
) TexOutput("xi");
2609 if (start
) TexOutput("pi");
2613 if (start
) TexOutput("rho");
2617 if (start
) TexOutput("sigma");
2620 if (start
) TexOutput("tau");
2623 if (start
) TexOutput("upsilon");
2627 if (start
) TexOutput("phi");
2630 if (start
) TexOutput("chi");
2633 if (start
) TexOutput("psi");
2636 if (start
) TexOutput("omega");
2639 if (start
) TexOutput("GAMMA");
2642 if (start
) TexOutput("DELTA");
2645 if (start
) TexOutput("THETA");
2648 if (start
) TexOutput("LAMBDA");
2651 if (start
) TexOutput("XI");
2654 if (start
) TexOutput("PI");
2657 if (start
) TexOutput("SIGMA");
2660 if (start
) TexOutput("UPSILON");
2663 if (start
) TexOutput("PHI");
2666 if (start
) TexOutput("PSI");
2669 if (start
) TexOutput("OMEGA");
2672 // Binary operation symbols
2675 if (start
) TexOutput("<=");
2678 if (start
) TexOutput("<<");
2681 if (start
) TexOutput("SUBSET");
2684 if (start
) TexOutput("SUBSETEQ");
2687 if (start
) TexOutput("IN");
2690 if (start
) TexOutput("VDASH");
2693 if (start
) TexOutput("MODELS");
2697 if (start
) TexOutput(">=");
2700 if (start
) TexOutput(">>");
2703 if (start
) TexOutput("SUPSET");
2706 if (start
) TexOutput("SUPSETEQ");
2709 if (start
) TexOutput("NI");
2712 if (start
) TexOutput("DASHV");
2715 if (start
) TexOutput("PERP");
2718 if (start
) TexOutput("NEQ");
2721 if (start
) TexOutput("DOTEQ");
2724 if (start
) TexOutput("APPROX");
2727 if (start
) TexOutput("CONG");
2730 if (start
) TexOutput("EQUIV");
2733 if (start
) TexOutput("PROPTO");
2736 if (start
) TexOutput("PREC");
2739 if (start
) TexOutput("PRECEQ");
2742 if (start
) TexOutput("|");
2745 if (start
) TexOutput("~");
2748 if (start
) TexOutput("SIMEQ");
2751 if (start
) TexOutput("ASYMP");
2754 if (start
) TexOutput(":-)");
2757 if (start
) TexOutput(":-(");
2760 if (start
) TexOutput("SUCC");
2763 if (start
) TexOutput("SUCCEQ");
2766 if (start
) TexOutput("|");
2769 // Negated relation symbols
2771 if (start
) TexOutput("!=");
2774 if (start
) TexOutput("NOTIN");
2777 if (start
) TexOutput("NOTSUBSET");
2782 if (start
) TexOutput("<--");
2785 if (start
) TexOutput("<==");
2788 if (start
) TexOutput("-->");
2791 if (start
) TexOutput("==>");
2793 case ltLEFTRIGHTARROW
:
2794 if (start
) TexOutput("<-->");
2796 case ltLEFTRIGHTARROW2
:
2797 if (start
) TexOutput("<==>");
2800 if (start
) TexOutput("UPARROW");
2803 if (start
) TexOutput("UPARROW2");
2806 if (start
) TexOutput("DOWNARROW");
2809 if (start
) TexOutput("DOWNARROW2");
2811 // Miscellaneous symbols
2813 if (start
) TexOutput("ALEPH");
2816 if (start
) TexOutput("WP");
2819 if (start
) TexOutput("RE");
2822 if (start
) TexOutput("IM");
2825 if (start
) TexOutput("EMPTYSET");
2828 if (start
) TexOutput("NABLA");
2831 if (start
) TexOutput("SURD");
2834 if (start
) TexOutput("PARTIAL");
2837 if (start
) TexOutput("BOT");
2840 if (start
) TexOutput("FORALL");
2843 if (start
) TexOutput("EXISTS");
2846 if (start
) TexOutput("NEG");
2849 if (start
) TexOutput("SHARP");
2852 if (start
) TexOutput("ANGLE");
2855 if (start
) TexOutput("TRIANGLE");
2858 if (start
) TexOutput("CLUBSUIT");
2861 if (start
) TexOutput("DIAMONDSUIT");
2864 if (start
) TexOutput("HEARTSUIT");
2867 if (start
) TexOutput("SPADESUIT");
2870 if (start
) TexOutput("INFTY");
2873 if (start
) TexOutput("PM");
2876 if (start
) TexOutput("MP");
2879 if (start
) TexOutput("TIMES");
2882 if (start
) TexOutput("DIV");
2885 if (start
) TexOutput("CDOT");
2888 if (start
) TexOutput("AST");
2891 if (start
) TexOutput("STAR");
2894 if (start
) TexOutput("CAP");
2897 if (start
) TexOutput("CUP");
2900 if (start
) TexOutput("VEE");
2903 if (start
) TexOutput("WEDGE");
2906 if (start
) TexOutput("CIRC");
2909 if (start
) TexOutput("BULLET");
2912 if (start
) TexOutput("DIAMOND");
2915 if (start
) TexOutput("OSLASH");
2918 if (start
) TexOutput("BOX");
2921 if (start
) TexOutput("DIAMOND2");
2923 case ltBIGTRIANGLEDOWN
:
2924 if (start
) TexOutput("BIGTRIANGLEDOWN");
2927 if (start
) TexOutput("OPLUS");
2930 if (start
) TexOutput("OTIMES");
2933 if (start
) TexOutput("s");
2935 case ltBACKSLASHRAW
:
2936 if (start
) TexOutput("\\");
2939 if (start
) TexOutput("{");
2942 if (start
) TexOutput("}");
2946 if (start
) TexOutput(" ");
2953 // Called on start/end of argument examination
2954 bool DefaultOnArgument(int macroId
, int arg_no
, bool start
)
2960 if (arg_no
== 1 && start
)
2962 char *refName
= GetArgData();
2965 TexRef
*texRef
= FindReference(refName
);
2968 // Must strip the 'section' or 'chapter' or 'figure' text
2969 // from a normal 'ref' reference
2971 strcpy(buf
, texRef
->sectionNumber
);
2972 int len
= strlen(buf
);
2974 if (strcmp(buf
, "??") != 0)
2986 TexOutput(texRef
->sectionNumber
+ i
, TRUE
);
2991 TexOutput("??", TRUE
);
2992 sprintf(buf
, "Warning: unresolved reference %s.", refName
);
2996 else TexOutput("??", TRUE
);
3008 if (start
&& (arg_no
== 1))
3009 DocumentAuthor
= GetArgChunk();
3015 if (start
&& (arg_no
== 1))
3016 DocumentDate
= GetArgChunk();
3022 if (start
&& (arg_no
== 1))
3023 DocumentTitle
= GetArgChunk();
3027 case ltDOCUMENTCLASS
:
3028 case ltDOCUMENTSTYLE
:
3030 if (start
&& !IsArgOptional())
3032 DocumentStyleString
= copystring(GetArgData());
3033 if (strncmp(DocumentStyleString
, "art", 3) == 0)
3034 DocumentStyle
= LATEX_ARTICLE
;
3035 else if (strncmp(DocumentStyleString
, "rep", 3) == 0)
3036 DocumentStyle
= LATEX_REPORT
;
3037 else if (strncmp(DocumentStyleString
, "book", 4) == 0 ||
3038 strncmp(DocumentStyleString
, "thesis", 6) == 0)
3039 DocumentStyle
= LATEX_BOOK
;
3040 else if (strncmp(DocumentStyleString
, "letter", 6) == 0)
3041 DocumentStyle
= LATEX_LETTER
;
3042 else if (strncmp(DocumentStyleString
, "slides", 6) == 0)
3043 DocumentStyle
= LATEX_SLIDES
;
3045 if (StringMatch("10", DocumentStyleString
))
3047 else if (StringMatch("11", DocumentStyleString
))
3049 else if (StringMatch("12", DocumentStyleString
))
3052 OnMacro(ltHELPFONTSIZE
, 1, TRUE
);
3053 sprintf(currentArgData
, "%d", normalFont
);
3055 OnArgument(ltHELPFONTSIZE
, 1, TRUE
);
3056 OnArgument(ltHELPFONTSIZE
, 1, FALSE
);
3057 haveArgData
= FALSE
;
3058 OnMacro(ltHELPFONTSIZE
, 1, FALSE
);
3060 else if (start
&& IsArgOptional())
3062 MinorDocumentStyleString
= copystring(GetArgData());
3064 if (StringMatch("10", MinorDocumentStyleString
))
3066 else if (StringMatch("11", MinorDocumentStyleString
))
3068 else if (StringMatch("12", MinorDocumentStyleString
))
3074 case ltBIBLIOGRAPHYSTYLE
:
3076 if (start
&& !IsArgOptional())
3077 BibliographyStyleString
= copystring(GetArgData());
3083 if (start
&& !IsArgOptional())
3085 if (PageStyle
) delete[] PageStyle
;
3086 PageStyle
= copystring(GetArgData());
3094 if (start && !IsArgOptional())
3095 LeftHeader = GetArgChunk();
3101 if (start && !IsArgOptional())
3102 LeftFooter = GetArgChunk();
3108 if (start && !IsArgOptional())
3109 CentreHeader = GetArgChunk();
3115 if (start && !IsArgOptional())
3116 CentreFooter = GetArgChunk();
3122 if (start && !IsArgOptional())
3123 RightHeader = GetArgChunk();
3129 if (start && !IsArgOptional())
3130 RightFooter = GetArgChunk();
3138 if (start
&& !IsArgOptional())
3140 char *citeKeys
= GetArgData();
3142 char *citeKey
= ParseMultifieldString(citeKeys
, &pos
);
3145 AddCitation(citeKey
);
3146 TexRef
*ref
= FindReference(citeKey
);
3149 TexOutput(ref
->sectionNumber
, TRUE
);
3150 if (strcmp(ref
->sectionNumber
, "??") == 0)
3153 sprintf(buf
, "Warning: unresolved citation %s.", citeKey
);
3157 citeKey
= ParseMultifieldString(citeKeys
, &pos
);
3160 TexOutput(", ", TRUE
);
3169 if (start
&& !IsArgOptional())
3171 char *citeKey
= GetArgData();
3172 AddCitation(citeKey
);
3177 case ltHELPFONTSIZE
:
3181 char *data
= GetArgData();
3182 if (strcmp(data
, "10") == 0)
3184 else if (strcmp(data
, "11") == 0)
3186 else if (strcmp(data
, "12") == 0)
3196 TexOutput(" ??", TRUE
);
3203 if (start
&& arg_no
== 1)
3205 char *data
= GetArgData();
3206 ParSkip
= ParseUnitArgument(data
);
3213 if (start
&& arg_no
== 1)
3215 char *data
= GetArgData();
3216 ParIndent
= ParseUnitArgument(data
);
3223 return OnArgument(ltIT
, arg_no
, start
);
3226 case ltSPECIALDOUBLEDOLLAR
:
3228 return OnArgument(ltCENTER
, arg_no
, start
);
3232 case ltPARAGRAPHSTAR
:
3233 case ltSUBPARAGRAPH
:
3234 case ltSUBPARAGRAPHSTAR
:
3236 return OnArgument(ltSUBSUBSECTION
, arg_no
, start
);
3242 OnInform(GetArgData());
3248 TexOutput(" (", TRUE
);
3250 TexOutput(")", TRUE
);
3253 case ltBIBLIOGRAPHY
:
3261 if ((fd
= fopen(TexBibName
, "r")))
3267 TexOutput(smallBuf
);
3275 OnInform("Run Tex2RTF again to include bibliography.");
3278 // Read in the .bib file, resolve all known references, write out the RTF.
3279 char *allFiles
= GetArgData();
3281 char *bibFile
= ParseMultifieldString(allFiles
, &pos
);
3285 strcpy(fileBuf
, bibFile
);
3286 wxString actualFile
= TexPathList
.FindValidPath(fileBuf
);
3287 if (actualFile
== "")
3289 strcat(fileBuf
, ".bib");
3290 actualFile
= TexPathList
.FindValidPath(fileBuf
);
3292 if (actualFile
!= "")
3294 if (!ReadBib((char*) (const char*) actualFile
))
3297 sprintf(buf
, ".bib file %s not found or malformed", (const char*) actualFile
);
3304 sprintf(buf
, ".bib file %s not found", fileBuf
);
3307 bibFile
= ParseMultifieldString(allFiles
, &pos
);
3310 ResolveBibReferences();
3312 // Write it a new bib section in the appropriate format.
3313 FILE *save1
= CurrentOutput1
;
3314 FILE *save2
= CurrentOutput2
;
3315 FILE *Biblio
= fopen(TexTmpBibName
, "w");
3316 SetCurrentOutput(Biblio
);
3319 if (wxFileExists(TexTmpBibName
))
3321 if (wxFileExists(TexBibName
)) wxRemoveFile(TexBibName
);
3322 wxRenameFile(TexTmpBibName
, TexBibName
);
3324 SetCurrentOutputs(save1
, save2
);
3331 if (start
&& (arg_no
== 3))
3341 if (start
&& (arg_no
== 1))
3343 char *s
= GetArgData();
3346 char *s1
= copystring(s
);
3348 for (i
= 0; i
< (int)strlen(s
); i
++)
3349 s1
[i
] = toupper(s
[i
]);
3362 if (start
&& (arg_no
== 1))
3364 char *s
= GetArgData();
3367 char *s1
= copystring(s
);
3369 for (i
= 0; i
< (int)strlen(s
); i
++)
3370 s1
[i
] = tolower(s
[i
]);
3383 if (start
&& (arg_no
== 1))
3385 char *s
= GetArgData();
3388 char *s1
= copystring(s
);
3390 for (i
= 0; i
< (int)strlen(s
); i
++)
3391 s1
[i
] = toupper(s
[i
]);
3402 case ltPOPREF
: // Ignore second argument by default
3404 if (start
&& (arg_no
== 1))
3414 return ((convertMode
== TEX_XLP
) ? FALSE
: TRUE
);
3417 return ((convertMode
!= TEX_XLP
) ? FALSE
: TRUE
);
3420 return ((convertMode
== TEX_HTML
) ? FALSE
: TRUE
);
3423 return ((convertMode
!= TEX_HTML
) ? FALSE
: TRUE
);
3426 return (((convertMode
== TEX_RTF
) && !winHelp
) ? FALSE
: TRUE
);
3429 return (!((convertMode
== TEX_RTF
) && !winHelp
) ? FALSE
: TRUE
);
3431 case ltWINHELPIGNORE
:
3432 return (winHelp
? FALSE
: TRUE
);
3435 return (!winHelp
? FALSE
: TRUE
);
3450 case ltADDTOCOUNTER
:
3451 case ltADDCONTENTSLINE
:
3455 case ltBASELINESKIP
:
3464 case ltPAGENUMBERING
:
3476 case ltTHISPAGESTYLE
:
3479 case ltEVENSIDEMARGIN
:
3480 case ltODDSIDEMARGIN
:
3482 case ltMARGINPARWIDTH
:
3483 case ltMARGINPARSEP
:
3484 case ltMARGINPAREVEN
:
3485 case ltMARGINPARODD
:
3486 case ltTWOCOLWIDTHA
:
3487 case ltTWOCOLWIDTHB
:
3488 case ltTWOCOLSPACING
:
3495 case ltSETHOTSPOTCOLOUR
:
3496 case ltSETHOTSPOTCOLOR
:
3497 case ltSETHOTSPOTUNDERLINE
:
3498 case ltSETTRANSPARENCY
:
3501 case ltBACKGROUNDCOLOUR
:
3502 case ltBACKGROUNDIMAGE
:
3504 case ltFOLLOWEDLINKCOLOUR
:
3511 case ltINSERTATLEVEL
:
3515 case ltSUPERTABULAR
:
3524 if (arg_no
== 2) return TRUE
;
3531 if (arg_no
== 2) return TRUE
;
3535 case ltDEFINECOLOUR
:
3538 static int redVal
= 0;
3539 static int greenVal
= 0;
3540 static int blueVal
= 0;
3541 static char *colourName
= NULL
;
3548 if (colourName
) delete[] colourName
;
3549 colourName
= copystring(GetArgData());
3554 redVal
= atoi(GetArgData());
3559 greenVal
= atoi(GetArgData());
3564 blueVal
= atoi(GetArgData());
3565 AddColour(colourName
, redVal
, greenVal
, blueVal
);
3581 if (IsArgOptional())