[TxMt] questions about themes

Daniel Käsmayr daniel at kaesmayr.net
Sun Nov 5 10:35:33 UTC 2006


Hello Alain,


Am 5. Nov 2006 um 10:38 schrieb Alain Matthes:
> 1) For the LaTeX users with TM : Which topic do you use?

I have used three themes so far for LaTeX:
1. iLife 05, which is nice and fine but by far no real Latex-theme
2. Brilliance Black and siblings by Thomas, which are nice and very  
complete themes for many languages (see below), but by far not good  
enough for my Latex-needs, although at the moment I am back to  
Brilliance Black… [1] and I guess I should look if there is an update  
to it.
3. My own modified version of Brilliance Black, which, in addition to  
changes to my Latex-grammar is quite nice and fulfills my needs.


> 2) Generally, is it possible that a theme can be excellent for  
> several languages?
> I think that it is very complicated ...

It is, but Thomas's Brilliance Black themes [1] are very detailed and  
I believe he aims to provide support for quite a bunch of languages.

> 3) I work especially with Latex and CSS and for Latex, it seems to  
> me that only two themes are proposed:
>
> Blackboard and Brilliance Black but at each time i' ve some  
> problems with LateX .
> Blacboard is perhaps simple and the best but do there exist other  
> themes to use LaTeX?
>
> I would like to make some changes but it is relatively difficult.  
> For example, I often use pgf/tikz and I suppose that many uses  
> pstricks. I would like to be able to emphasize
> \begin {tikzpicture}… \ end {tikzpicture}
> and reserved words of tikz in a certain color. I think it's the  
> same for pstricks.
>
> Perhaps, one among you is able to describe the procedure because I  
> suppose that it will be the same one for all the packages.
>
> How to make? Do you have  recommendations so I can do that myself?

If you want to style something like a keyword -- it HAS to be  
recognized by the language grammar. So anything that you will want to  
add needs to be both in the theme and inside the grammar. And I guess  
there are two ways to do this:
- either you create your own grammar file and add your changes there
- or you try to get your changes added to the official LaTeX grammar.

An example for the first approach:
I have my own bundle with my own LaTeX.dekay language which I select  
when working in LaTeX.

{	scopeName = 'text.tex.latex.dekay';
fileTypes = ( 'tex' );
patterns = (
{	name = 'meta.label.reference.latex';
begin = '(\\(?:ref|eqref|vref|prettyref)\{)';
end = '(\})';
captures = { 1 = { name = 'keyword.control.ref.latex'; }; };
patterns = (
{	name = 'constant.other.reference.lable.latex';
match = '[a-zA-Z,:0-9]+';
}
);
},

> The las section is one taken from the original language grammar and  
> extended by the different ways I markup references… but they are  
> all styled as the regular references…

{	name = 'meta.function.section.latex';
begin = '((\\(?:part))(\*?)(?:(\[)[^\[]*?(\]))??(\{))';
end = '(\})';
captures = { 1 = { name = 'support.function.section.part.latex'; }; };
patterns = ( { include = 'text.tex.latex'; } );
contentName = 'entity.name.section';
},

> Then I have different patterns for each type of heading that get  
> named differently, so that I can have different color highlights  
> for each… in my custom theme

{	name = 'meta.package.fixme.latex';
begin = '(\\(?:fixme)\{)';
end = '(\})';
captures = { 1 = { name = 'support.function.package.fixme'; }; };
patterns = ( { include = 'text.tex.latex'; } );
},

> and for some packages with their own commands I have set new rules  
> to make them highlighted as such… e.g. the fixme-package gets a  
> yellow backgground which stands out nicely on Brilliance Black.

{	include = 'text.tex.latex'; },
);
}

> The language grammar then includes the original grammar and this  
> gets me the regular Latex-based highlighting.

As for the theme itself:
I have made a copy of Brilliance Black and added the newly styled  
commands/scopes to it.

There is also one additional alternative: once your custom grammar  
file is finished you can use the "create theme of the day" command by  
Allan - which was created for the purpose of creating a new custom  
theme with random colors based on the current document's language  
grammar… but I can't seem to find it anywhere… search this list for  
it, I believe it was posted a while ago (March?).

Dan

[1]: http://textmate.svn.subtlegradient.com/Themes/Brilliance%20Black% 
20BETA.tmTheme



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3996 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20061105/82c121f3/attachment.p7s>


More information about the textmate mailing list