2

I am writing a tool which will (as one of its features) generate LaTeX documents from some input format. I would like to put an unobtrusive piece of information about the tool in the generated file (with an option to disable it, even without editing the file, of course). What technique would you suggest to include such information? A few things that come to my mind are:

  • Place a \footnotetext, with a redefined counter (so that there is no counter) right before \end{document}.
  • Place something like \vfill\parbox{0.5\linewidth}{...} in the same place.
  • Use a special pagestyle (with a suitable footer, for instance) and put \thispagestyle{...} in the same place.

Can you think of any caveats here? What might be the best solution and why?

Also, can you think of any good tag, assuming this question is not going to be deleted at all?

  • 1
    I'm not sure what you mean by "an option to disable it, even without editing the file". You want to be able to enable/disable this from within the PDF itself? In any case, this idea is similar to a colophon. Is your question about how to create this with LaTeX or what should it look like or contain? – Paul Gessler Mar 28 '15 at 0:19
  • I meant an option to disable it in the tool that generates the LaTeX file, so that hand editing of the resulting .tex file is not necessary. As for the second part: I'm more concerned about what it should look like, though some ways of coding it might contain some traps (like creating the whole blank page with only the "colophon" at the bottom in certain circumstances). – mbork Mar 28 '15 at 0:31
  • 3
    Well... what it should look like is off-topic. If you know what it should look like, how to do that would be on-topic. But it might depend on knowing more about the .tex files produced. If you're producing PDF, you can always put this in the metadata. That's where I look for this information when I want to know what programme produced a document. I'd never look for a footnote for that. – cfr Mar 28 '15 at 3:27
  • @PaulGessler, a colophon package (with some automatic content) would be nice to have. E.g. "This book was typeset in TeX, using such and such fonts. The section headings were in such other font." – alfC Mar 28 '15 at 4:41
2

Assuming that the end product is a pdf file I recommend using hyperref and setting its pdfcreator option. You just need to add

\usepackage{hyperref}
\hypersetup{pdfcreator=Some external code}

to your preamble. This sets the Content Creator attribute in the resulting pdf file. This is very unobtrusive because appears only in the PDF file and it is NOT displayed. If you want to display the creator as well the I recommend using a footnote on the first or last page, just as you suggest.

To disable this, the easiest way to to comment out the \hypersetup line. You could automate this by by passing a variable into latex at compile time but this seems a little OTT unless you are going to do this with a script.

  • 1
    You don't need hyperref... ;). – cfr Mar 28 '15 at 4:39
  • @cfr Thanks I didn't know this. – Andrew Mar 29 '15 at 8:45
2

hyperref is not necessary. You can specify the metadata directly provided you are using pdfTeX.

For example:

\documentclass{article}

\begin{document}
\pdfinfo{%
    /Title              (Great Title)
    /Subject            (interesting subject)
    /Keywords           (word 1, word 2, word 3)
    /Author             (A. N. Author)
    /Producer           (Magic Product)
    /Creator            (Insta-Create)}
Some text.
\end{document}

Here is a snippet from the PDF properties, as displayed by Okular:

PDF properties

  • I wonder why this ignores my system locale? – cfr Mar 28 '15 at 4:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.