Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When I use beamer with \includeonlyframes{someframe}, the resulting PDF has the same pdftitle as the overall document. Is there any way to set the pdftitle to the title of the someframe, the only frame I am including?

\documentclass{beamer}
\includeonlyframes{frametwo}
\title{Document title}
\begin{document}%
\begin{frame}[label=frameone]{Frame one}
Spam
\end{frame}
\begin{frame}[label=frametwo]{Frame two}
Eggs
\end{frame}
\end{document}

Running pdflatex mini results in a PDF with title Document title. Is there any way to get the title of the only frame that is compiled?

share|improve this question

1 Answer 1

You can set the pdftitle yourself using \hypersetup{pdftitle=<title>} after you disable the use of it by beamer using the usepdftitle=false option.

\documentclass[usepdftitle=false]{beamer}
\includeonlyframes{frametwo}
\hypersetup{pdftitle=frametwo}
\title{Document title}
\begin{document}%
\begin{frame}[label=frameone]{Frame one}
Spam
\end{frame}
\begin{frame}[label=frametwo]{Frame two}
Eggs
\end{frame}
\end{document}

If you need this often and/or like to avoid having the name written twice you could redefine \includeonlyframes to do this automatically:

\documentclass[usepdftitle=false]{beamer}

\makeatletter
\renewcommand\includeonlyframes[1]{%
    \hypersetup{pdftitle={#1}}%
    \def\beamer@framerestriction{#1,}%
}
\makeatother

However, I didn't found a way to switch usepdftitle off automatically if \includeonlyframes is used. With it off you won't get any title for all frames.

share|improve this answer
    
It would be nice to still have the pdftitle if I don't use \includeonlyframes. In my real use case I have a little shell-function calling pdflatex with pdflatex -halt-on-error -jobname="frame_$1" "\def\onlyframe{$1}\input{presentation}" and in my LaTeX-source conditionally call includeonlyframes if and only if \onlyframe is defined. So then I still need to figure out is if/how to pass usepdftitle=false as a late option to beamer if \onlyframe is defined. I'll look at it a bit more, maybe I can find it out. –  gerrit Dec 14 '11 at 15:00
1  
You can use \PassOptionsToClass{usepdftitle=false}{beamer}. –  Martin Scharrer Dec 14 '11 at 15:49
    
Does this hack work if you pass more than one frame? –  PatrickT Dec 8 at 16:52
    
With more than one frame, might the following work? \makeatletter \renewcommand{\includeonlyframes}[2]{% \includeonlyframes[{#1}] \hypersetup{pdftitle={#2}}% \def\beamer@framerestriction{#1,}% } \makeatother \includeonlyframes{theframe1,theframe2}{thepdftitle} –  PatrickT Dec 8 at 17:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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