1

Can I create "sections" in a .tex document that compilation will ignore, but will be reflected in the structure of the document, as displayed in texmaker to the left of the window?

When I write a .tex document with Texmaker (windows) and I use the commands \section or \subsection, this is reflected on the left side of the window: there is a list of all sections, subsection, subsubsections etc... This list is extremely useful for navigation within a document. Can I have a list like this show up while using texmaker, that will be ignored by the compiling process?

I need it for easy browsing and better orientation within the document.

My solution at the moment is very primitive: I use the standard \section command, and once I'm done writing the text, I place % signs in front of the sections I want Latex to ignore.

Edit I've noticed today that sometimes texmaker still displays %\section{whatever} as a real section in the sidebar, but I'm not sure wether it's a bug or a feature, and I don't know what triggered it, nor what turned it off eventually.

4

There seem to be several ways …

1 use the bookmark feature (by texenthusiast)

TeXmaker provides the option to add up to three book marks to your code. (TeXstudio which is a more flexile fork, can add up to ten book marks)

2 use the comment package (by Torbjørn)

\usepackage{comment}
% ...
\begin{comment}
   \section{I'm not here}
\end{comment}

3 hide it from TeX with booleans

You can use \iffalse which is a boolean operation that is always false and the following code will be ignored. Every \if… must be ended with a \fi.

\iffalse
   \section{I'm not here}
\fi

4 using different files

This is not a real answer to you question but maybe it will help if you separate your code in several files and load them with \input or \include. I guess \input would be better here (see When should I use \input vs. \include?). Again I like the handling of multiple files in TeXstudio better.

  • The comment package is just what I needed, thanks! – Olivier Bégassat Oct 7 '13 at 2:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.