11

Edit: Seems to be a problem with SyncTeX, as TeXworks reacts the same.
Edit2: same problem with texlive in Win7.

I have a similiar problem as described in TeXstudio Bugreport 1225 but with menukeys-package.

consider the following MWE for reconstructing the problem:

\documentclass[a4paper]{scrreprt}
\usepackage{blindtext}
\usepackage{menukeys}

\begin{document}
\blindtext
\keys{CTRL + X} in \directory{File/Save As}
\blindtext
\end{document}

It compiles fine, but when I click on "Goto Source" in the embedded viewer, pgflibraryfadings.code.tex is opened instead. This only happens on the first page of any document. Any clues on a fix?

Setup: I use MiKTeX 2.9 (64bit), TeXstudio 2.10.8 on a Win7 machine.

Secondary setup: TeX Live 2015, TeXworks, Win7

2 Answers 2

3

After debugging that problem for a while (It bothers me, too, currently), I've came up with a work-around. But please use with care: I found the source of the problem, but I don't really know what I'm doing here ;-)

After debugging for a while, I found out that libraries/pgflibraryfadings.code.tex (note, all paths are relative to /usr/share/texlive/texmf-dist/tex/generic/pgf/) is included from frontendlayer/tikz/libraries/tikzlibraryfadings.code.tex and uses the macro \pgfdeclarehorizontalshading, which is defined in basiclayer/pgfcoreshade.code.tex. This uses \pgfsys@horishading which is defined in systemlayer/pgfsys-pdftex.def and contains somewhere the line \immediate\pdfxform resources ... in the definition of \pgfsys@horishading, and this is the main culprit. The problem seems to be the \immediate which ships out something immediately to the PDF and seems to confuse pdflatex. If you remove the \immediate everything seems to work fine. So I would propose the following workflow:

  1. Copy /usr/share/texlive/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def to your current tex working directory.
  2. Locate the lines containing \immediate\pdfxform after \def\pgfsys@horishading#1#2#3{%, \def\pgfsys@vertshading#1#2#3{%, and \def\pgfsys@radialshading#1#2#3{% and remove the \immediate.
  3. The shading stuff still works for me, but maybe before the final build, you want to remove the file pgfsys-pdftex.def from your working directory again, to be sure the original version is used.
3
  • 1
    thanks for the effort, but please don't be upset when I don't mark this as "accepted". I'd like to have the problem solved on a more permanent level and of course without the hacking around. I've tested your method and it does work, but it's too much of a hassle to do this everytime. I'd appreciate if you could send your findings to the DEV team of the respective package. much obliged
    – naphaneal
    Commented Feb 13, 2017 at 18:53
  • 3
    I posted it here: sourceforge.net/p/pgf/bugs/333. However, I think its best to have both: a quick fix to continue working, and to have it fixed upstream. Commented Feb 14, 2017 at 12:42
  • Did not help me, unfortunately. Commented Oct 6, 2023 at 8:08
4

I had a similar problem when using the tikzlibrary "shadows".

As proposed here, if the library is not being used, removing it "solves" the problem.

%\usetikzlibrary{shadows}
5
  • There isn't much to add to my post. The problem is described above by naphaneal and the solution, as stated in the 2nd sentence of my post, is to remove the library if not used. Nevertheless, I made some modifications to my post. Commented Jul 26, 2017 at 8:30
  • To be precise, the problem is with tikzlibrary "fadings", which "shadows" internally uses. You may also encounter the same issue with other things that use "fadings", such as the todonotes package. Commented Dec 5, 2019 at 10:40
  • I needed to remove both tiks and pgf package usages from the preamble for this to work. Thanks!
    – mahdiz
    Commented Oct 4, 2020 at 18:17
  • 1
    Another source of this problem is the most option for package tcolorbox. Commented Feb 15 at 9:45
  • Switching back from lualatex to xelatex solved the problem for me. Commented Feb 15 at 9:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .