7

I'm wondering how to modify the way AUCTeX show titles.

By defaut, the titles are too big for me and they take too much place in my screen.

enter image description here

(ignore the red underlining created by flyspell set with a dictionary which is not English).

I would like to have the same font size for everything in my document. I believe the color is sufficient to emphasize titles.

I tried to set font-latex-fontify-sectioning to 'color' according to AUCTeX manual:

User Option: font-latex-fontify-sectioning

Per default sectioning commands will be shown in a larger, proportional font, which corresponds to a number for this variable. The font size varies with the sectioning level, e.g. ‘\part’ (font-latex-sectioning-0-face) has a larger font than ‘\paragraph’ (font-latex-sectioning-5-face). Typically, values from 1.05 to 1.3 for font-latex-fontify-sectioning give best results, depending on your font setup. If you rather like to use the base font and a different color, set the variable to the symbol ‘color’. In this case the face font-lock-type-face will be used to fontify the argument of the sectioning commands.

However, I obtained an error for the setting 'color':

custom-variable-set: This field should contain a number (floating point or integer)

I tried then to set this setting to 1. (the default is 1.1) with the idea that 1. should be the normal font size.

I obtained this error (I cannot see my titles anymore): enter image description here

  • According to the help it should be from 1.05 to 1.3. – Sigur May 12 '14 at 15:04
  • 1
    (setq font-latex-fontify-sectioning 1.0) should do the trick, because 1. is treated as an integer and (setq font-latex-fontify-sectioning 1) seems not to work. – giordano May 12 '14 at 15:07
  • @giordano 1.0 works (I tried 1). Any idea why 'color' couldn't do the trick? – ppr May 12 '14 at 15:08
  • @Sigur 1.05 to 1.3 are the values which give the "best" results according to the doc. It's possible to set higher or lower values. – ppr May 12 '14 at 15:10
  • 1
    For me, at least, this was an important question. I've been curious about AUCTEX, but all the screenshots I've seen show it with a variety of font sizes--like some attempt to convert a text editor into a (bad) wysiwyg editor. I don't know how many are like me, but AUCTEX evangelists might take this to heart and make it clear that the font-sizes-all-over-the-place look is not required. Am playing with AUCTEX now. Not sure yet if I want to stick with it, but certainly don't hate it. – dedded Feb 6 '16 at 17:43
7

If you want to use the color value of the font-latex-fontify-sectioning variable add the following code to your .emacs

(setq font-latex-fontify-sectioning 'color)

You must use 'color and not 'color' because the ' character is used to quote the next Lisp symbol and Emacs would interpret 'color' as the color' symbol, but AUCTeX doesn't accept that value for the font-latex-fontify-sectioning variable.

Instead, if you want to set font-latex-fontify-sectioning to 1 use

(setq font-latex-fontify-sectioning 1.0)

Setting font-latex-fontify-sectioning to 1. doesn't work because in Emacs Lisp 1. is an integer (see Integer Type on the GNU Emacs Lisp Reference Manual) and (setq font-latex-fontify-sectioning 1) doesn't work either due to a bug (now fixed) inside the current (11.87) stable version of AUCTeX.

  • Thank again for this answer. Any idea to do the same for Beamer documents (reduce titles size to normal)? – ppr Apr 8 '16 at 9:32
  • 1
    Customize font-latex-slide-title-face (M-x customize-face RET font-latex-slide-title-face RET) and set height to 1.0. – giordano Apr 8 '16 at 10:58
  • @giordano it seems (setq font-latex-fontify-sectioning 1) does not work with 12.1.1+ (current dev version). (and 1.0 does not work either but 'color works -- Emacs 24.5 here) – user4686 Jun 13 '18 at 12:39
  • @jfbu it does work for me. Please, try to replicate the issue and report to the bug tracker – giordano Jun 17 '18 at 17:50
  • I have it a hook and I am using (add-hook 'TeX-mode-hook #'jfbu/TeX-mode-hook t). With (setq font-latex-fontify-sectioning 1.0) or any other numeric value 1.5, 2.0 I tried out, the effect seems nil. With (setq font-latex-fontify-sectioning 'color) it appears to work (but uses same coloring as in comments, I do have some custom theme). I do not control everything on that system but I think I tried it on my mac and had same result. Here I do additionally (unload-feature 'tex-site) and AUCTeX is installed via ELPA in my home .emacs.d. – user4686 Jun 18 '18 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.