Changeset View
Changeset View
Standalone View
Standalone View
data/syntax/latex.xml
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
---|---|---|---|---|---|
2 | <!DOCTYPE language SYSTEM "language.dtd" | 2 | <!DOCTYPE language SYSTEM "language.dtd" | ||
3 | [ | 3 | [ | ||
4 | <!ENTITY bullet "×"> | 4 | <!ENTITY bullet "×"> | ||
5 | <!ENTITY envname "[a-zA-Z]+\*?"> | 5 | <!ENTITY envname "[a-zA-Z]+\*?"> | ||
6 | <!ENTITY regionmarker "%\s*(?:BEGIN|END)"> | ||||
6 | ]> | 7 | ]> | ||
7 | <language name="LaTeX" version="9" section="Markup" kateversion="5.0" priority="10" extensions="*.tex;*.ltx;*.dtx;*.sty;*.cls;*.bbx;*.cbx;*.lbx;*.tikz;*.pgf" mimetype="text/x-tex" casesensitive="1" author="Jeroen Wijnhout (Jeroen.Wijnhout@kdemail.net)+Holger Danielsson (holger.danielsson@versanet.de)+Michel Ludwig (michel.ludwig@kdemail.net)+Thomas Braun (thomas.braun@virtuell-zuhause.de)" license="LGPL" > | 8 | <language name="LaTeX" version="10" section="Markup" kateversion="5.0" priority="10" extensions="*.tex;*.ltx;*.dtx;*.sty;*.cls;*.bbx;*.cbx;*.lbx;*.tikz;*.pgf" mimetype="text/x-tex" casesensitive="1" author="Jeroen Wijnhout (Jeroen.Wijnhout@kdemail.net)+Holger Danielsson (holger.danielsson@versanet.de)+Michel Ludwig (michel.ludwig@kdemail.net)+Thomas Braun (thomas.braun@virtuell-zuhause.de)" license="LGPL" > | ||
8 | <highlighting> | 9 | <highlighting> | ||
10 | <!-- NOTE: Keywords of kind "\something" do not need a delimiter before "\". | ||||
11 | Using a DetectChar rule with lookAhead to detect "\" at the beginning | ||||
12 | avoids the requirement of the delimiter in the keyword. --> | ||||
9 | <list name="beginEnv"> | 13 | <list name="beginEnv"> | ||
10 | <item>\begin</item> | 14 | <item>\begin</item> | ||
11 | </list> | 15 | </list> | ||
12 | 16 | | |||
13 | <list name="endEnv"> | 17 | <list name="endEnv"> | ||
14 | <item>\end</item> | 18 | <item>\end</item> | ||
15 | </list> | 19 | </list> | ||
16 | 20 | | |||
▲ Show 20 Lines • Show All 258 Lines • ▼ Show 20 Line(s) | |||||
275 | <contexts> | 279 | <contexts> | ||
276 | <!-- Normal text --> | 280 | <!-- Normal text --> | ||
277 | <context name="Normal Text" attribute="Normal Text" lineEndContext="#stay"> | 281 | <context name="Normal Text" attribute="Normal Text" lineEndContext="#stay"> | ||
278 | <DetectSpaces/> | 282 | <DetectSpaces/> | ||
279 | <DetectIdentifier/> | 283 | <DetectIdentifier/> | ||
280 | <DetectChar char="\" attribute="Normal Text" context="LatexMacro" lookAhead="true"/> | 284 | <DetectChar char="\" attribute="Normal Text" context="LatexMacro" lookAhead="true"/> | ||
281 | <DetectChar char="$" attribute="Math" context="MathModeTex"/> | 285 | <DetectChar char="$" attribute="Math" context="MathModeTex"/> | ||
282 | <RegExpr String="<<.*>>=" attribute="Normal Text" context="NoWeb" column="0"/> | 286 | <RegExpr String="<<.*>>=" attribute="Normal Text" context="NoWeb" column="0"/> | ||
283 | <RegExpr String="%\s*(BEGIN|END)" attribute="Region Marker" context="RegionComment" firstNonSpace="true"/> | 287 | <RegExpr String="®ionmarker;" attribute="Region Marker" context="RegionComment" firstNonSpace="true"/> | ||
284 | <DetectChar char="%" attribute="Comment" context="Comment"/> | 288 | <DetectChar char="%" attribute="Comment" context="Comment"/> | ||
285 | <DetectChar char="•" attribute="Bullet" context="#stay"/> | 289 | <DetectChar char="•" attribute="Bullet" context="#stay"/> | ||
286 | </context> | 290 | </context> | ||
287 | 291 | | |||
288 | <context name="LatexMacro" attribute="Normal Text" lineEndContext="#pop"> | 292 | <context name="LatexMacro" attribute="Normal Text" lineEndContext="#pop"> | ||
289 | <keyword String="beginEnv" attribute="Structure" context="#pop!FindBeginEnvironment" beginRegion="block"/> | 293 | <keyword String="beginEnv" attribute="Structure" context="#pop!FindBeginEnvironment" beginRegion="block"/> | ||
290 | <keyword String="endEnv" attribute="Structure" context="#pop!FindEndEnvironment" endRegion="block"/> | 294 | <keyword String="endEnv" attribute="Structure" context="#pop!FindEndEnvironment" endRegion="block"/> | ||
291 | <keyword String="Label" attribute="Structure" context="#pop!Label"/> | 295 | <keyword String="Label" attribute="Structure" context="#pop!Label"/> | ||
▲ Show 20 Lines • Show All 468 Lines • ▼ Show 20 Line(s) | 763 | <context name="MathEnvParamInside" attribute="Normal Text" lineEndContext="#stay"> | |||
760 | <DetectSpaces/> | 764 | <DetectSpaces/> | ||
761 | <DetectChar char="}" attribute="Normal Text" context="#pop#pop!MathModeEnv"/> | 765 | <DetectChar char="}" attribute="Normal Text" context="#pop#pop!MathModeEnv"/> | ||
762 | </context> | 766 | </context> | ||
763 | 767 | | |||
764 | <!-- parse math environment --> | 768 | <!-- parse math environment --> | ||
765 | <context name="MathModeEnv" attribute="Math" lineEndContext="#stay"> | 769 | <context name="MathModeEnv" attribute="Math" lineEndContext="#stay"> | ||
766 | <DetectSpaces/> | 770 | <DetectSpaces/> | ||
767 | <DetectIdentifier/> | 771 | <DetectIdentifier/> | ||
768 | <keyword String="beginEnv" attribute="Structure" context="FindBeginEnvironmentInMathMode" beginRegion="block"/> | 772 | <DetectChar char="\" attribute="Math" context="BackslashMathModeEnv" lookAhead="true"/> | ||
769 | <keyword String="endEnv" attribute="Structure" context="MathFindEnd" endRegion="block"/> | 773 | <DetectChar char="$" attribute="Error" context="#stay"/> | ||
770 | <keyword String="MathModeText" attribute="Macro Mathmode" context="MathModeText"/> | 774 | <RegExpr String="®ionmarker;" attribute="Region Marker" context="RegionComment" firstNonSpace="true"/> | ||
771 | <RegExpr String="\\[()\[\]]|\$" attribute="Error" context="#stay"/> | | |||
772 | <DetectChar char="\" attribute="Macro Mathmode" context="MathContrSeq"/> | | |||
773 | <RegExpr String="%\s*(BEGIN|END)" attribute="Region Marker" context="RegionComment" firstNonSpace="true"/> | | |||
774 | <DetectChar char="%" attribute="Comment" context="Comment"/> | 775 | <DetectChar char="%" attribute="Comment" context="Comment"/> | ||
775 | <DetectChar char="•" attribute="Bullet" context="#stay"/> | 776 | <DetectChar char="•" attribute="Bullet" context="#stay"/> | ||
776 | </context> | 777 | </context> | ||
778 | <context name="BackslashMathModeEnv" attribute="Math" lineEndContext="#pop"> | ||||
779 | <keyword String="beginEnv" attribute="Structure" context="#pop!FindBeginEnvironmentInMathMode" beginRegion="block"/> | ||||
780 | <keyword String="endEnv" attribute="Structure" context="#pop!MathFindEnd" endRegion="block"/> | ||||
781 | <keyword String="MathModeText" attribute="Macro Mathmode" context="#pop!MathModeText"/> | ||||
782 | <Detect2Chars char="\" char1="(" attribute="Error" context="#pop"/> | ||||
783 | <Detect2Chars char="\" char1=")" attribute="Error" context="#pop"/> | ||||
784 | <Detect2Chars char="\" char1="[" attribute="Error" context="#pop"/> | ||||
785 | <Detect2Chars char="\" char1="]" attribute="Error" context="#pop"/> | ||||
786 | <DetectChar char="\" attribute="Macro Mathmode" context="#pop!MathContrSeq"/> | ||||
787 | </context> | ||||
777 | 788 | | |||
778 | <!-- start of an environment in math mode --> | 789 | <!-- start of an environment in math mode --> | ||
779 | <context name="FindBeginEnvironmentInMathMode" attribute="Normal Text" lineEndContext="#stay"> | 790 | <context name="FindBeginEnvironmentInMathMode" attribute="Normal Text" lineEndContext="#stay"> | ||
780 | <DetectSpaces/> | 791 | <DetectSpaces/> | ||
781 | <DetectChar char="{" attribute="Normal Text" context="BeginEnvironmentInMathMode"/> | 792 | <DetectChar char="{" attribute="Normal Text" context="BeginEnvironmentInMathMode"/> | ||
782 | <RegExpr String="." attribute="Normal Text" context="#pop"/> | 793 | <RegExpr String="." attribute="Normal Text" context="#pop"/> | ||
783 | </context> | 794 | </context> | ||
784 | 795 | | |||
Show All 34 Lines | 829 | <context name="TabEnv" attribute="Environment" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop#pop#pop"> | |||
819 | <DetectChar char="}" attribute="Normal Text" context="Tab"/> | 830 | <DetectChar char="}" attribute="Normal Text" context="Tab"/> | ||
820 | <RegExpr String="[^}]*" attribute="Error" context="#stay"/> | 831 | <RegExpr String="[^}]*" attribute="Error" context="#stay"/> | ||
821 | </context> | 832 | </context> | ||
822 | 833 | | |||
823 | <!-- parse tabular text --> | 834 | <!-- parse tabular text --> | ||
824 | <context name="Tab" attribute="Normal Text" lineEndContext="#stay"> | 835 | <context name="Tab" attribute="Normal Text" lineEndContext="#stay"> | ||
825 | <DetectChar char="&" attribute="Ampersand" context="#stay"/> | 836 | <DetectChar char="&" attribute="Ampersand" context="#stay"/> | ||
826 | <Detect2Chars char="@" char1="{" attribute="Column Separator" context="Column Separator"/> | 837 | <Detect2Chars char="@" char1="{" attribute="Column Separator" context="Column Separator"/> | ||
827 | <keyword String="endEnv" attribute="Structure" context="TabFindEnd"/> | 838 | <RegExpr String="\\end\b" attribute="Structure" context="TabFindEnd"/> <!-- endEnv --> | ||
828 | <IncludeRules context="Normal Text" /> | 839 | <IncludeRules context="Normal Text" /> | ||
829 | </context> | 840 | </context> | ||
830 | 841 | | |||
831 | <context name="Column Separator" attribute="Column Separator" lineEndContext="#stay"> | 842 | <context name="Column Separator" attribute="Column Separator" lineEndContext="#stay"> | ||
832 | <DetectChar char="{" attribute="Column Separator" context="Column Separator"/> | 843 | <DetectChar char="{" attribute="Column Separator" context="Column Separator"/> | ||
833 | <DetectChar char="}" attribute="Column Separator" context="#pop"/> | 844 | <DetectChar char="}" attribute="Column Separator" context="#pop"/> | ||
834 | </context> | 845 | </context> | ||
835 | 846 | | |||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | 889 | <context name="MathModeEnsureInside" attribute="Math" lineEndContext="#stay"> | |||
880 | <DetectChar char="}" attribute="Math" context="#pop" /> | 891 | <DetectChar char="}" attribute="Math" context="#pop" /> | ||
881 | <IncludeRules context="MathModeCommon"/> | 892 | <IncludeRules context="MathModeCommon"/> | ||
882 | </context> | 893 | </context> | ||
883 | 894 | | |||
884 | <!-- math mode common --> | 895 | <!-- math mode common --> | ||
885 | <context name="MathModeCommon" attribute="Math" lineEndContext="#stay"> | 896 | <context name="MathModeCommon" attribute="Math" lineEndContext="#stay"> | ||
886 | <DetectSpaces/> | 897 | <DetectSpaces/> | ||
887 | <DetectIdentifier/> | 898 | <DetectIdentifier/> | ||
888 | <keyword String="beginEnv" attribute="Structure" context="MathEnvironment" beginRegion="block"/> | 899 | <DetectChar char="\" attribute="Math" context="BackslashMathModeCommon" lookAhead="true"/> | ||
889 | <keyword String="endEnv" attribute="Structure" context="MathEnvironmentEnd" endRegion="block"/> | 900 | <RegExpr String="®ionmarker;" attribute="Region Marker" context="RegionComment" firstNonSpace="true"/> | ||
890 | <keyword String="MathModeText" attribute="Macro Mathmode" context="MathModeText" /> | | |||
891 | <DetectChar char="\" attribute="Macro Mathmode" context="MathContrSeq"/> | | |||
892 | <RegExpr String="%\s*(BEGIN|END)" attribute="Region Marker" context="RegionComment" firstNonSpace="true"/> | | |||
893 | <DetectChar char="%" attribute="Comment" context="Comment"/> | 901 | <DetectChar char="%" attribute="Comment" context="Comment"/> | ||
894 | <DetectChar char="•" attribute="Bullet" context="#stay"/> | 902 | <DetectChar char="•" attribute="Bullet" context="#stay"/> | ||
895 | </context> | 903 | </context> | ||
904 | <context name="BackslashMathModeCommon" attribute="Math" lineEndContext="#pop"> | ||||
905 | <keyword String="beginEnv" attribute="Structure" context="#pop!MathEnvironment" beginRegion="block"/> | ||||
906 | <keyword String="endEnv" attribute="Structure" context="#pop!MathEnvironmentEnd" endRegion="block"/> | ||||
907 | <keyword String="MathModeText" attribute="Macro Mathmode" context="#pop!MathModeText" /> | ||||
908 | <DetectChar char="\" attribute="Macro Mathmode" context="#pop!MathContrSeq"/> | ||||
909 | </context> | ||||
896 | <context name="MathEnvironment" attribute="Math" lineEndContext="#stay"> | 910 | <context name="MathEnvironment" attribute="Math" lineEndContext="#stay"> | ||
897 | <DetectSpaces/> | 911 | <DetectSpaces/> | ||
898 | <DetectChar char="{" attribute="Normal Text" context="MathEnvironmentInside"/> | 912 | <DetectChar char="{" attribute="Normal Text" context="MathEnvironmentInside"/> | ||
899 | <RegExpr String="." attribute="Error" context="#pop"/> | 913 | <RegExpr String="." attribute="Error" context="#pop"/> | ||
900 | </context> | 914 | </context> | ||
901 | <context name="MathEnvironmentInside" attribute="Environment" lineEndContext="#stay"> | 915 | <context name="MathEnvironmentInside" attribute="Environment" lineEndContext="#stay"> | ||
902 | <DetectChar char="}" attribute="Normal Text" context="#pop#pop"/> | 916 | <DetectChar char="}" attribute="Normal Text" context="#pop#pop"/> | ||
903 | <RegExpr String="&envname;" attribute="Environment" context="#stay"/> | 917 | <RegExpr String="&envname;" attribute="Environment" context="#stay"/> | ||
Show All 32 Lines | 947 | <context name="MathModeTextParameterStart" attribute="Normal Text" lineEndContext="#stay" > | |||
936 | <DetectChar char="{" attribute="Normal Text" context="MathModeTextInside" lookAhead="true"/> | 950 | <DetectChar char="{" attribute="Normal Text" context="MathModeTextInside" lookAhead="true"/> | ||
937 | <DetectChar char="}" attribute="Normal Text" context="#pop#pop"/> | 951 | <DetectChar char="}" attribute="Normal Text" context="#pop#pop"/> | ||
938 | <DetectChar char="%" attribute="Comment" context="Comment"/> | 952 | <DetectChar char="%" attribute="Comment" context="Comment"/> | ||
939 | <DetectChar char="\" attribute="Macro Mathmode" context="MathContrSeq"/> | 953 | <DetectChar char="\" attribute="Macro Mathmode" context="MathContrSeq"/> | ||
940 | </context> | 954 | </context> | ||
941 | 955 | | |||
942 | <!-- iffalse aka multiline comment --> | 956 | <!-- iffalse aka multiline comment --> | ||
943 | <context name="Multiline Comment" attribute="Comment" lineEndContext="#stay"> | 957 | <context name="Multiline Comment" attribute="Comment" lineEndContext="#stay"> | ||
944 | <keyword String="iffalseend" attribute="Comment" context="#pop"/> | 958 | <DetectChar char="\" attribute="Comment" context="BackslashMultilineComment" lookAhead="true"/> | ||
959 | </context> | ||||
960 | <context name="BackslashMultilineComment" attribute="Comment" lineEndContext="#pop"> | ||||
961 | <keyword String="iffalseend" attribute="Comment" context="#pop#pop"/> | ||||
962 | <DetectChar char="\" attribute="Comment" context="#pop"/> | ||||
945 | </context> | 963 | </context> | ||
946 | 964 | | |||
947 | <!-- comment --> | 965 | <!-- comment --> | ||
948 | <context name="RegionComment" attribute="Region Marker" lineEndContext="#pop"/> | 966 | <context name="RegionComment" attribute="Region Marker" lineEndContext="#pop"/> | ||
949 | <context name="Comment" attribute="Comment" lineEndContext="#pop"> | 967 | <context name="Comment" attribute="Comment" lineEndContext="#pop"> | ||
950 | <DetectSpaces/> | 968 | <DetectSpaces/> | ||
951 | <IncludeRules context="##Alerts" /> | 969 | <IncludeRules context="##Alerts" /> | ||
952 | <DetectIdentifier/> | 970 | <DetectIdentifier/> | ||
953 | <keyword String="ResetHL" attribute="Comment" context="Normal Text"/> | 971 | <DetectChar char="\" attribute="Comment" context="BackslashComment" lookAhead="true"/> | ||
972 | </context> | ||||
973 | <context name="BackslashComment" attribute="Comment" lineEndContext="#pop"> | ||||
974 | <keyword String="ResetHL" attribute="Comment" context="#pop!Normal Text"/> | ||||
975 | <DetectChar char="\" attribute="Comment" context="#pop"/> | ||||
954 | </context> | 976 | </context> | ||
955 | </contexts> | 977 | </contexts> | ||
956 | 978 | | |||
957 | <itemDatas> | 979 | <itemDatas> | ||
958 | <itemData name="Normal Text" defStyleNum="dsNormal"/> | 980 | <itemData name="Normal Text" defStyleNum="dsNormal"/> | ||
959 | <itemData name="Option Text" defStyleNum="dsNormal" spellChecking="false"/> | 981 | <itemData name="Option Text" defStyleNum="dsNormal" spellChecking="false"/> | ||
960 | <itemData name="Macro" defStyleNum="dsFunction" spellChecking="false"/> | 982 | <itemData name="Macro" defStyleNum="dsFunction" spellChecking="false"/> | ||
961 | <itemData name="Comment" defStyleNum="dsComment" spellChecking="false"/> | 983 | <itemData name="Comment" defStyleNum="dsComment" spellChecking="false"/> | ||
▲ Show 20 Lines • Show All 146 Lines • Show Last 20 Lines |