[Tex/LaTex] Displaying current chapter/section in your editor

editorsemacssectioning

I'm dreaming about a feature of a TeX editor (read: emacs, but for the sake of generality I'd be interested in answers about other editors, too) that displays the title of the current (read: the one that the cursor/point is in) chapter/section/subsection etc. (bonus points for displaying more than one level simultaneously, e.g. in the format "chapter:section" or whatever) somewhere (top of the screen/window/frame seems a natural choice for that). I read about the which-func-mode for emacs, but don't know (yet) how to make it work for LaTeX (and ConTeXt, for that matter).

Does anybody know how to do it in emacs, so that I don't reinvent the wheel? Are there other editors which such capabilities?

Best Answer

Sigur is right in his guess that TeXstudio does this. It has a structure panel, which shows basically a tree of the chapters, sections etc., and it will highlight the chapter where the cursor is placed. An example screenshot is below, note that the subsection where the cursor is placed has a grey background in the structure panel on the left.

If one doesn't like to keep the panel open all the time, one can create a keyboard shortcut to open/close it, under Options --> Configure TeXstudio --> Shortcuts. The relevant action is Menus --> View --> Structure.

enter image description here