KXStudio Website https://kx.studio/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

latex.php 8.6KB

11 years ago
11 years ago
11 years ago
11 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <?php
  2. /*************************************************************************************
  3. * latex.php
  4. * -----
  5. * Author: efi, Matthias Pospiech (matthias@pospiech.eu)
  6. * Copyright: (c) 2006 efi, Matthias Pospiech (matthias@pospiech.eu), Nigel McNie (http://qbnz.com/highlighter)
  7. * Release Version: 1.0.8.11
  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. $language_data = array (
  53. 'LANG_NAME' => 'LaTeX',
  54. 'COMMENT_SINGLE' => array(
  55. 1 => '%'
  56. ),
  57. 'COMMENT_MULTI' => array(),
  58. 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
  59. 'QUOTEMARKS' => array(),
  60. 'ESCAPE_CHAR' => '',
  61. 'KEYWORDS' => array(
  62. 1 => array(
  63. 'addlinespace','and','address','appendix','author','backmatter',
  64. 'bfseries','bibitem','bigskip','blindtext','caption','captionabove',
  65. 'captionbelow','cdot','centering','chapter','cite','color',
  66. 'colorbox','date','dedication','def','definecolor','documentclass',
  67. 'edef','else','email','emph','eqref','extratitle','fbox','fi',
  68. 'flushleft','flushright','footnote','frac','frontmatter',
  69. 'graphicspath','hfil','hfill','hfilll','hline','hspace','huge','ifx','include',
  70. 'includegraphics','infty','input','int','item','itemsep',
  71. 'KOMAoption','KOMAoptions','label','LaTeX','left','let','limits',
  72. 'listfiles','listoffigures','listoftables','lowertitleback',
  73. 'mainmatter','makeatletter','makeatother','makebox','makeindex',
  74. 'maketitle','mbox','mediumskip','newcommand','newenvironment',
  75. 'newpage','nocite','nonumber','pagestyle','par','paragraph',
  76. 'parbox','parident','parskip','partial','publishers','raggedleft',
  77. 'raggedright','raisebox','ref','renewcommand','renewenvironment',
  78. 'right','rule','section','setlength','sffamily','subject',
  79. 'subparagraph','subsection','subsubsection','subtitle','sum',
  80. 'table','tableofcontents','textbf','textcolor','textit',
  81. 'textnormal','textsuperscript','texttt','textwidth','thanks','title',
  82. 'titlehead','today','ttfamily','uppertitleback','urlstyle',
  83. 'usepackage','vfil','vfill','vfilll','vspace'
  84. )
  85. ),
  86. 'SYMBOLS' => array(
  87. "&", "\\", "{", "}", "[", "]"
  88. ),
  89. 'CASE_SENSITIVE' => array(
  90. 1 => true,
  91. GESHI_COMMENTS => false,
  92. ),
  93. 'STYLES' => array(
  94. 'KEYWORDS' => array(
  95. 1 => 'color: #800000;',
  96. ),
  97. 'COMMENTS' => array(
  98. 1 => 'color: #2C922C; font-style: italic;'
  99. ),
  100. 'ESCAPE_CHAR' => array(
  101. 0 => 'color: #000000; font-weight: bold;'
  102. ),
  103. 'BRACKETS' => array(
  104. ),
  105. 'STRINGS' => array(
  106. 0 => 'color: #000000;'
  107. ),
  108. 'NUMBERS' => array(
  109. ),
  110. 'METHODS' => array(
  111. ),
  112. 'SYMBOLS' => array(
  113. 0 => 'color: #E02020; '
  114. ),
  115. 'REGEXPS' => array(
  116. 1 => 'color: #8020E0; font-weight: normal;', // Math inner
  117. 2 => 'color: #C08020; font-weight: normal;', // [Option]
  118. 3 => 'color: #8020E0; font-weight: normal;', // Maths
  119. 4 => 'color: #800000; font-weight: normal;', // Structure: Labels
  120. 5 => 'color: #00008B; font-weight: bold;', // Structure (\section{->x<-})
  121. 6 => 'color: #800000; font-weight: normal;', // Structure (\section)
  122. 7 => 'color: #0000D0; font-weight: normal;', // Environment \end or \begin{->x<-} (brighter blue)
  123. 8 => 'color: #C00000; font-weight: normal;', // Structure \end or \begin
  124. 9 => 'color: #2020C0; font-weight: normal;', // {...}
  125. 10 => 'color: #800000; font-weight: normal;', // \%, \& etc.
  126. 11 => 'color: #E00000; font-weight: normal;', // \@keyword
  127. 12 => 'color: #800000; font-weight: normal;', // \keyword
  128. ),
  129. 'SCRIPT' => array(
  130. )
  131. ),
  132. 'URLS' => array(
  133. 1 => 'http://www.golatex.de/wiki/index.php?title=%5C{FNAME}',
  134. ),
  135. 'OOLANG' => false,
  136. 'OBJECT_SPLITTERS' => array(
  137. ),
  138. 'REGEXPS' => array(
  139. // Math inner
  140. 1 => array(
  141. GESHI_SEARCH => "(\\\\begin\\{(equation|displaymath|eqnarray|subeqnarray|math|multline|gather|align|alignat|flalign)\\})(.*)(\\\\end\\{\\2\\})",
  142. GESHI_REPLACE => '\3',
  143. GESHI_MODIFIERS => 'Us',
  144. GESHI_BEFORE => '\1',
  145. GESHI_AFTER => '\4'
  146. ),
  147. // [options]
  148. 2 => array(
  149. GESHI_SEARCH => "(?<=\[).*(?=\])",
  150. GESHI_REPLACE => '\0',
  151. GESHI_MODIFIERS => 'Us',
  152. GESHI_BEFORE => '',
  153. GESHI_AFTER => ''
  154. ),
  155. // Math mode with $ ... $
  156. 3 => array(
  157. GESHI_SEARCH => "\\$.+\\$",
  158. GESHI_REPLACE => '\0',
  159. GESHI_MODIFIERS => 'Us',
  160. GESHI_BEFORE => '',
  161. GESHI_AFTER => ''
  162. ),
  163. // Structure: Label
  164. 4 => "\\\\(?:label|pageref|ref|cite)(?=[^a-zA-Z])",
  165. // Structure: sections
  166. 5 => array(
  167. GESHI_SEARCH => "(\\\\(?:part|chapter|(?:sub){0,2}section|(?:sub)?paragraph|addpart|addchap|addsec)\*?\\{)(.*)(?=\\})",
  168. GESHI_REPLACE => '\\2',
  169. GESHI_MODIFIERS => 'U',
  170. GESHI_BEFORE => '\\1',
  171. GESHI_AFTER => ''
  172. ),
  173. // Structure: sections
  174. 6 => "\\\\(?:part|chapter|(?:sub){0,2}section|(?:sub)?paragraph|addpart|addchap|addsec)\*?(?=[^a-zA-Z])",
  175. // environment \begin{} and \end{} (i.e. the things inside the {})
  176. 7 => array(
  177. GESHI_SEARCH => "(\\\\(?:begin|end)\\{)(.*)(?=\\})",
  178. GESHI_REPLACE => '\\2',
  179. GESHI_MODIFIERS => 'U',
  180. GESHI_BEFORE => '\\1',
  181. GESHI_AFTER => ''
  182. ),
  183. // Structure \begin and \end
  184. 8 => "\\\\(?:end|begin)(?=[^a-zA-Z])",
  185. // {parameters}
  186. 9 => array(
  187. GESHI_SEARCH => "(?<=\\{)(?!<\|!REG3XP5!>).*?(?=\\})",
  188. GESHI_REPLACE => '\0',
  189. GESHI_MODIFIERS => 'Us',
  190. GESHI_BEFORE => '',
  191. GESHI_AFTER => ''
  192. ),
  193. // \%, \& usw.
  194. 10 => "\\\\(?:[_$%]|&amp;)",
  195. // \@keywords
  196. 11 => "(?<!<\|!REG3XP[8]!>)\\\\@[a-zA-Z]+\*?",
  197. // \keywords
  198. 12 => "(?<!<\|!REG3XP[468]!>)\\\\[a-zA-Z]+\*?",
  199. // ---------------------------------------------
  200. ),
  201. 'STRICT_MODE_APPLIES' => GESHI_NEVER,
  202. 'SCRIPT_DELIMITERS' => array(
  203. ),
  204. 'HIGHLIGHT_STRICT_BLOCK' => array(
  205. ),
  206. 'PARSER_CONTROL' => array(
  207. 'COMMENTS' => array(
  208. 'DISALLOWED_BEFORE' => '\\'
  209. ),
  210. 'KEYWORDS' => array(
  211. 'DISALLOWED_BEFORE' => "(?<=\\\\)",
  212. 'DISALLOWED_AFTER' => "(?![A-Za-z0-9])"
  213. ),
  214. 'ENABLE_FLAGS' => array(
  215. 'NUMBERS' => GESHI_NEVER,
  216. 'BRACKETS' => GESHI_NEVER
  217. )
  218. )
  219. );
  220. ?>