3

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?

19
  • 1
    What kind of editor would you like? I use TeXstudio and it has a left panel to show all the label commands, ref, section at all.
    – Sigur
    Nov 16, 2012 at 18:23
  • 1
    Well, I can't see anything like an answer to my question there...
    – mbork
    Nov 16, 2012 at 18:26
  • 1
    @Sigur : emacs with AUCTeX + reftex can do that too, but that won't tell you where is the pointer exactly.
    – T. Verron
    Nov 16, 2012 at 18:29
  • 1
    @mbork : That would call another discussion, but I'm 99% sure I was able to use outline with AUCTeX, sure with non-standard shortcuts, but without any tweaks on my side.
    – T. Verron
    Nov 16, 2012 at 18:37
  • 1
    Getting a feature like this to work 100% of the time would require the use of TeX to figure the actual heading as it could easily depend on how the file is compiled, and what the packages and other files that come before the current line do to the sectioning commands. I think the best solution really is that each chapter/section should be in a separate file and then the file name is already displayed at the top (at least with TeXShop and TeXworks). Nov 16, 2012 at 19:30

1 Answer 1

4

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

2
  • Thanks, this is nice; however, a panel takes up much screen real estate, I'd prefer only the highlighted part. (And a ConTeXt version, too.) Still, this is a good answer! (Not accepting it since I'm really looking for emacs solution.)
    – mbork
    Nov 16, 2012 at 22:42
  • Well, you can hide/show the structure panel using the icons on the left bottom corner of the window. Also, you can adjust the width of the panel.
    – Sigur
    Nov 16, 2012 at 23:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .