# Put additional information on the final PDF, like arxiv.org does

For a wiki site dedicated to collaborative editing of lecture notes in full LaTeX documents, I’d like to add a box with meta-information onto the first page of the resulting PDF file – this is inspired by what arXiv.org does.

I’d prefer to create the box using LaTeX, but avoid having to mechanically inject it into the existing LaTeX code.

What would be the most robust and clean way of doing so?

-
Ah, now that I read the second paragraph of your question, I am not sure if my answer is valid anymore. Please let me know, so that I can leave it or delete it. –  Gonzalo Medina Aug 5 '12 at 20:35
Perhaps this one is useful. –  kiss my armpit Aug 5 '12 at 20:45
Yes, it is related, but my emphasis is to preserve the original PDF as much as possible (or rather, completely), e.g. page sizes, metadata, links etc. –  Joachim Breitner Aug 5 '12 at 21:19
Also related, if one searches for a TeX solution, is this one. –  Joachim Breitner Aug 10 '12 at 18:41

One option is to use the background package; using its some option, no material is placed in the pages; the material will only be displayed in those pages in which you invoke \BgThispage (somewhere in the first page, in your case). The material attributes (color, position, opacity, etc.) can be highly customized; a little example:

\documentclass{article}
\usepackage[some]{background}
\usepackage{lipsum}

\SetBgColor{gray}
\SetBgOpacity{1}
\SetBgScale{2}
\SetBgAngle{90}
\SetBgPosition{current page.west}
\SetBgVshift{-1.8cm}
\SetBgHshift{-1cm}

\title{The Title}
\author{The Author}

\begin{document}

\maketitle
\BgThispage
\begin{abstract}
\lipsum[4]
\end{abstract}
\lipsum[1-13]

\end{document}


An image of the first two pages:

-
Certainly looks good, but this requires changes to the TeX source; I’d like to avoid that as I fear that it might not work reliable. –  Joachim Breitner Aug 5 '12 at 21:17

Exactly the same as Gonzalo's answer, but you don't modify the original tex file, you just \input it into one that adds the background. (I don't know if this would be a feasible solution for you, if you're only concerned with not having to manually edit the original document?)

So, q65980-maindoc.tex knows nothing about the background:

\documentclass{article}
\usepackage{lipsum}

\title{The Title}
\author{The Author}

\begin{document}

\maketitle

\begin{abstract}
\lipsum[4]
\end{abstract}
\lipsum[1-13]

\end{document}


And you have a new file called q65980-with-background.tex say with the following:

\RequirePackage[some]{background}

\SetBgColor{gray}
\SetBgOpacity{1}
\SetBgScale{2}
\SetBgAngle{90}
\SetBgPosition{current page.west}
\SetBgVshift{-1.8cm}
\SetBgHshift{-1cm}

\AtBeginDocument{\BgThispage}

\input{q65980-maindoc}


This seems to work, at least on Gonzalo's example, but I can't promise how robust it will be. Try it on your real examples and see?

The only way of preserving annotations and things in the pdf like hyperlinks will be to reprocess the source of the original document in some way similar to this (rather than just including the compiled PDF), because PDF annotations cannot readily be copied from one PDF into another.

-
Interesting approach, I’ll will try it out after my holidays and report back. –  Joachim Breitner Aug 13 '12 at 13:59