Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Structure view breaks at \begingroup in...

TXS - Help
elwood151
2011-09-30
2012-10-17
  • elwood151
    elwood151
    2011-09-30

    I recently noticed a problem with the structure (tree) view, where from a
    certain point in the document all subsubsections where inserted at the highest
    level in the document tree (like chapters).

    I finally found that this seems to be caused by a \begingroup .... \endgroup
    command used in the source code.

    Does anyone else have the same problem or can reproduce it?
    I'm using texstudio SVN2.2 (provided here: https://sourceforge.net/projects/t
    exstudio/forums/forum/907839/topic/4683305
    ) on MacOS X 10.6.

     
  • elwood151
    elwood151
    2011-10-23

    can nobody help?
    could somebody test, if the problem is the same on other platforms?

     
  • can you provide a tex-file which causes this error ?

     
  • elwood151
    elwood151
    2011-10-24

    @jsundermeyer:
    Thank you very much for your reply!
    I'm sorry - I wonder how I could be sure that the begingroup command was the
    culprit as I was not able to reproduce the behavior (at first).

    It seems to be due to an "outsourced" tex file which is integrated via
    \input{} or \include{},
    this seems to move all following headings in the structure view (until the
    next chapter) to chapter level.

    example
    When you remove the lines \input{...} one by one (beginning with the first
    one), you can should the structure view change successively

        \documentclass[11pt, a4paper]{scrbook}
    
        \usepackage[ngerman]{babel}
    %   \usepackage{ifthen, paralist, tabularx, enumitem}
    
        \begin{document}
    
    \chapter{Chap 1}
    \section{Sec 1.1}
    \input{filename}
    \section{Sec 1.2}
    \input{filename}
    \subsection{Sec 1.2.1}
    \input{filename}
    \subsection{Sec 1.2.2}
    
    \begin{table}
    \begingroup
    test
    \endgroup
    \end{table}
    
    \subsection{Sec 1.2.3}
    
    \begin{table}[]
    \centering
    \input{./TexFileForTable}
    \end{table}%
    
    \subsection{Sec 1.2.4}
    
    \section{Sec 1.3}
    \section{Sec 1.4}
    
    \chapter{Chap 2}
    \section{Sec 2.1}
    \section{Sec 2.2}
    \input{filename}
    \section{Sec 2.3}
    
    \chapter{Chap 3}
    \section{Sec 3.1}
    
        \end{document}
    
     
  • the behavior that you notice is intentional, as the \input should be placed at
    top level (it can contain \section-commnads after all)

     
  • elwood151
    elwood151
    2011-10-25

    @jsundermeyer:
    hm - does that really make sense?
    Maybe my usage is an exceptional case, but as I have very large tables (also
    containing the code) and want to access them easily for search/replace etc., I
    have "outsourced" the code for them to external files.
    (So if I want to change formatting in those tables etc. I just have to edit
    the files and do not spoil anything in the rest of the document.)

    Would it be possible to create an option which disables this behavior?
    I have a large document with dozens of sections and sub(sub)sections and the
    structure view is quite useless for everything after the first such \input{}
    command

    BTW, the structure view even "breaks" if the \input or \include command is in
    a comment!

     
  • t.schreiter
    t.schreiter
    2012-02-20

    Same problem here,

    Some of my figures are .pgf, which work only with \input.

    BTW \include works only at the top level, \input works at all levels.

    So, I would favor such an option as elwood151 suggests.