1 <?php 2 /************************************************************************************* 3 * latex.php 4 * ----- 5 * Author: efi, Matthias Pospiech (matthias (at) pospiech.eu) 6 * Copyright: (c) 2006 efi, Matthias Pospiech (matthias (at) pospiech.eu), Nigel McNie (http://qbnz.com/highlighter) 7 * Release Version: 1.0.8.3 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 * 33 ************************************************************************************* 34 * 35 * This file is part of GeSHi. 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', 55 'COMMENT_SINGLE' => array( 56 1 => '%' 57 ), 58 'COMMENT_MULTI' => array(), 59 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, 60 'QUOTEMARKS' => array(), 61 'ESCAPE_CHAR' => '', 62 'KEYWORDS' => array( 63 1 => array( 64 'appendix','backmatter','caption','captionabove','captionbelow', 65 'def','documentclass','edef','equation','flushleft','flushright', 66 'footnote','frontmatter','hline','include','input','item','label', 67 'let','listfiles','listoffigures','listoftables','mainmatter', 68 'makeatletter','makeatother','makebox','mbox','par','raggedleft', 69 'raggedright','raisebox','ref','rule','table','tableofcontents', 70 'textbf','textit','texttt','today' 71 ) 72 ), 73 'SYMBOLS' => array( 74 "&", "\\", "{", "}", "[", "]" 75 ), 76 'CASE_SENSITIVE' => array( 77 1 => true, 78 GESHI_COMMENTS => false, 79 ), 80 'STYLES' => array( 81 'KEYWORDS' => array( 82 1 => 'color: #800000; font-weight: bold;', 83 ), 84 'COMMENTS' => array( 85 1 => 'color: #2C922C; font-style: italic;' 86 ), 87 'ESCAPE_CHAR' => array( 88 0 => 'color: #000000; font-weight: bold;' 89 ), 90 'BRACKETS' => array( 91 ), 92 'STRINGS' => array( 93 0 => 'color: #000000;' 94 ), 95 'NUMBERS' => array( 96 ), 97 'METHODS' => array( 98 ), 99 'SYMBOLS' => array( 100 0 => 'color: #E02020; ' 101 ), 102 'REGEXPS' => array( 103 1 => 'color: #8020E0; font-weight: normal;', // Math inner 104 2 => 'color: #C08020; font-weight: normal;', // [Option] 105 3 => 'color: #8020E0; font-weight: normal;', // Maths 106 4 => 'color: #800000; font-weight: normal;', // Structure: Labels 107 5 => 'color: #00008B; font-weight: bold;', // Structure (\section{->x<-}) 108 6 => 'color: #800000; font-weight: normal;', // Structure (\section) 109 7 => 'color: #0000D0; font-weight: normal;', // Environment \end or \begin{->x<-} (brighter blue) 110 8 => 'color: #C00000; font-weight: normal;', // Structure \end or \begin 111 9 => 'color: #2020C0; font-weight: normal;', // {...} 112 10 => 'color: #800000; font-weight: normal;', // \%, \& etc. 113 11 => 'color: #E00000; font-weight: normal;', // \@keyword 114 12 => 'color: #800000; font-weight: normal;', // \keyword 115 ), 116 'SCRIPT' => array( 117 ) 118 ), 119 'URLS' => array( 120 1 => 'http://www.golatex.de/wiki/index.php?title=\\{FNAME}', 121 ), 122 'OOLANG' => false, 123 'OBJECT_SPLITTERS' => array( 124 ), 125 'REGEXPS' => array( 126 // Math inner 127 1 => array( 128 GESHI_SEARCH => "(\\\\begin\\{(equation|displaymath|eqnarray|subeqnarray|math|multline|gather|align|alignat|flalign)\\})(.*)(\\\\end\\{\\2\\})", 129 GESHI_REPLACE => '\3', 130 GESHI_MODIFIERS => 'Us', 131 GESHI_BEFORE => '\1', 132 GESHI_AFTER => '\4' 133 ), 134 // [options] 135 2 => array( 136 GESHI_SEARCH => "(?<=\[).+(?=\])", 137 GESHI_REPLACE => '\0', 138 GESHI_MODIFIERS => 'Us', 139 GESHI_BEFORE => '', 140 GESHI_AFTER => '' 141 ), 142 // Math mode with $ ... $ 143 3 => array( 144 GESHI_SEARCH => "\\$.+\\$", 145 GESHI_REPLACE => '\0', 146 GESHI_MODIFIERS => 'Us', 147 GESHI_BEFORE => '', 148 GESHI_AFTER => '' 149 ), 150 // Structure: Label 151 4 => "\\\\(?:label|pageref|ref|cite)(?=[^a-zA-Z])", 152 // Structure: sections 153 5 => array( 154 GESHI_SEARCH => "(\\\\(?:part|chapter|(?:sub){0,2}section|(?:sub)?paragraph|addpart|addchap|addsec)\*?\\{)(.*)(?=\\})", 155 GESHI_REPLACE => '\\2', 156 GESHI_MODIFIERS => 'U', 157 GESHI_BEFORE => '\\1', 158 GESHI_AFTER => '' 159 ), 160 // Structure: sections 161 6 => "\\\\(?:part|chapter|(?:sub){0,2}section|(?:sub)?paragraph|addpart|addchap|addsec)\*?(?=[^a-zA-Z])", 162 // environment \begin{} and \end{} (i.e. the things inside the {}) 163 7 => array( 164 GESHI_SEARCH => "(\\\\(?:begin|end)\\{)(.*)(?=\\})", 165 GESHI_REPLACE => '\\2', 166 GESHI_MODIFIERS => 'U', 167 GESHI_BEFORE => '\\1', 168 GESHI_AFTER => '' 169 ), 170 // Structure \begin and \end 171 8 => "\\\\(?:end|begin)(?=[^a-zA-Z])", 172 // {parameters} 173 9 => array( 174 GESHI_SEARCH => "(?<=\\{)(?!<\|!REG3XP5!>).*(?=\\})", 175 GESHI_REPLACE => '\0', 176 GESHI_MODIFIERS => 'Us', 177 GESHI_BEFORE => '', 178 GESHI_AFTER => '' 179 ), 180 // \%, \& usw. 181 10 => "\\\\(?:[_$%]|&)", 182 // \@keywords 183 11 => "(?<!<\|!REG3XP[8]!>)\\\\@[a-zA-Z]+\*?", 184 // \keywords 185 12 => "(?<!<\|!REG3XP[468]!>)\\\\[a-zA-Z]+\*?", 186 187 // --------------------------------------------- 188 ), 189 'STRICT_MODE_APPLIES' => GESHI_NEVER, 190 'SCRIPT_DELIMITERS' => array( 191 ), 192 'HIGHLIGHT_STRICT_BLOCK' => array( 193 ), 194 'PARSER_CONTROL' => array( 195 'COMMENTS' => array( 196 'DISALLOWED_BEFORE' => '\\' 197 ), 198 'KEYWORDS' => array( 199 'DISALLOWED_BEFORE' => "(?<=\\\\)", 200 'DISALLOWED_AFTER' => "(?=\b)(?!\w)" 201 ), 202 'ENABLE_FLAGS' => array( 203 'NUMBERS' => GESHI_NEVER, 204 'BRACKETS' => GESHI_NEVER 205 ) 206 ) 207 ); 208 209 ?>