medit/moo/mooedit/language-specs/latex.lang

213 lines
8.1 KiB
XML

<?xml version="1.0"?>
<!--
Author: Marco Barisione <barisione@gmail.com>
Copyright (C) 2005-2007 Marco Barisione <barisione@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
-->
<language id="latex" _name="LaTeX" version="2.0" _section="Markup">
<metadata>
<property name="mimetypes">text/x-tex</property>
<property name="globs">*.tex;*.ltx;*.sty;*.cls;*.dtx;*.ins;*.bbl</property>
<property name="line-comment-start">%</property>
</metadata>
<styles>
<style id="comment" _name="Comment" map-to="def:comment"/>
<style id="documentclass" _name="Comment" map-to="def:keyword"/>
<style id="usepackage" _name="Comment" map-to="def:keyword"/>
<style id="newcommand" _name="Comment" map-to="def:keyword"/>
<style id="display-math" _name="Math Mode"/>
<style id="inline-math" _name="Inline Math Mode" map-to="latex:display-math"/>
<style id="structure" _name="Inline Math Mode"/>
<style id="section" _name="Inline Math Mode"/>
<style id="math" _name="Math Mode" map-to="latex:display-math"/>
<style id="math-bound" _name="math-bound" map-to="latex:display-math"/>
<style id="include" _name="Include" map-to="def:keyword"/>
<style id="common-commands" _name="Command" map-to="def:keyword"/>
<style id="command" _name="Command" map-to="def:keyword"/>
<style id="verbatim" _name="Verbatim" map-to="def:comment"/>
</styles>
<definitions>
<context id="common-commands" style-ref="common-commands">
<prefix>\\</prefix>
<keyword>begin</keyword>
<keyword>end</keyword>
<keyword>documentclass</keyword>
<keyword>newcommand</keyword>
<keyword>newenvironment</keyword>
<keyword>newtheorem</keyword>
<keyword>newfont</keyword>
<keyword>part</keyword>
<keyword>chapter</keyword>
<keyword>section</keyword>
<keyword>subsection</keyword>
<keyword>subsubsection</keyword>
<keyword>paragraph</keyword>
<keyword>subparagraph</keyword>
<keyword>page</keyword>
<keyword>equation</keyword>
<keyword>figure</keyword>
<keyword>table</keyword>
<keyword>footnote</keyword>
<keyword>footnotemark</keyword>
<keyword>footnotetext</keyword>
<keyword>mpfootnote</keyword>
<keyword>enumi</keyword>
<keyword>enumii</keyword>
<keyword>enumiii</keyword>
<keyword>enumiv</keyword>
<keyword>label</keyword>
<keyword>pageref</keyword>
<keyword>ref</keyword>
<keyword>onecolumn</keyword>
<keyword>twocolumn</keyword>
</context>
<context id="specials-symbol" style-ref="command">
<prefix>\\</prefix>
<suffix></suffix>
<keyword>\$</keyword>
<keyword>&amp;</keyword>
<keyword>%</keyword>
<keyword>#</keyword>
<keyword>_</keyword>
<keyword>\{</keyword>
<keyword>\}</keyword>
<keyword>~</keyword>
<keyword>\^</keyword>
<keyword>\\</keyword>
</context>
<context id="command" style-ref="command">
<match>\\[a-zA-Z]+</match>
</context>
<context id="in-math">
<include>
<context ref="common-commands"/>
<context ref="specials-symbol"/>
<context ref="command"/>
</include>
</context>
<context id="in-inline-math">
<include>
<context ref="common-commands"/>
<context ref="specials-symbol"/>
<context ref="command"/>
</include>
</context>
<context id="latex">
<include>
<context id="comment" style-ref="comment">
<start>%</start>
<end>$</end>
<include>
<context ref="def:in-comment"/>
</include>
</context>
<context id="verbatim-comment" style-ref="comment">
<start>\\begin\{comment\}</start>
<end>\\end\{comment\}</end>
<include>
<context ref="def:in-comment"/>
</include>
</context>
<context id="math-1" style-ref="math">
<start>\$\$</start>
<end>\$\$</end>
<include>
<context sub-pattern="0" where="start" style-ref="math-bound"/>
<context sub-pattern="0" where="end" style-ref="math-bound"/>
<context ref="in-math"/>
</include>
</context>
<context id="math-2" style-ref="math">
<start>\\\[</start>
<end>\\\]</end>
<include>
<context sub-pattern="0" where="start" style-ref="math-bound"/>
<context sub-pattern="0" where="end" style-ref="math-bound"/>
<context ref="in-math"/>
</include>
</context>
<context id="inline-math-1" style-ref="inline-math">
<start>\$</start>
<end>\$</end>
<include>
<context sub-pattern="0" where="start" style-ref="math-bound"/>
<context sub-pattern="0" where="end" style-ref="math-bound"/>
<context ref="in-inline-math"/>
</include>
</context>
<context id="inline-math-2" style-ref="inline-math">
<start>\\\(</start>
<end>\\\)</end>
<include>
<context sub-pattern="0" where="start" style-ref="math-bound"/>
<context sub-pattern="0" where="end" style-ref="math-bound"/>
<context ref="in-inline-math"/>
</include>
</context>
<context id="verbatim-env" style-ref="verbatim">
<start extended="true">
\\begin\{
(
verbatim\*?|
lstlisting|
alltt
)
\}
</start>
<end>\\end\{\%{1@start}\}</end>
</context>
<context id="verbatim-inline" style-ref="verbatim">
<start>\\(verb\*?|lstinline)(\S)</start>
<end>\%{2@start}</end>
</context>
<context id="include" style-ref="include">
<prefix>\\</prefix>
<keyword>input</keyword>
<keyword>include</keyword>
<keyword>includeonly</keyword>
<keyword>usepackage</keyword>
</context>
<context ref="common-commands"/>
<context ref="specials-symbol"/>
<context ref="command"/>
</include>
</context>
</definitions>
</language>