textmate/latex.tmbundle

Sections hierarchy structure

Closed this issue · 2 comments

Sorry for the unclear title, I will try to explain what I have in mind.

I always struggled a bit with TM2 to overview a larger document. Lately I am using @bcomnes' LaTeX-Font-Settings.tmbundle to introduce a better overview of a draft.

I am really envious about the vertical line of SublimeText, described on this StackOverflow page: http://stackoverflow.com/questions/17463270/column-indentation-guide-on-textmate.

Most of us we are using TM2 on screens at least 1280x800 px. Super-wide text is not really ideal for reading, one is able to set the wrap column to any size that fits (e.g. TM2 → View → Wrap Column → 80, 90, 100, etc., window frame).

So, my idea was what about providing an option of indenting the LaTeX document based on its hierarchy (chapter, section, subsection, subsubsection, etc.), nicely soft-wrapped towards the right size of the screen but not smaller than 80 characters.

Example:

\chapter{A}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed sollicitudin consectetur arcu.

   \section{A.1}
   Integer porta mollis lacus. Cras suscipit ex neque, ut rutrum ex vehicula id.

      \subsection{A.1.1}
      Vestibulum non imperdiet sapien. Praesent massa libero, scelerisque ac efficitur et, placerat id dui.

   \section{A.2}
   Donec sem ligula, posuere at consequat eu, sagittis id mauris. Duis sit amet leo est. Donec ut elementum tellus. Pellentesque eget orci ut ante viverra lobortis ut et felis.

      \subsection{A.2.1}
      Sed ligula metus, faucibus sed tincidunt nec, malesuada quis ante. Integer sit amet nisl tortor. Duis et ante et ante convallis consequat a id nunc. 

\chapter{B}
In vestibulum tortor at vehicula facilisis. Nunc eros arcu, luctus eget pharetra lobortis, ullamcorper quis metus. Donec id scelerisque tortor, vel facilisis elit. Integer pulvinar est ac tempus aliquet. Curabitur nec tincidunt lorem, ut maximus magna. Praesent eu rutrum urna. Donec sed neque velit. Mauris rhoncus, nisi non dignissim lacinia, turpis erat pulvinar ligula, vel faucibus libero leo vitae eros. Suspendisse vehicula convallis urna, aliquet rhoncus arcu consequat eget. Nam arcu magna, bibendum sed sollicitudin sed, commodo vitae tellus.

I hope this example explains what I have in mind. IMHO this will help a lot for the better structuring and overview of big drafts (e.g. books, theses, etc.). Let me know what do you think. Would it be possible to implement something like this?

Not sure how to fix this off the bat, but you may also want to see if anyone on the #textmate freenode irc channel has ideas.

(Glad you enjoy the font size tweak!)

Hi,

thank you DOFfactory, for the nice description of your feature request.

I always struggled a bit with TM2 to overview a larger document. Lately I am using @bcomnes' LaTeX-Font-Settings.tmbundle to introduce a better overview of a draft.

I can think of two things that can help you with that. The first one is Go to Symbol ( + + T) which provides a searchable overview of the whole document:

go to symbol

The above command only includes the sections for the current .tex file. In larger project many people tend to spilt their TeX document in multiple files. For an overview of these kinds of projects, we provide the command “Show Outline” ( + + O):

document outline

As you can see “Show Outline” shows an overview of the document and provides links to the different sections of your project. If you click on one of them, TextMate opens the corresponding file and jumps to the line where the section starts.

So, my idea was what about providing an option of indenting the LaTeX document based on its hierarchy (chapter, section, subsection, subsubsection, etc.), nicely soft-wrapped towards the right size of the screen but not smaller than 80 characters.

While I see the appeal of this for small projects, I have no plans to implement this functionality. Even if someone different implemented it, it is highly unlikely that I would merge it. That of course does not mean that Michael or Allan would not do so. After all I am only the current maintainer of this bundle and not the owner of this repository.

Here are a few reasons why I do not think that this proposal is a good idea:

Duplicate Functionality: As already pointed out above there are already at least two ways to show an overview of the current document.

Added Complexity: Either way we implemented this, it would certainly mean more code with additional bugs that someone needs to maintain. It is also a question of how many people would use this feature. In my opinion the time needed to implement this feature could be spent working on other parts of the bundle that more people use.

Problematic in Large Documents: After a document starts to grow, certain parts of the file will be indented quite a lot. This means, that we lose a lot of valuable space on the left, if we create TeX code that tends to use a lot of horizontal space (e.g. tables).

Other Software Already Solved this Problem: There is a whole category of software that takes care of the problem of how to structure a document: Outliners. Maybe it would make sense to use something like OmniOutliner to structure your initial draft. After you finished your draft you could export it to LaTeX. Another viable option would be just to use “Watch Document” to show a live preview of your document. For TeX projects with lot of sections but not much other content, this provides a nice overview of the document too. The LaTeX bundle also lets you easily switch between your .tex file and the document via “Synctex” (see section 4 of the Help document). So you can easily jump to the source code for a certain part of your document if you recognize something in the PDF you want to change.

Hope the above shows the reasoning behind my decision do not to support this feature.

Kind regards,
René