problem with a variable in pdfinfo, probably something obvious

Heiko Oberdiek heiko.oberdiek at googlemail.com
Wed Jun 17 20:32:10 CEST 2020


Hello,

On 2020-06-17 16:05, Mike Marchywka wrote:
> X-bib-pages                     :  covid19.lastpage

> \newcommand{\mjmaddbib}[2]{\hypersetup{ pdfinfo={ x-bib-#1 = {#2}}}\mjmsummabib{#1}{#2}}

> \mjmaddbib{pages}{ \input{\mjmbasename.last_page}}

> %   PAGES =         \{6\},
>    PAGES =         \{ \input{\mjmbasename.last_page} \},

This is a job for package `catchfile`
(https://www.ctan.org/pkg/catchfile).
It provides commands to read the contents of a file
into a macro. Example:

\usepackage{catchfile}
\CatchFileEdef\mjmpages{\mjmbasename.last_page}{\endlinechar=-1\relax}
\mjmaddbib{pages}{\mjmpages}

(The purpose of setting \endlinechar to -1 is to remove unnecessary
spaces at the end.)

Yours sincerely
   Heiko


More information about the texhax mailing list.