# Automating the process of passing overlay numbers to \hypertarget in beamer, part 3

In this thread @Mike wrote some very elegant code that allows me to automate the the process of passing overlay numbers to `\hypertarget`. It works perfectly. However, I would also like to have the option of printing one slide per frame, and obtain the same functionality as when there are multiple slides per frame. (For presentations, I use beamer pauses, etc., but to print a hard copy of the slides, nobody wants a deck of 100s of slides, hence the need for one slide per frame) In the code below, if the counter `DoPauses` is set to one, the output generated by @Mike's code is replicated. If it is set to zero, the output is one slide per page, as required. The `beamergotobutton`s function as expected, jumping forward to the intended pages, but the `beamerreturnbuttons` (except for the first one) do not. For example clicking on the button on frame 2 marked #4 takes one, correctly, to Frame #4, but then clicking on the return button, which should take one back to Frame #2 in fact goes back to Frame #1.

• which "code below"? – user36296 Sep 27 '17 at 8:27
• It sounds like you don't know the `handout` option. Writing `\documentclass[handout]{beamer}` gives you one slide per frame. You don't need to set a counter for this. Also, your viewer may fool you there. Most viewers have a setting Continuous. if this is set, they show the bottom part of page n and the top part of page n+1. The link `Frame #1` on Frame 4 goes to the bottom of the button `Frame #4` on frame 1. With Continuous set you'll see Frame 2 in the lower half of the viewer window. If this isn't it, please provide an MWE. – Mike Sep 27 '17 at 10:16
• AHHHH! Thanks @Mike. I so wish I'd known about the handout option years ago. No need for an MWE since this solves my problem. It would be nice to be to write `\documentclass[\beamerHandout]{beamer}` and then pass the value of `beamerHandout` from the command line. Is this possible somehow? I don't want to use `\PassOptionsToClass` for backward compatibility. Obviously this would be easy if I could put a `\usepackage` before `\documentclass` but this appears to be impossible. Last resort, I could use `sed` in a macro but that's very clumsy. – Leo Simon Sep 27 '17 at 16:53
• You can use `\RequirePackage` before `\documentclass`. But why not `\PassOptionsToClass`? It's part of LaTeX since at least the year 2000. And the first release of `beamer` is (according to CTAN) from 2003. So there shouldn't be any problem, if you recompile the files anyway. – Mike Sep 28 '17 at 2:05
• For a number of reasons, I really want to keep the first line of the file to be `documentclass` and as far as I understand, I can't do this and use `\PassOptionsToClass`, since this command seems to require that I begin the file with a line beginning with `\input`. Maybe there's a way to pass the option through a package, using `\RequirePackage` but I can't figure out how to do this. Sorry to be incompetent. – Leo Simon Sep 28 '17 at 6:20

It sounds like you don't know the `handout` option. Writing `\documentclass[handout]{beamer}` gives you one slide per frame. You don't need to set any counter for this.

If you want handouts (PDF with one slide per frame) for existing presentations, you don't need to change the files. Instead you can pass the option to `beamer` from a commandline like this

``````pdflatex "\PassOptionsToClass{handout}{beamer}\input{beamer-file.tex}‌​"
``````

Don't forget to run this twice to get links, ToC etc. right.