stamp: Use specified output file name

The option existed, but apparently I forgot to implement it earlier.
Report from João Gandara.
Feed back global ID into the LaTeX document when stamping.