aboutsummaryrefslogtreecommitdiff
path: root/lib/dokuwiki/inc/geshi/latex.php
blob: bad2c186189f0c613e0de0fa86db16f47e9b296f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<?php
/*************************************************************************************
 * latex.php
 * -----
 * Author: efi, Matthias Pospiech (matthias@pospiech.eu)
 * Copyright: (c) 2006 efi, Matthias Pospiech (matthias@pospiech.eu), Nigel McNie (http://qbnz.com/highlighter)
 * Release Version: 1.0.8.4
 * Date Started: 2006/09/23
 *
 * LaTeX language file for GeSHi.
 *
 * CHANGES
 * -------
 * 2008/08/18 (1.0.8.1)
 *  - Changes in color and some additional command recognition
 *  - No special Color for Brackets, it is only distracting
 *    if color should be reintroduced it should be less bright
 *  - Math color changed from green to violett, since green is now used for comments
 *  - Comments are now colored and the only green. The reason for coloring the comments
 *    is that often important information is in the comments und was merely unvisible before.
 *  - New Color for [Options]
 *  - color for labels not specialised anymore. It makes sence in large documents but less in
 *    small web examples.
 *  - \@keyword introduced
 *  - Fixed \& escaped ampersand
 * 2006/09/23 (1.0.0)
 *  -  First Release
 *
 * TODO
 * -------------------------
 * *
 *
 *************************************************************************************
 *
 *     This file is part of GeSHi.
 *
 *   GeSHi is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   GeSHi is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with GeSHi; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 ************************************************************************************/

$language_data = array (
    'LANG_NAME' => 'LaTeX',
    'COMMENT_SINGLE' => array(
        1 => '%'
        ),
    'COMMENT_MULTI' => array(),
    'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
    'QUOTEMARKS' => array(),
    'ESCAPE_CHAR' => '',
    'KEYWORDS' => array(
        1 => array(
            'addlinespace','address','appendix','author','backmatter',
            'bfseries','bibitem','bigskip','blindtext','caption','captionabove',
            'captionbelow','cdot','centering','cite','color','colorbox','date',
            'def','definecolor','documentclass','edef','eqref','else','email','emph','fbox',
            'fi','flushleft','flushright','footnote','frac','frontmatter','graphicspath','hfill',
            'hline','hspace','huge','include','includegraphics','infty','input','int','ifx',
            'item','label','LaTeX','left','let','limits','listfiles','listoffigures',
            'listoftables','mainmatter','makeatletter','makeatother','makebox',
            'makeindex','maketitle','mbox','mediumskip','newcommand',
            'newenvironment','newpage','nocite','nonumber','pagestyle','par','paragraph','parbox',
            'parident','parskip','partial','raggedleft','raggedright','raisebox','ref',
            'renewcommand','renewenvironment','right','rule','section','setlength',
            'sffamily','subparagraph','subsection','subsubsection','sum','table',
            'tableofcontents','textbf','textcolor','textit','textnormal',
            'textsuperscript','texttt','title','today','ttfamily','urlstyle',
            'usepackage','vspace'
            )
        ),
    'SYMBOLS' => array(
        "&", "\\", "{", "}", "[", "]"
        ),
    'CASE_SENSITIVE' => array(
        1 => true,
        GESHI_COMMENTS => false,
        ),
    'STYLES' => array(
        'KEYWORDS' => array(
            1 => 'color: #800000;',
            ),
        'COMMENTS' => array(
            1 => 'color: #2C922C; font-style: italic;'
            ),
        'ESCAPE_CHAR' => array(
            0 =>  'color: #000000; font-weight: bold;'
            ),
        'BRACKETS' => array(
            ),
        'STRINGS' => array(
            0 =>  'color: #000000;'
            ),
        'NUMBERS' => array(
            ),
        'METHODS' => array(
            ),
        'SYMBOLS' => array(
            0 =>  'color: #E02020; '
            ),
        'REGEXPS' => array(
            1 => 'color: #8020E0; font-weight: normal;',  // Math inner
            2 => 'color: #C08020; font-weight: normal;', // [Option]
            3 => 'color: #8020E0; font-weight: normal;', // Maths
            4 => 'color: #800000; font-weight: normal;', // Structure: Labels
            5 => 'color: #00008B; font-weight: bold;',  // Structure (\section{->x<-})
            6 => 'color: #800000; font-weight: normal;', // Structure (\section)
            7 => 'color: #0000D0; font-weight: normal;', // Environment \end or \begin{->x<-} (brighter blue)
            8 => 'color: #C00000; font-weight: normal;', // Structure \end or \begin
            9 => 'color: #2020C0; font-weight: normal;', // {...}
            10 => 'color: #800000; font-weight: normal;', // \%, \& etc.
            11 => 'color: #E00000; font-weight: normal;', // \@keyword
            12 => 'color: #800000; font-weight: normal;', // \keyword
        ),
        'SCRIPT' => array(
            )
        ),
    'URLS' => array(
        1 => 'http://www.golatex.de/wiki/index.php?title=%5C{FNAME}',
        ),
    'OOLANG' => false,
    'OBJECT_SPLITTERS' => array(
        ),
    'REGEXPS' => array(
        // Math inner
        1 => array(
            GESHI_SEARCH => "(\\\\begin\\{(equation|displaymath|eqnarray|subeqnarray|math|multline|gather|align|alignat|flalign)\\})(.*)(\\\\end\\{\\2\\})",
            GESHI_REPLACE => '\3',
            GESHI_MODIFIERS => 'Us',
            GESHI_BEFORE => '\1',
            GESHI_AFTER => '\4'
            ),
        // [options]
        2 => array(
            GESHI_SEARCH => "(?<=\[).+(?=\])",
            GESHI_REPLACE => '\0',
            GESHI_MODIFIERS => 'Us',
            GESHI_BEFORE => '',
            GESHI_AFTER => ''
            ),
        // Math mode with $ ... $
        3 => array(
            GESHI_SEARCH => "\\$.+\\$",
            GESHI_REPLACE => '\0',
            GESHI_MODIFIERS => 'Us',
            GESHI_BEFORE => '',
            GESHI_AFTER => ''
            ),
        // Structure: Label
        4 => "\\\\(?:label|pageref|ref|cite)(?=[^a-zA-Z])",
        // Structure: sections
        5 => array(
            GESHI_SEARCH => "(\\\\(?:part|chapter|(?:sub){0,2}section|(?:sub)?paragraph|addpart|addchap|addsec)\*?\\{)(.*)(?=\\})",
            GESHI_REPLACE => '\\2',
            GESHI_MODIFIERS => 'U',
            GESHI_BEFORE => '\\1',
            GESHI_AFTER => ''
            ),
        // Structure: sections
        6 => "\\\\(?:part|chapter|(?:sub){0,2}section|(?:sub)?paragraph|addpart|addchap|addsec)\*?(?=[^a-zA-Z])",
        // environment \begin{} and \end{} (i.e. the things inside the {})
        7 => array(
            GESHI_SEARCH => "(\\\\(?:begin|end)\\{)(.*)(?=\\})",
            GESHI_REPLACE => '\\2',
            GESHI_MODIFIERS => 'U',
            GESHI_BEFORE => '\\1',
            GESHI_AFTER => ''
            ),
        // Structure \begin and \end
        8 => "\\\\(?:end|begin)(?=[^a-zA-Z])",
        // {parameters}
        9 => array(
            GESHI_SEARCH => "(?<=\\{)(?!<\|!REG3XP5!>).*(?=\\})",
            GESHI_REPLACE => '\0',
            GESHI_MODIFIERS => 'Us',
            GESHI_BEFORE => '',
            GESHI_AFTER => ''
            ),
        // \%, \& usw.
        10 => "\\\\(?:[_$%]|&amp;)",
        //  \@keywords
        11 => "(?<!<\|!REG3XP[8]!>)\\\\@[a-zA-Z]+\*?",
        // \keywords
        12 => "(?<!<\|!REG3XP[468]!>)\\\\[a-zA-Z]+\*?",

// ---------------------------------------------
        ),
    'STRICT_MODE_APPLIES' => GESHI_NEVER,
    'SCRIPT_DELIMITERS' => array(
        ),
    'HIGHLIGHT_STRICT_BLOCK' => array(
        ),
    'PARSER_CONTROL' => array(
        'COMMENTS' => array(
            'DISALLOWED_BEFORE' => '\\'
        ),
        'KEYWORDS' => array(
            'DISALLOWED_BEFORE' => "(?<=\\\\)",
            'DISALLOWED_AFTER' => "(?![A-Za-z0-9])"
        ),
        'ENABLE_FLAGS' => array(
            'NUMBERS' => GESHI_NEVER,
            'BRACKETS' => GESHI_NEVER
        )
    )
);

?>