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

A floating object distorts background watermark #26

Open
nanabaahgyan opened this issue Apr 7, 2021 · 14 comments
Open

A floating object distorts background watermark #26

nanabaahgyan opened this issue Apr 7, 2021 · 14 comments

Comments

@nanabaahgyan
Copy link

Thanks a lot for this package.

I realised with the latest update that a floating object like a figure on a page distorts (changes font type, size, etc.) the text of the watermark on that page. I've tried it on multiple cases and it remains the same. I wonder if this is something you are aware of too.

@callegar
Copy link
Owner

callegar commented Apr 7, 2021

Was not aware, thanks for reporting. Can you provide a minimal test case? The package now relies on new LaTeX mechanisms and there may be some corner cases.

@nanabaahgyan
Copy link
Author

On the page I'm working on with a figure floating object as follows:
\begin{figure}[!ht]
\includegraphics[option]{graphic.png}
\end{figure}
The background watermark has different font and size.

If I remove the environment (\begin{figure} \end{figure}) and use only '\includegraphics...',the behaviour is reverted.

@callegar
Copy link
Owner

callegar commented Apr 7, 2021

Please be so kind to provide a minimal, but full example with the document class, any package that may be needed to trigger the issue in addition to draftwatermark, etc. You can save the actual .png file. That will really be helpful.

@callegar
Copy link
Owner

callegar commented Apr 7, 2021

Tried this:

\documentclass{article}
\usepackage{draftwatermark}
\begin{document}
test
\begin{figure}[!ht]
prova
\end{figure}
\end{document}

cannot reproduce...

@nanabaahgyan
Copy link
Author

nanabaahgyan commented Apr 7, 2021

I have quite a number of packages in use. Importantly, I'm using the exam class.

\documentclass[12pt]{exam}
\usepackage{graphicx} 
\usepackage{geometry}
\usepackage{listings}   
\usepackage[inline]{enumitem}
\usepackage{tikz}
\usepackage[most]{tcolorbox}
\usepackage{draftwatermark} 
\DraftwatermarkOptions{%
 text=Confidential,
 scale=1.2,
 color={[gray]{0.8}},
 angle=55,
 fontsize=5cm
}

@callegar
Copy link
Owner

callegar commented Apr 7, 2021

Still cannot reproduce with

\documentclass[12pt]{exam}
\usepackage{graphicx}
\usepackage{geometry}
\usepackage{listings}
\usepackage[inline]{enumitem}
\usepackage{tikz}
\usepackage[most]{tcolorbox}
\usepackage{draftwatermark}
\DraftwatermarkOptions{%
  text=Confidential, scale=1.2, color={[gray]{0.8}}, angle=55, fontsize=5cm }
\begin{document}
test
\begin{figure}[!ht]
prova
\end{figure}
\end{document}

the result does not change for me if I comment out (or not) the \begin{figure} \end{figure}.

@nanabaahgyan
Copy link
Author

nanabaahgyan commented Apr 8, 2021

testWTMRK.zip

Hi @callegar,
You are right that the environment does not produce the error I got. At the moment I'm unable to tell exactly what causes it as it keeps changing due to arbitrary actions I take within the document.

But I have attached a zip of the files that produce the error I describe.
Do run the TextWTMRK.tex file from the folder and particularly consider the output on page 8.

Don't hesitate to reach out to me if you need any clarification.

@callegar
Copy link
Owner

callegar commented Apr 8, 2021

TestWTRMRK.pdf

This is what I get (obviously there are no images since I do not have the graphic files). Can you tell me if there is the issue that you are mentioning?

@nanabaahgyan
Copy link
Author

nanabaahgyan commented Apr 8, 2021

TestWTRMRK.pdf

Please compare with my output attached. The issue is the output on page 8 of the attached document.

@callegar
Copy link
Owner

callegar commented Apr 8, 2021

OK! this is interesting. We have evident differences in the environment and the way in which the default fonts operate and scale. So these are to be investigated. Can you please:

  • Try to see if it is possible to distill a smaller test case (for instance producing only two pages one with the watermark as you expect it and one without), that can be compiled without graphic files (you can put anything you want inside a figure environment and it should make no difference), with the smallest possible set of dependencies on other packages (try to remove them one by one, conserving the issue - for instance ulem should not be relevant to it). This is going to be quite useful also in the future as a regression test.
  • Let me know all you can about your environment. Are you using texlive? which version? are you on Win, Linux or Mac? Are you using LaTeX, pdflatex, xelatex, lualatex? At what version? What version of draftwatermark are you using?

@nanabaahgyan
Copy link
Author

The following is minimal version (using fewer packages to produce the same effect). Please see attached.
TestWTRMRK.pdf

\documentclass[12pt]{exam}
\usepackage{longtable,tabu}
\usepackage{listings}   
\lstset{language=C++,
        basicstyle=\ttfamily, 
        breaklines=true,
        showstringspaces=false 
}
\usepackage{lipsum}
\usepackage{draftwatermark} 
\DraftwatermarkOptions{%
 text=Confidential,
 scale=1.2,
 color={[gray]{0.8}},
 angle=55,
 fontsize=5cm
}
`
Below is a description of my environment:
XeTeX, Version 3.141592653-2.6-0.999993 (TeX Live 2021)
Linux (KDE Neon)
draftwatermark version 57099 (3.0)

@nanabaahgyan
Copy link
Author

nanabaahgyan commented Apr 8, 2021

I just realised that what actually causes the minimal version to fail is the basicstyle=\ttfamily setting for the listings package. Once that is disabled draftwatermark works as expected.

@callegar
Copy link
Owner

That is interesting.
Now that you have found the incompatibility with listings, I wonder if you could help me with a really minimal testcase, with no dependencies on external files where I might be able to reproduce the issue, to check if such incompatibility can be removed.
In case, thanks in advance.

@callegar
Copy link
Owner

This is not enough to reproduce the issue for me (even on xelatex):

\documentclass[12pt]{exam}
\usepackage{listings}
\lstset{language=C++,
        basicstyle=\ttfamily, 
        breaklines=true,
        showstringspaces=false 
}
\usepackage{lipsum}
\usepackage{draftwatermark} 
\DraftwatermarkOptions{%
 text=Confidential,
 scale=1.2,
 color={[gray]{0.8}},
 angle=55,
 fontsize=5cm
}

\begin{document}
prova\clearpage
\begin{figure}[ht]
  \centering
  \fbox{\parbox{10cm}{\hspace*{10cm}\\[10cm]}}
\end{figure}
\end{document}

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

No branches or pull requests

2 participants