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

attachfile2: Setting icon colors does not work as expected #2

Open
osander1 opened this issue Dec 12, 2018 · 3 comments
Open

attachfile2: Setting icon colors does not work as expected #2

osander1 opened this issue Dec 12, 2018 · 3 comments

Comments

@osander1
Copy link

Consider the following test file:

\documentclass{article}
\usepackage[appearance=true]{attachfile2}

\begin{document}

\attachfile[color={0 0 1}]{some-document.tex}
\attachfile[color={1 0 0}]{some-document.tex}

\end{document}

This produces two blue pin icons, even though one of them should be red. It works correctly if I set appearance to false. My attachfile2 version is v2.8 from Debian testing.

@u-fischer
Copy link
Contributor

attachfile2 reuses the appearance definitions. I'm not sure if there is a good way around this - it would blow up the pdf if every pin would have its own "appearance object". You can force a new object like this:

\documentclass{article}
\usepackage{xcolor}
\usepackage[appearance=true]{attachfile2}

\begin{document}

\attachfile[color={red}]{blub.tex}

\makeatletter \let\atfi@appobj@PushPin\undefined
\attachfile[color={blue}]{blub.tex}

\end{document}

image

Or you could define a number of variants like this:

\documentclass{article}
\usepackage{xcolor}
\usepackage[appearance=true]{attachfile2}
\makeatletter
\define@key{AtFi}{PushPinB}[]{%
  \def\atfi@icon{/Name/PushPin}%
  \def\atfi@icon@icon{PushPinB}%
}
\define@key{AtFi}{PushPinC}[]{%
  \def\atfi@icon{/Name/PushPin}%
  \def\atfi@icon@icon{PushPinC}%
}

\let\atfi@acroPushPinB\atfi@acroPushPin
\let\atfi@acroPushPinC\atfi@acroPushPin

\begin{document}

\attachfile[color={red}]{blub.tex}

\attachfile[color=blue,PushPinB]{blub.tex}

\attachfile[color=yellow,PushPinC]{blub.tex}

\attachfile[]{blub.tex}

\attachfile[PushPinB]{blub.tex}
\end{document}

image

@u-fischer
Copy link
Contributor

Thinking about it, one could perhaps code the color in the internal function name.

@osander1
Copy link
Author

Thanks for the reply. The workarounds are fine with me if you think that an actual fix would be too difficult / expensive. It would be great, however, if the documentation would mention that icon colors and appearance streams together don't work as expected.

@davidcarlisle davidcarlisle transferred this issue from ho-tex/oberdiek Nov 23, 2019
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

2 participants