\includes in macros does not added to the Structure View

adin
2013-03-01
2013-03-04
  • adin
    adin
    2013-03-01

    Is there a way to have custom includes to be recognized by TeXstudio and treated as normal includes.
    For example, I need to define a custom include like this:

    \newcommand\myinclude[2]{%
      \def\ChapterPath{#1/}%
      \def\GraphicsPath{\ChapterPath images/}%
      \include{\ChapterPath#2}%
    }
    

    Or do some other things inside the macro, but the macro has a \include inside. Is there a way to make it behave like the normal include? can TeXStudio resolve the paths and add them to the structure view and treat them like childs of the current document?

     
  • You can add your command to a .cwl completion file with the suffix

    i

    to mark it as include-like-command.

    Or add %\include{foo} after everyusage of it in the document

     
  • Tim Hoffmann
    Tim Hoffmann
    2013-03-02

    Not sure, if it works correctly for commands with more than one parameter.

     
  • adin
    adin
    2013-03-03

    @Benito creating the cwl file and adding the command with the suffix adds the file to the structure view. My attempt was this:

    \includech{path}{file}#i
    

    Is it correct? However, it cannot resolve the file automatically. For example, in my latex file I do something like this:

    \includech{path}{file}
    

    And this will include 'file' that exists in 'path'. Thus the included file should be 'path/file' (or any variant with backslashes on windows). Is it possible? or is there any work around? Can I define something when defining the command to make TeXstudio to resolve each include?

     
  • Tim Hoffmann
    Tim Hoffmann
    2013-03-04

    This is not possible. The i option expects path/file in one argument. Moreover, TXS currently doesn't support the handling of multiple arguments for such cases.