liantze / AltaCV

Yet another alternative curriculum vitae/résumé class with LaTeX
Other
1.26k stars 329 forks source link

Redundant inclusion of hyperref package #78

Closed logological closed 3 years ago

logological commented 3 years ago

Line 86 of altacv.cls attempts to load the hyperref package if the withhyper option is set, but hyperref is already loaded unconditionally, because the pdfx package (which is loaded on line 40) already includes hyperref.

modelmat commented 2 years ago

I had this issue and it took a while to figure out how to resolve it, so leaving this here for anyone else which has the same issue:

If one wishes to use \hypersetup to set pdfauthor/pdftitle (etc) fields:

\hypersetup{%
  pdfauthor={Foo},
  pdftitle={Bar}
}

The file produces the following errors:

Package hyperref Warning: Option `pdfauthor' has already been used, setting the option has no effect on input line 17.

The altacv.cls file loads pdfx:

https://github.com/liantze/AltaCV/blob/81a2b47d160976e4efccd93402eaf36c1985537a/altacv.cls#L42

Which has the following limitation:

Furthermore, options to set metadata components (such as pdfauthor, pdftitle, pdfsubject, pdfkeywords, etc.) are disabled, since pdfx has already taken care of this information. — pdfx manual, Section 3.1

To provide this data, instead use a file named \jobname.xmpdata:

The pdfx package builds the XMP metadata from information supplied via a special data file called \jobname.xmpdata. Here, \jobname is usually the basename of the document’s main .tex file. For example, if your document source is in the file main.tex, then the metadata must be in a file called main.xmpdata. None of the individual metadata fields are mandatory, but for most documents, it makes sense to specify at least the title and the author. — pdfx manual, Section 2.2

You may find it useful to use a \begin{filecontents*} environment instead:

\RequirePackage{silence}
\WarningFilter{latex}{Writing or overwriting file}

\begin{filecontents*}[overwrite]{\jobname.xmpdata}
  \Title{Baking through the ages}
  \Author{A. Baker\sep C. Kneader}
  \Language{en-GB}
  \Keywords{cookies\sep muffins\sep cakes}
  \Publisher{Baking International}
\end{filecontents*}
\documentclass[10pt,a4paper,ragged2e,withhyper]{altacv}