I'm frequently creating presentations with beamer and need both the handout and the presentation itself. To avoid editing the file when I need to compile the other, I use \ifdefined\ishandout ... at the beginning of the presentation and have a separate file for the handout that contains nothing but
\def\ishandout{1}
\input{topic.tex}
Since the handout file is always named following the schema topic_handout.tex I'm looking for a way to strip the inner _handout so I can use the same handout file for all presentations without changing the content. I found \jobname which gives me topic_handout, so I just need to strip the constant string _handout and add .tex to the argument in \input. Since this happens before the document class is declared, I cannot use any packages. Any help is welcome.
\documentclassby using\RequirePackageinstead of\usepackage. But you should be careful anyway. Also you can use\PassOptionsToClass{handout}{beamer}and\mode<handout>{...}instead of\def\ishandout{1}and\ifdefined\ishandout ..., respectively. Note that\jobnamereturns the file name as characters (catcode 12, "other") and not as letters (catcode 11), which must be taken into account for string comparison and manipulation. – Martin Scharrer Jun 28 '11 at 13:49