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

doclicense and pdfmanagement #93

Open
u-fischer opened this issue Oct 4, 2022 · 2 comments
Open

doclicense and pdfmanagement #93

u-fischer opened this issue Oct 4, 2022 · 2 comments

Comments

@u-fischer
Copy link

The newest pdfmanagement-testphase version no longer contains a patch for hyperxmp. Instead it uses its own code to add xmp-metadata. The loading of hyperxmp is suppressed as the package is incompatible.

doclicense should therefore not assume that hyperref is loaded through hyperxmp but load it itself.

\DocumentMetadata{%
  testphase=phase-II,
  uncompress,
  lang=en-US,
  pdfstandard=a-2u}

\documentclass{article}

%\IfDocumentMetadataTF{\usepackage{hyperref}}{} %load hyperref is pdfmanagement is used

\usepackage[type={CC},modifier={by-nc-nd},version={4.0},lang={english}]{doclicense}

\begin{document}
  Hello
\end{document}
@ypid
Copy link
Owner

ypid commented Oct 25, 2022

doclicense should therefore not assume that hyperref is loaded through hyperxmp but load it itself.

Does it really assume that? When I look at the code

\AtEndPreamble{%
\@ifpackageloaded{ccicons}{}{\RequirePackage{ccicons}}
% For \doclicenseIcon
\@ifpackageloaded{graphicx}{}{\RequirePackage{graphicx}}
% For \doclicenseImage
\@ifpackageloaded{hyperref}{}{\RequirePackage{hyperref}}
\@ifpackageloaded{csquotes}{%
% csquotes has already been loaded so we are fine.
}{%
\ifcsdef{enquote}{%
% \enquote is defined but not by csquotes.
\@ifpackageloaded{biblatex}{%
\PackageError{doclicense}{The enquote macro is defined by biblatex}
{This package assumes that the enquote macro is defined by the
csquotes package. Please load csquotes before you load biblatex so
that biblatex does not define enquote instead.}%
}{%
\PackageError{doclicense}{The enquote macro is defined by an unknown package}
{This package assumes that the enquote macro is defined by the
csquotes package. Please check why enquote is defined without
csquotes being loaded. Maybe try loading csquotes early so that it
can define the enquote macro instead.}%
}
}{%
\RequirePackage{csquotes}
}
}
\@ifpackageloaded{hyperxmp}{%
% The following options are only defined when the hyperxmp package was loaded.
\hypersetup{%
pdfcopyright = {\doclicenseLongTextForHyperref},
pdflicenseurl = {\doclicenseURL},
}
}{}
}
both packages are loaded independently by doclicense if they were not loaded at the end of the preamble.

Can you propose a patch/pull request that fixes it for you? I currently don’t have the latest TeX Live installed so I cannot test your example.

@u-fischer
Copy link
Author

sorry I got a bit lost in your various if-clauses and so tried to fix the problem it the wrong way. I will update the pdfmanagement to remove the error there.

But it remains the problem that hyperxmp is not loaded and so your hypersetup is lost. I suggest that you replace

  \@ifpackageloaded{hyperxmp}{%
    % The following options are only defined when the hyperxmp package was loaded.
    \hypersetup{%
      pdfcopyright  = {\doclicenseLongTextForHyperref},
      pdflicenseurl = {\doclicenseURL},
    }
  }{}

by

\IfDocumentMetadataTF
 {
    \hypersetup{%
      pdfcopyright  = {\doclicenseLongTextForHyperref},
      pdflicenseurl = {\doclicenseURL},
    }
 }
 {
   \@ifpackageloaded{hyperxmp}{%
    \hypersetup{%
      pdfcopyright  = {\doclicenseLongTextForHyperref},
      pdflicenseurl = {\doclicenseURL},
    }}{}
 }  

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