I have a series of pdf files that I'm trying to combine. That much I can do without any problem.
What I also need to do is add a small amount of text to the top 'outside' corner of each page, essentially identifying the original document that each page came from. I've managed so far to put the text in the upper left corner of each page - there are other questions on Stack Exchange which address that.
However, none of them deal with putting the text in a different position on odd and even pages - i.e. the upper left corner of even pages, and the upper right corner of odd pages. How can this be achieved?
\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{pdfpages}
\usepackage{tikz}
\renewcommand{\contentsname}{My combined file}
\setlength\parindent{0pt}
\begin{document}
\includepdf[pages=-]{cover.pdf}
\includepdf[pages=2-4,pagecommand={\begin{tikzpicture}[remember picture, overlay]
\node[right] at (-2, 2.5) {\LARGE{doc1}};
\end{tikzpicture}}]{doc1.pdf}
% More files included here
\end{document}
For extra credit, is there a way to (automatically) use the filename of the included document as the inserted text?