Menu

#1223 \todo{} not in list of TODOs anymore

None
works-for-me
nobody
None
1
2015-02-18
2015-02-06
Anonymous
No

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.

Thanks.

Discussion

  • Tim Hoffmann

    Tim Hoffmann - 2015-02-06

    Works here. Please provide a minimal example showing the effect.

     
  • Florian

    Florian - 2015-02-12

    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.

     
  • Tim Hoffmann

    Tim Hoffmann - 2015-02-17

    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.

    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:

    \documentclass[10pt,a4paper]{article}
    \usepackage{todonotes}
    \begin{document}
    %TODO 1) This appears.
    \todo{2) This as well.}
    \end{document}
    
     
  • Tim Hoffmann

    Tim Hoffmann - 2015-02-17
    • status: open --> works-for-me
    • Group: -->
     
  • Florian

    Florian - 2015-02-18

    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
  • Tim Hoffmann

    Tim Hoffmann - 2015-02-18

    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.

    main.tex

    \documentclass[10pt,a4paper]{article}
    \input{packages}
    \begin{document}
      \todo{foo bar}
    \end{document}
    

    packages.tex

    \usepackage{todonotes}
    

    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).

     
  • Florian

    Florian - 2015-02-18

    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!

     
  • Tim Hoffmann

    Tim Hoffmann - 2015-02-18

    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.

     
  • Florian

    Florian - 2015-02-18

    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!

     

Log in to post a comment.

MongoDB Logo MongoDB