Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
According to the Texmaker documentation, you can add up to three bookmarks to each document. –  ChrisS Aug 8 '13 at 22:52
    
@ChrisS This is a viable option. It's a shame you can't put more though. –  Olivier Bégassat Aug 8 '13 at 22:54
    
In version 3.2.2 -> 3.3 : commented structure entries are no more used in the structure view, may be based on majority votes at issue tracker it may be included. In TeXmaker, Edit--> Refresh Structure to get the updated the Structure –  texenthusiast Aug 8 '13 at 23:18
    
@texenthusiast I see, that's a shame, I could really use that feature. –  Olivier Bégassat Aug 8 '13 at 23:33
    
You can 'cheat' a little by adding the comment package, and saying \begin{comment}\section{I'm not here}\end{comment}, though that is a bit cumbersome. –  Torbjørn T. Aug 9 '13 at 7:08

1 Answer 1

up vote 3 down vote accepted

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.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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