Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility issue with pdfpages #314

Open
albertotonda opened this issue Feb 7, 2021 · 3 comments
Open

Compatibility issue with pdfpages #314

albertotonda opened this issue Feb 7, 2021 · 3 comments

Comments

@albertotonda
Copy link

I have been using your template for a while on Overleaf with pdflatex, and it's great! However, I discovered a weird issue: when adding pages from another PDF document, using the \includepdf command from the pdfpages package, if the option bg in the dndbook class is set to full (as it is by default), the background image (e.g. img/paper.jpg) is rendered ON TOP of the the included PDF images, hiding the content. By setting bg=none or bg=print, the issue disappears.

I looked into the dndheader.sty, and it looks like that the code adding the background figure is on lines 36-44:

% Header is used to include the page background
\fancyhead{
\bool_if:NT \l__dnd_show_background_bool
{
\begin{tikzpicture}[rememberpicture,overlay]
\node[inner
sep=0pt] at (current~page.center) {\includegraphics[width=\paperwidth,height=\paperheight]{img/paper}};
\end{tikzpicture}
}
}

Unfortunately I am not familiar with the packages used: is it possible that there is a mistake somewhere that creates this (I assume incorrect) behavior?

@albertotonda
Copy link
Author

I actually found the solution. The issue was that in dndheader.sty, on line 70, the pagestyle{empty} was defined as:

\fancypagestyle{empty}{%
  \fancyfoot{}
}

So, the pagestyle was resetting only the footer, and not the header (who inserts the background image): while adding

\fancypagestyle{empty}{%
  \fancyhead{}\fancyfoot{}
}

solves the issue, because it also resets the header, removing the background from pages with \thispagestyle{empty}

@BrianCriswell
Copy link
Member

BrianCriswell commented Jun 15, 2021

Apologies for the long delay. Life has been hectic.

I think your best option would be to add a new page style for included pdf pages. See section 12 of the fancyhdr documentation. https://texdoc.org/serve/fancyhdr/0

You switch to that page style before including the PDFs, and back to fancy when you are done.

@timvdalen
Copy link

Adding a concrete example of how I handle this:

% In pre-amble
\fancypagestyle{cover}{\fancyhf{}}
% Later in the document
\includepdf[pagecommand={\thispagestyle{cover}}]{img/full-page-pdf}

As the same implies, I mainly use the style for covers, which I render as follows:

\null%
\includepdf[pagecommand={\thispagestyle{cover}}]{cover}%
{\let\newpage\relax\maketitle}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants