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.

When using pdflatex I generate a synctex file for inverse search. So far, pointing and clicking in the PDF viewer (SumatraPDF) brings me to the correct line in the TeX editor (TeXnicCenter).

However, if I use the crop package, almost all line numbers that the inverse search gives are wrong (by offsets of some lines). Clicking in the PDF brings me too far in tex source. This is quite annoying and definitely not how it should be.

Example (updated):

\documentclass[a4paper]{article}
\usepackage[a3,frame,center]{crop} %without this package inverse search works fine!
% (We let "crop" print on a3 paper to be able to see the produced frame.)
\usepackage{lipsum}

\begin{document}
\section{The first lipsum}
\lipsum
% the cursor should be placed around this line by the inverse search of
% the  ***last lines***  of above lipsum text in the PDF
\section{The second lipsum}
\lipsum
% but the cursor appears at the next line!
\section{The third lipsum}
\lipsum
\end{document}

Any ideas how to solve it? BTW, where is synctex maintained?

FYI, for this example, \listfiles outputs (updated)

*File List*
article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
    crop.sty    2003/05/20 v1.9 crop marks (mf)
  color.sty    2005/11/14 v1.0j Standard LaTeX Color (DPC)
  color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
  pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
graphics.sty    2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2010/04/23 v1.9 graphics configuration of TeX Live
  lipsum.sty    2011/04/14 v1.2 150 paragraphs of Lorem Ipsum dummy text
supp-pdf.mkii
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
  ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
epstopdf-base.sty    2010/02/09 v2.5 Base part for package epstopdf
  grfext.sty    2010/08/19 v1.1 Manage graphics extensions (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)
kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO)
  keyval.sty    1999/03/16 v1.13 key=value parser (DPC)
kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live

Just to note, the following files are not used by the updated example: geometry.sty, ifvtex.sty, ifxetex.sty, crop.cfg, atbegshi.sty.

And the versions of some files changed. The old versions were: ifpdf.sty(v2.1), pdftex.def(v0.05d), lipsum(v1.1), ltxcmds(v1.7), pdftexcmds.sty(v0.9), grfext.sty(v1.0), kvoptions.sty(v3.7), kvsetkeys.sty(v1.9), etexcmds.sty(v1.3).

share|improve this question
    
On Mac OS X, with Aquamacs and Skim, it works perfectly. –  egreg Apr 19 '11 at 17:52
    
This seems to be a follow-up question to Draw true page border where the crop package was mentioned as solution. –  Martin Scharrer Apr 19 '11 at 17:58
    
So far the problem still exists... To make it more evident, I updated the MWE. The geometry package was removed since the problem occurs without it, too. –  e-birk May 12 at 14:18

2 Answers 2

(More of a comment)

This seems to be 'works for me' with the \listfiles output

*File List*
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
geometry.sty    2010/09/12 v5.6 Page Geometry
  keyval.sty    1999/03/16 v1.13 key=value parser (DPC)
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
  ifvtex.sty    2010/03/01 v1.5 Switches for detecting VTeX and its modes (HO)
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
    crop.sty    2003/05/20 v1.9 crop marks (mf)
   color.sty    2005/11/14 v1.0j Standard LaTeX Color (DPC)
   color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
  pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/message (HO)
 ltxcmds.sty    2011/04/18 v1.20 LaTeX kernel commands for general use (HO)
graphics.sty    2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2010/04/23 v1.9 graphics configuration of TeX Live
    crop.cfg
  lipsum.sty    2011/04/14 v1.2 150 paragraphs of Lorem Ipsum dummy text
atbegshi.sty    2011/01/30 v1.15 At begin shipout hook (HO)
supp-pdf.mkii
pdftexcmds.sty    2011/04/22 v0.16 Utilities of pdfTeX for LuaTeX (HO)
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
epstopdf-base.sty    2010/02/09 v2.5 Base part for package epstopdf
  grfext.sty    2010/08/19 v1.1 Managing graphics extensions (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Defining keys (HO)
kvoptions.sty    2010/12/23 v3.10 Keyval support for LaTeX options (HO)
kvsetkeys.sty    2011/04/07 v1.13 Key value parser (HO)
etexcmds.sty    2011/02/16 v1.5 Prefix for e-TeX command names (HO)
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
 ***********

and tested using TeX Live 2010 and 2011. Can you provide more version information, otherwise this looks 'too localized' to me.

share|improve this answer
    
With pleasure. Both tools are brilliant so would be great to get it working together :D –  ronszon Jul 16 '11 at 6:55
    
@ronszon Could you post which TeX biarny you are using (the line that says TeX 3.141...)? –  Joseph Wright Jul 16 '11 at 21:42
    
Do you mean if I use pdflatex? (I removed copyright info, sorry) pdfTeX 3.1415926-1.40.11-2.2 (Web2C 2010) kpathsea version 6.0.0 Compiled with libpng 1.4.3; using libpng 1.4.3 Compiled with zlib 1.2.5; using zlib 1.2.5 Compiled with xpdf version 3.02pl4 –  ronszon Jul 17 '11 at 6:28
    
@JosephWright Does the MWE still work for you without problems? My changes of MWE consist mainly of the removal the comment in front of \usepackage{crop} and the addition of \section's to make the problem more evident. It'd be great if you could check the modified MWE, too. –  e-birk May 16 at 14:16
    
It does not work for me. Backwards search is still off by at least a few lines. –  daleif May 19 at 11:48

A first try. Add the following lines after loading the crop package. (Note, this creates overfull boxes!)

%\usepackage[........]{crop}  must comes before the patch!
%------ our patch
\usepackage{pict2e}
\usepackage{etoolbox}
\makeatletter
\patchcmd\CROP@kernel{\hb@xt@\z@}{}{}{}
\makeatother
%------

To the details.

  1. The crop package draws the frame etc. by using picture-environments. Inverse search does not work well with the original definition of picture-environment, but the pict2e package redefines it in a way inverse search can work with.

  2. For drawing the frame etc. the picture environments are nested in boxes of type \vbox and \hbox. A small modification of the crop package by using the \patchcmd of the etoolbox package will make the inverse search work properly but at the cost of overfull boxes!!

Here the complete MWE:

\documentclass[a4paper]{article}
\usepackage[a3,frame,center]{crop}
\usepackage{pict2e}
\usepackage{etoolbox}
\makeatletter
\patchcmd\CROP@kernel{\hb@xt@\z@}{}{}{}
\makeatother
\usepackage{lipsum}

\begin{document}
\section{The first lipsum}
\lipsum

\section{The second lipsum}
\lipsum

\section{The third lipsum}
\lipsum
\end{document}
share|improve this answer

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.