The feature "todo-style commands (e.g. \todo{}) are added to the list of todos" introduced in version 2.8 does not seem to work in 2.8.8 (Mac) anymore.
While %TODO statements still occur, \todo{} statements do not.
Ah, right. In the above example it should not appear. Because the todonotes package is not included, the syntax analyzer and thus the structure outline does not recognize \todo as todo-like command.
Yes, you're right. When I include todonotes directly in the preamble, \todo{} notes show up in the master document as well as in \include{}'d files.
As far as I can see, however, there are two problems with that causing confusion:
1) When the package todonotes is loaded in a file that is \input{} in the preamble, \todo{} notes do not appear in the structure outline.
2) Once \usepackage{todonotes} has been written directly in the master document preamble and then deleted again, \todo{} notes show up in all daughter documents, but only until TeXStudio is restarted. After that, \todo{} notes do not occur in the structure outline anymore, just as before.
I would therefore suggest always putting \todo{} notes into the structure outline of any file without checking whether \usepackage{todonotes} occurs explicitly in the preamble (and not in an input header file). I think it is fair to assume that anyone who uses \todo{} notes in their documents would like to see them in the structure outline.
Would this not also be easier to implement since it involves one check less?
Or is there a way I could change the behavior of my TeXStudio version only? (less preferred)
Last edit: Florian 2015-02-18
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Would this not also be easier to implement since it involves one check less?
Yes, it would be simpler. However, the adaptability of TXS would be quite bad if we would hard-code such things. In particular, if some other package or the user would define a command, say \mytodo, it would be impossible to show it in the structure. Therefore, we add every todo-like command to the structure. "todo-like" is defined via a cwl file.
It should in principle also work for multi-file documents, e.g.
However detection of the active packages in multi-file documents is somewhat tricky and it may be that it does not work correctly for all possible cases. If you've encountered such a problem, please provide a minimal example.
Or is there a way I could change the behavior of my TeXStudio version only? (less preferred)
Yes. You can always statically import cwls at Options -> Completion -> Use following completion files. Simply check todonotes.cwl there (or if you want to customize it further, create your own cwl file in the settings folder and statically import that).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Brilliant, statically loading todonotes.cwl did the job for me. Thanks a lot.
Just for completeness:
Before loading todonotes.cwl, your minimal example did not work for me. I created the respective files, quit and re-opened TXS, then opened main.tex. The \todo{} was then not shown in the structure view, see image attached.
I don't know the reason for this. But, as I said, your solution seems to work nicely for me. So thanks again for your prompt help!
You may have to enable Options -> Editor -> Automatically load included files, otherwise the contents is not parsed and we cannot know what commands are available via this import.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Works here. Please provide a minimal example showing the effect.
Sorry for replying this late.
Please find a screen shot as minimal example attached. – I hope this is what you meant.
Let me know if (and how) I can provide more helpful information.
Ah, right. In the above example it should not appear. Because the todonotes package is not included, the syntax analyzer and thus the structure outline does not recognize
\todoas todo-like command.Basically it should not even be highlighted in the editor in green. But that's a limitation of the highlighter. See also https://sourceforge.net/p/texstudio/feature-requests/339/#de6f
With a proper document (or the text included in a multi-file document) which has
\usepackage{todonotes}it should work. For example:Yes, you're right. When I include todonotes directly in the preamble,
\todo{}notes show up in the master document as well as in\include{}'d files.As far as I can see, however, there are two problems with that causing confusion:
1) When the package
todonotesis loaded in a file that is\input{}in the preamble,\todo{}notes do not appear in the structure outline.2) Once
\usepackage{todonotes}has been written directly in the master document preamble and then deleted again,\todo{}notes show up in all daughter documents, but only until TeXStudio is restarted. After that,\todo{}notes do not occur in the structure outline anymore, just as before.I would therefore suggest always putting
\todo{}notes into the structure outline of any file without checking whether\usepackage{todonotes}occurs explicitly in the preamble (and not in an input header file). I think it is fair to assume that anyone who uses\todo{}notes in their documents would like to see them in the structure outline.Would this not also be easier to implement since it involves one check less?
Or is there a way I could change the behavior of my TeXStudio version only? (less preferred)
Last edit: Florian 2015-02-18
Yes, it would be simpler. However, the adaptability of TXS would be quite bad if we would hard-code such things. In particular, if some other package or the user would define a command, say
\mytodo, it would be impossible to show it in the structure. Therefore, we add every todo-like command to the structure. "todo-like" is defined via a cwl file.It should in principle also work for multi-file documents, e.g.
main.tex
packages.tex
However detection of the active packages in multi-file documents is somewhat tricky and it may be that it does not work correctly for all possible cases. If you've encountered such a problem, please provide a minimal example.
Yes. You can always statically import cwls at Options -> Completion -> Use following completion files. Simply check
todonotes.cwlthere (or if you want to customize it further, create your own cwl file in the settings folder and statically import that).Hi Tim!
Brilliant, statically loading todonotes.cwl did the job for me. Thanks a lot.
Just for completeness:
Before loading todonotes.cwl, your minimal example did not work for me. I created the respective files, quit and re-opened TXS, then opened main.tex. The
\todo{}was then not shown in the structure view, see image attached.I don't know the reason for this. But, as I said, your solution seems to work nicely for me. So thanks again for your prompt help!
You may have to enable Options -> Editor -> Automatically load included files, otherwise the contents is not parsed and we cannot know what commands are available via this import.
Alright, that also works. (With the static loading disabled.)
I was not aware of that setting. So it's great you mentioned it, maybe it also helps other people.
Thanks!