# Avoid warnings in TeXlipse

I'm using TeXlipse, an Eclipse plugin, to create my TeX documents. To structure my files I use \input{filename}. Now the problem is, that every file is one section or subsection. TeXlipse shows me a warning "Subsection has no preceding section" at the beginning of every file in the Eclipse window. How can I avoid this warning? This is not really a problem, because if a file contains only a subsection and is included by \input{} into another file, where the section is located, there IS a preceding section. I'd like to avoid this warning to use it for other things like overfull hboxes.

The warning is displayed in Eclipse as shown in the figure:

Here is a MWE:

main.tex

\documentclass{scrbook}
\begin{document}
\chapter{Foo}
\section{Foo2}
\input{test}
\end{document}


test.tex

\subsection{Foo3}


In the file test.tex I get the warning described above.

• Your title mentions "warnings" while your discussion mentions "errors", or "not really an error". Which is it? – Werner Oct 27 '11 at 18:16
• It is always best to compose a MWE that illustrates the problem including the \documentclass so that those trying to help don't have to recreate it. – Peter Grill Oct 27 '11 at 18:16
• @Werner corrected my question... – strauberry Oct 27 '11 at 18:17
• I tried your MWE with TeXLive2011 and did not receive any warnings. – Peter Grill Oct 27 '11 at 18:56
• @cmhughes Updated my question. It is not the compile process but the eclipse IDE with the Eclipse plugin Texlipse – strauberry Oct 28 '11 at 6:59

From the screen shot, it appears as if the warning is displayed when you have a subfile open, not when compiling the main file. So, looking at this file alone, which is itself not compilable, there is a \subsection without a parent \section. As I mentioned in the comments, the following:

### test.tex:

\documentclass{article}
\begin{document}
\subsection{foo}
%...other content of this subsection...
\end{document}


does not result in a warning when compiled. So, perhaps one way of dealing with this is to have a fully compilable sub-file (as shown above) by adding \documentclass and \begin{document} prior to the content followed by \end{document}. This should eliminate the warning. In the main file, you would need to include the standalone package:

### main.tex:

\documentclass{scrbook}
\usepackage{standalone}
\begin{document}
\chapter{Foo}
\section{Foo2}
\input{test}% import the subsection
\end{document}


Martin, the package author provides a good example here. Also, do note that the main.tex file will need to include all the packages required by the subfiles.

If you include all the packages in the subfiles as well, you will be able to compile each them separately as well.

Update: However, quoting from the TeXlipse documentation it appears that this particular issue is hard coded into its own syntax parser:

The plug-in tries to indicate if there are errors in the document... Also, subsections without a preceding section (or subsubsection without a preceding subsection) cause a warning annotation (the warning annotation is a yellow triangle with a black exclamation mark).

so one way to get around this would be to tell the parser to ignore this portion of your document by surrounding it with %### as per the TeXlipse FAQ:

%###
\subsection
%###


I created a project structure that circumvents this warning. For my articles, I have separate self containing sub-projects for the (sub)sections. It does not require any customized build files or the like, and somewhat enforces a separation of concern (common images, bib, style file ...). You can check it out, it is available here.

Here is a solution that doesn't use any workarounds:

• Problems View in Eclipse -> upper-right corner -> "arrow down" button -> Configure contents...
• Types list -> uncheck "Problem".

Leave all others checked. Pdflatex-produced errors will still be displayed.

• This merely removes the "Problem" from the Problems View. You will still see the yellow triangle with the exclamation mark at the left, and the yellow underlining. – Bram Jul 29 '17 at 9:50