I have run into a problem with the synctex option of pdflatex that seems to be related to the fancyhdr and graphicx package.
Problem: Forward and inverse search between editor and PDF viewer work only for the root.tex
and don't work for the tex file included via \input{input.tex}
.
Fwd/Inv search does work, as soon as I remove the JPG from the header.
Here's a stripped down, short example of the problem (root.tex
):
\documentclass{report}
\usepackage{fancyhdr}
\usepackage{graphicx}
\pagestyle{fancy}
\fancypagestyle{plain}{
\rhead{\includegraphics[height = 1 cm, trim = 0cm 5cm 0cm 5cm, clip]{pic.jpg} }
}
\begin{document}
\tableofcontents
\pagebreak
\chapter{main document}
main main main
main main main
main main main
\input{input.tex}
\end{document}
input.tex
looks as follows:
\chapter{input chapter}
input input input
input input input
input input input
pic.jpg is a 1700x800px 110KB file in the original, but the problem also occurs for smaller files.
The PDF output looks correct. Both tex files are in the synctex file. But forwards and inverse search don't work for input.tex
in the example above.
The problem occurs identically in both following configurations:
- Win7 x64
- Miktex
- Sublime Text 3 + LatexTools (using
texify
) - SumatraPDF
and
- Linux Mint 17.2 x64
- TeXlive
- Sublime Text 3 + LatexTools (using
latexmk
) - Evince
Any ideas how to fix that or where that problem might come from?
clip
option is the problem. But it is unclear how exactly (in my larger document there were no images in the header, I had them in floats.). It helps to put a\newpage
before the\input
.clip
option. My problem is, however, the whole thing is part of a huge project and I'm only supposed to edit theinput.tex
. In this case\newpage
doesn't help, unfortunately.input-a.tex
, and write\newpage\input{input-a}
in your current input file.\newpage
before the\input
in the example above. Did that solve the problem for you?\rhead{\usebox{\myheaderimagebox}}
. This makes a difference.