raphael-cch / latex-tree

Document tree view for LaTeX
https://atom.io/packages/latex-tree
GNU General Public License v3.0
5 stars 3 forks source link

Add support to show \autoref, \nameref, \ac etc. in TreeView as content #6

Open Callmoon opened 5 years ago

Callmoon commented 5 years ago

Hey folks,

It would be great, if the content inside the \section and so on for the tags \autoref, \nameref, \ac and so on could also be rendered right in tree. I'm using this tags to dynamise my latex documents.

Actually it is directly shown what's inside the defined latex structure tags.

raphael-cch commented 5 years ago

Actually it is directly shown what's inside the defined latex structure tags.

Sorry, I'm not sure I understand what you mean by this. Could you give an example of the \section{} heading causing the problem, what the document tree currently shows and what you would like it to show?

Callmoon commented 5 years ago

Here's an example: \paragraph{\acf{CAD}} shows \acf{CAD} inside the tree. It would be nice if he could go onto the deepest textelement - in this case just CAD (it would be better if it could resolve the content like the acronyms package but I think this is a huge and not necessary effort).

raphael-cch commented 5 years ago

That's an interesting idea. Whether to hide the tags and just display the text element probably depends on the tag and also the user's preferences. For example I can imagine that it'll be useful to hide \acf{}, \ac{} etc, and even possibly \emph{} and \textbf{}, but it might be confusing if \cite{} or \autoref{} were hidden.

One possible way to resolve this is to add an option in the package settings for custom regular expression(s), where any matching contents in the header would be replaced by the captured content (if any) in the regular expression. For example the regular expression \\acf{(.*)} would capture the contents inside the \acf{} tag and only display that captured content. An additional benefit is that the user could choose to completely hide some tags (eg \footnote{}, \marginnote{} etc).

Callmoon commented 5 years ago

The option in the package would be nice - I would prefer also a second option (for the people who are not familiar with regular expressions) that you can take the deepest content inside { ... } (so a predefined regex).

This could be activated by a checkbox and in the moment of activation grey out the own described regex in the settings (and also override the intrepretation logic).