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.

Synctex is very usefull for me. Jumping between source text and the compiled PDF is is absolutely great.

But when I use comment package:

in TeXStudio --- I can't switch from pdf to source.

in TeXnicCenter and in TeXWorks --- there is file comment.cut opening.

How I can go to source (my source, not comment.cut file), using comment package?

Is this a known problem?

MWE:

\documentclass{article}
\usepackage{comment}

\begin{document}
\includecomment{partA}
\includecomment{partB}

\begin{partA}
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
\end{partA}

\begin{partB}
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
\end{partB}

\end{document}
share|improve this question
    
I deleted \begin{partA} \end{partA} and use \if command of TeX, because it is very difficult to work without Synctex... –  Ama Mar 13 at 12:02
    
Not an answer but have you considered fixme? –  cfr Apr 9 at 14:41
    
OK, I can use another package, but why with package comment synctex don`t work? –  Ama Apr 11 at 7:24
    
I don't know. That's part of why my comment is not an answer. I was just offering a potential alternative. –  cfr Apr 11 at 11:46
    
@cfr, thank you. I suppose, your alternative can be usefull. –  Ama Apr 14 at 7:20

2 Answers 2

up vote 2 down vote accepted

From the documentation of the comment package it says

For inclusions, in LATEX the block is written out to a file \CommentCutFile (default “comment.cut”), which is then included

My guess is that because of this behavior, synctex thinks that you did something like an \input{myfile.tex} only with the comment.cut file.

Eg, LaTeX thinks that you put the text in a file called comment.cut which was then included in the main document.

For that reason, synctex will jump to the wrong file.

My guess is that you would have to change the package comment or use a different package as suggested, perhaps using etoolbox package where you can define \iftoggle and then include portions of text at will by just changing a boolean in the preamble.

Hope this helps,

share|improve this answer
    
Well you don't need toolbox if you use e.g. fixme. That's why I suggested it... –  cfr Apr 16 at 1:26
    
@cfr I don't want to put everything in sticky notes, but i want to selectively include actual content. The OP gave no hint that he wants to manage sticky notes, or did I miss that? –  Trefex Apr 16 at 11:53

In case it is useful and to elaborate on my comment a little: fixme has a great many options for formatting annotations, inline notes and similar items. It also has four 'levels' of each type of command and environment from a mere note through a fatal error which will block compilation in final mode. It also supports 'targeted' annotations and comment environments, themes and a multiauthor mode. The documentation has details.

Here is a small sampler:

\documentclass{article}
\usepackage[
  draft,%   change to final to hide fixme notes
  author=,% only one author of notes
  singleuser
  ]{fixme}
  \fxusetheme{color}%   pick a theme or specify layouts as desired (see manual)
\usepackage{kantlipsum}

\begin{document}

\listoffixmes

\section{A section}

\fxnote{Kant?}\kant[1]

\begin{anfxnote}{A longer note}
    \kant[2]
\end{anfxnote}

\fxwarning{Health warning?}This line should be accompanied by a warming heath.

A falsehood is here.\fxerror{This is an error.}

This is nonsense\fxfatal{So this fixme must be removed before compiling the final version!}.

\end{document}

Colourful fixmes

With this theme, the different levels of fixme are printed in different colours. Alternatively, these can be indicated in a prefix. Commenting out the theme specification in the above code:

Black and white fixmes

I have no idea how similar this might be to the facilities offered by comment but I've never had a problem going from PDF to source while using it.

share|improve this answer
    
Have you used todonotes and how do you feel it compares to this? For actual commenting and "sticky notes", this package looks pretty decent. –  Trefex Apr 16 at 11:56
1  
@Trefex I did try it at one point and had problems. I don't remember the details, though, and the package may have changed significantly since then. (It is several years since I tried it.) I think I actually tried todonotes first and found fixme after not getting the former to work for me. –  cfr Apr 23 at 14:03

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.