0
|
1 |
<?php
|
|
2 |
/*************************************************************************************
|
|
3 |
* latex.php
|
|
4 |
* -----
|
2
|
5 |
* Author: efi, Matthias Pospiech (matthias@pospiech.eu)
|
|
6 |
* Copyright: (c) 2006 efi, Matthias Pospiech (matthias@pospiech.eu), Nigel McNie (http://qbnz.com/highlighter)
|
3
|
7 |
* Release Version: 1.0.8.4
|
2
|
8 |
* Date Started: 2006/09/23
|
|
9 |
*
|
|
10 |
* LaTeX language file for GeSHi.
|
|
11 |
*
|
|
12 |
* CHANGES
|
|
13 |
* -------
|
|
14 |
* 2008/08/18 (1.0.8.1)
|
|
15 |
* - Changes in color and some additional command recognition
|
|
16 |
* - No special Color for Brackets, it is only distracting
|
|
17 |
* if color should be reintroduced it should be less bright
|
|
18 |
* - Math color changed from green to violett, since green is now used for comments
|
|
19 |
* - Comments are now colored and the only green. The reason for coloring the comments
|
|
20 |
* is that often important information is in the comments und was merely unvisible before.
|
|
21 |
* - New Color for [Options]
|
|
22 |
* - color for labels not specialised anymore. It makes sence in large documents but less in
|
|
23 |
* small web examples.
|
|
24 |
* - \@keyword introduced
|
|
25 |
* - Fixed \& escaped ampersand
|
|
26 |
* 2006/09/23 (1.0.0)
|
|
27 |
* - First Release
|
|
28 |
*
|
|
29 |
* TODO
|
|
30 |
* -------------------------
|
|
31 |
* *
|
|
32 |
*
|
0
|
33 |
*************************************************************************************
|
|
34 |
*
|
2
|
35 |
* This file is part of GeSHi.
|
0
|
36 |
*
|
|
37 |
* GeSHi is free software; you can redistribute it and/or modify
|
|
38 |
* it under the terms of the GNU General Public License as published by
|
|
39 |
* the Free Software Foundation; either version 2 of the License, or
|
|
40 |
* (at your option) any later version.
|
|
41 |
*
|
|
42 |
* GeSHi is distributed in the hope that it will be useful,
|
|
43 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
44 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
45 |
* GNU General Public License for more details.
|
|
46 |
*
|
|
47 |
* You should have received a copy of the GNU General Public License
|
|
48 |
* along with GeSHi; if not, write to the Free Software
|
|
49 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
50 |
*
|
|
51 |
************************************************************************************/
|
|
52 |
|
|
53 |
$language_data = array (
|
|
54 |
'LANG_NAME' => 'LaTeX',
|
2
|
55 |
'COMMENT_SINGLE' => array(
|
|
56 |
1 => '%'
|
|
57 |
),
|
0
|
58 |
'COMMENT_MULTI' => array(),
|
|
59 |
'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
|
|
60 |
'QUOTEMARKS' => array(),
|
|
61 |
'ESCAPE_CHAR' => '',
|
|
62 |
'KEYWORDS' => array(
|
3
|
63 |
1 => array(
|
|
64 |
'addlinespace','address','appendix','author','backmatter',
|
|
65 |
'bfseries','bibitem','bigskip','blindtext','caption','captionabove',
|
|
66 |
'captionbelow','cdot','centering','cite','color','colorbox','date',
|
|
67 |
'def','definecolor','documentclass','edef','eqref','else','email','emph','fbox',
|
|
68 |
'fi','flushleft','flushright','footnote','frac','frontmatter','graphicspath','hfill',
|
|
69 |
'hline','hspace','huge','include','includegraphics','infty','input','int','ifx',
|
|
70 |
'item','label','LaTeX','left','let','limits','listfiles','listoffigures',
|
|
71 |
'listoftables','mainmatter','makeatletter','makeatother','makebox',
|
|
72 |
'makeindex','maketitle','mbox','mediumskip','newcommand',
|
|
73 |
'newenvironment','newpage','nocite','nonumber','pagestyle','par','paragraph','parbox',
|
|
74 |
'parident','parskip','partial','raggedleft','raggedright','raisebox','ref',
|
|
75 |
'renewcommand','renewenvironment','right','rule','section','setlength',
|
|
76 |
'sffamily','subparagraph','subsection','subsubsection','sum','table',
|
|
77 |
'tableofcontents','textbf','textcolor','textit','textnormal',
|
|
78 |
'textsuperscript','texttt','title','today','ttfamily','urlstyle',
|
|
79 |
'usepackage','vspace'
|
|
80 |
)
|
0
|
81 |
),
|
|
82 |
'SYMBOLS' => array(
|
2
|
83 |
"&", "\\", "{", "}", "[", "]"
|
0
|
84 |
),
|
|
85 |
'CASE_SENSITIVE' => array(
|
3
|
86 |
1 => true,
|
2
|
87 |
GESHI_COMMENTS => false,
|
0
|
88 |
),
|
|
89 |
'STYLES' => array(
|
|
90 |
'KEYWORDS' => array(
|
3
|
91 |
1 => 'color: #800000;',
|
0
|
92 |
),
|
|
93 |
'COMMENTS' => array(
|
2
|
94 |
1 => 'color: #2C922C; font-style: italic;'
|
0
|
95 |
),
|
|
96 |
'ESCAPE_CHAR' => array(
|
2
|
97 |
0 => 'color: #000000; font-weight: bold;'
|
0
|
98 |
),
|
|
99 |
'BRACKETS' => array(
|
|
100 |
),
|
|
101 |
'STRINGS' => array(
|
2
|
102 |
0 => 'color: #000000;'
|
0
|
103 |
),
|
|
104 |
'NUMBERS' => array(
|
|
105 |
),
|
|
106 |
'METHODS' => array(
|
|
107 |
),
|
|
108 |
'SYMBOLS' => array(
|
3
|
109 |
0 => 'color: #E02020; '
|
0
|
110 |
),
|
|
111 |
'REGEXPS' => array(
|
2
|
112 |
1 => 'color: #8020E0; font-weight: normal;', // Math inner
|
|
113 |
2 => 'color: #C08020; font-weight: normal;', // [Option]
|
|
114 |
3 => 'color: #8020E0; font-weight: normal;', // Maths
|
|
115 |
4 => 'color: #800000; font-weight: normal;', // Structure: Labels
|
|
116 |
5 => 'color: #00008B; font-weight: bold;', // Structure (\section{->x<-})
|
|
117 |
6 => 'color: #800000; font-weight: normal;', // Structure (\section)
|
|
118 |
7 => 'color: #0000D0; font-weight: normal;', // Environment \end or \begin{->x<-} (brighter blue)
|
|
119 |
8 => 'color: #C00000; font-weight: normal;', // Structure \end or \begin
|
|
120 |
9 => 'color: #2020C0; font-weight: normal;', // {...}
|
|
121 |
10 => 'color: #800000; font-weight: normal;', // \%, \& etc.
|
|
122 |
11 => 'color: #E00000; font-weight: normal;', // \@keyword
|
|
123 |
12 => 'color: #800000; font-weight: normal;', // \keyword
|
0
|
124 |
),
|
|
125 |
'SCRIPT' => array(
|
|
126 |
)
|
|
127 |
),
|
|
128 |
'URLS' => array(
|
3
|
129 |
1 => 'http://www.golatex.de/wiki/index.php?title=%5C{FNAME}',
|
0
|
130 |
),
|
|
131 |
'OOLANG' => false,
|
|
132 |
'OBJECT_SPLITTERS' => array(
|
|
133 |
),
|
|
134 |
'REGEXPS' => array(
|
|
135 |
// Math inner
|
|
136 |
1 => array(
|
2
|
137 |
GESHI_SEARCH => "(\\\\begin\\{(equation|displaymath|eqnarray|subeqnarray|math|multline|gather|align|alignat|flalign)\\})(.*)(\\\\end\\{\\2\\})",
|
|
138 |
GESHI_REPLACE => '\3',
|
|
139 |
GESHI_MODIFIERS => 'Us',
|
|
140 |
GESHI_BEFORE => '\1',
|
|
141 |
GESHI_AFTER => '\4'
|
0
|
142 |
),
|
2
|
143 |
// [options]
|
0
|
144 |
2 => array(
|
2
|
145 |
GESHI_SEARCH => "(?<=\[).+(?=\])",
|
|
146 |
GESHI_REPLACE => '\0',
|
|
147 |
GESHI_MODIFIERS => 'Us',
|
0
|
148 |
GESHI_BEFORE => '',
|
|
149 |
GESHI_AFTER => ''
|
|
150 |
),
|
2
|
151 |
// Math mode with $ ... $
|
0
|
152 |
3 => array(
|
2
|
153 |
GESHI_SEARCH => "\\$.+\\$",
|
|
154 |
GESHI_REPLACE => '\0',
|
|
155 |
GESHI_MODIFIERS => 'Us',
|
0
|
156 |
GESHI_BEFORE => '',
|
|
157 |
GESHI_AFTER => ''
|
|
158 |
),
|
2
|
159 |
// Structure: Label
|
|
160 |
4 => "\\\\(?:label|pageref|ref|cite)(?=[^a-zA-Z])",
|
|
161 |
// Structure: sections
|
|
162 |
5 => array(
|
|
163 |
GESHI_SEARCH => "(\\\\(?:part|chapter|(?:sub){0,2}section|(?:sub)?paragraph|addpart|addchap|addsec)\*?\\{)(.*)(?=\\})",
|
|
164 |
GESHI_REPLACE => '\\2',
|
|
165 |
GESHI_MODIFIERS => 'U',
|
|
166 |
GESHI_BEFORE => '\\1',
|
|
167 |
GESHI_AFTER => ''
|
0
|
168 |
),
|
2
|
169 |
// Structure: sections
|
|
170 |
6 => "\\\\(?:part|chapter|(?:sub){0,2}section|(?:sub)?paragraph|addpart|addchap|addsec)\*?(?=[^a-zA-Z])",
|
|
171 |
// environment \begin{} and \end{} (i.e. the things inside the {})
|
|
172 |
7 => array(
|
|
173 |
GESHI_SEARCH => "(\\\\(?:begin|end)\\{)(.*)(?=\\})",
|
|
174 |
GESHI_REPLACE => '\\2',
|
|
175 |
GESHI_MODIFIERS => 'U',
|
|
176 |
GESHI_BEFORE => '\\1',
|
|
177 |
GESHI_AFTER => ''
|
0
|
178 |
),
|
2
|
179 |
// Structure \begin and \end
|
|
180 |
8 => "\\\\(?:end|begin)(?=[^a-zA-Z])",
|
|
181 |
// {parameters}
|
|
182 |
9 => array(
|
|
183 |
GESHI_SEARCH => "(?<=\\{)(?!<\|!REG3XP5!>).*(?=\\})",
|
|
184 |
GESHI_REPLACE => '\0',
|
|
185 |
GESHI_MODIFIERS => 'Us',
|
0
|
186 |
GESHI_BEFORE => '',
|
|
187 |
GESHI_AFTER => ''
|
|
188 |
),
|
2
|
189 |
// \%, \& usw.
|
|
190 |
10 => "\\\\(?:[_$%]|&)",
|
|
191 |
// \@keywords
|
|
192 |
11 => "(?<!<\|!REG3XP[8]!>)\\\\@[a-zA-Z]+\*?",
|
|
193 |
// \keywords
|
|
194 |
12 => "(?<!<\|!REG3XP[468]!>)\\\\[a-zA-Z]+\*?",
|
0
|
195 |
|
|
196 |
// ---------------------------------------------
|
|
197 |
),
|
|
198 |
'STRICT_MODE_APPLIES' => GESHI_NEVER,
|
|
199 |
'SCRIPT_DELIMITERS' => array(
|
|
200 |
),
|
|
201 |
'HIGHLIGHT_STRICT_BLOCK' => array(
|
2
|
202 |
),
|
|
203 |
'PARSER_CONTROL' => array(
|
|
204 |
'COMMENTS' => array(
|
|
205 |
'DISALLOWED_BEFORE' => '\\'
|
|
206 |
),
|
3
|
207 |
'KEYWORDS' => array(
|
|
208 |
'DISALLOWED_BEFORE' => "(?<=\\\\)",
|
|
209 |
'DISALLOWED_AFTER' => "(?![A-Za-z0-9])"
|
|
210 |
),
|
2
|
211 |
'ENABLE_FLAGS' => array(
|
|
212 |
'NUMBERS' => GESHI_NEVER,
|
|
213 |
'BRACKETS' => GESHI_NEVER
|
0
|
214 |
)
|
2
|
215 |
)
|
0
|
216 |
);
|
|
217 |
|
3
|
218 |
?> |