[Tex/LaTex] Textmate 2: How to increase font size of sections in the markup code


Now that TextMate 2 has gone open-source, I have a reason to move from TeXShop to TextMate 2.

There is a great feature in the markdown bundle (markdown.tmbundle), which makes the headings in code look like:

Textmate 2: Markdown Header

The very same thing in using the latex bundle (latex.tmbundle) results in:

Textmate 2: Latex Header (Section)

Question: How can I implement the larger text size (perhaps even colors) in code for sections/subsections/subsubsections in the latex bundle?

The original question was posted on stackoverflow, where I have even put a bounty on it to no avail. Perhaps the community here will be more helpful.

Best Answer

The procedure to change the appearance of section in Texmate 2 is the following:

In the Bundle editor menu, select Edit bundles ....

Then select the bundle Themes.

From menu File, select New, and when prompted select Setting

Give a name to the setting.

In the Scope Selector field use meta.function.section.latex

Then you can edit the setting, for example:

    fontName = 'Courier';
    fontSize = 36;

Then save (in the usual way, e.g, command-s).

You can repeat for other sectioning command (to identify the scope, move the cursor on the appropriate place and then use the following key combination control-shift-P)

Update: There was a feature request to give the different kinds of section tags unique tags so that be given different sizes. The scopes are now:

  • meta.function.section.section.latex
  • meta.function.section.subsection.latex
  • meta.function.section.subsubsection.latex
  • meta.function.section.chapter.latex
  • meta.function.section.part.latex
  • meta.function.section.addpart.latex
  • meta.function.section.addchap.latex
  • meta.function.section.addsec.latex
  • meta.function.section.minisec.latex

You can create multiple setting items to target different items, if you want multiple scopes to share the same size you can separate the scopes with a comma in the scope field.

The user that requested this feature has created a bundle that does this.

enter image description here