beamer add tag
12 years ago samcarter (imported from SE)

How to number frames with an increasing number of digits of pi? Illustrative, I want the frame numbers to be like

  • 3 (on the first slide)

  • 3.1 (on the second slide)

  • 3.14 (on the third slide)

… and so on.

This is a question, which occupies me for quite some time; actually since a talk I gave on March 14th (also known as pi-day 😃.

My present workaround is, to insert the frame numbers by hand – which is of course quite annoying when changing the order of slides.

EDIT:

Based on Reds great answer I compiled an unpretentious solution. It abstains new counters in favour of the current page number.

Top Answer
12 years ago egreg (imported from SE)

Here’s a way with LaTeX3 macros:

enter image description here


A different implementation using a property list; here 250 digits are available, much more than a presentation should need.

Answer #2
12 years ago erik (imported from SE)

This can also be done by returning \pgfmathresult of pi with the precision determined by the frame number. I kinda like that \pgfmathprintnumber rounds the output, so the fourth frame will be 3.142, the fifth will be 3.1416, the sixth 3.14159, and so on.

Answer #3
12 years ago Marco (imported from SE)

Here I present a ConTeXt solution which admittedly cheats a little and resorts to Perl, instead of using Lua to calculate Pi. The idea can easily be ported to LaTeX as well.

First the TeX macro \PrintPi is created, which generates one more digit with every consecutive call. It only keeps track of the page number and calls Perl. This macro is then placed in the header of every page.

The performance should be sufficient for presentations with less than 400 slides.

Page 69:

screenshot

Answer #4
12 years ago Steven B. Segletes (imported from SE)

Here’s an approach using stringstrings package.

Answer #5
12 years ago Dror (imported from SE)

Here is a solution using lua. With this solution you don’t have to bother about which slide is it, or whether you have given enough digits at the beginning. Obviously, it can be easily integrated into one of the themes of beamer, so you can typeset it in a fancy way as well.

Has to be processed using lualatex.

Answer #6
12 years ago user36411 (imported from SE)

A slight modification to your code using the xstring package can do the trick. You have to enter Pi as a string, though:

Answer #7
12 years ago David Carlisle (imported from SE)

I tried to make the total be pi or \pi as well but beamer didn’t want to play, this does the digit counting though.

Answer #8
12 years ago kiss my armpit (imported from SE)

Without PSTricks. Only up to 19 slides!

enter image description here

Answer #9
12 years ago Red (imported from SE)

EDIT

I did not success in using an algorithm to calculate the pi digits but I can get them by the web using the \write18 command of LaTeX (require --shell-enabled) and the shell command wget and sed. All you need to do is substitute the row

in the code below with:


This is the correct modification to @user36411 answer. Just create a file pi.txt with the number of pi digits you need.

6 years
samcarter — Sunday, 15th Dec 2019 16:05

Missing answers have been added

9 days
samcarter — Friday, 6th Dec 2019 12:01

Answers to be added once https://topanswers.xyz/transcript?room=347&id=7263#c7263 is implemented

an hour
Caleb — Friday, 6th Dec 2019 10:57

That’s what this is for.

13 minutes
samcarter replying to Caleb — Friday, 6th Dec 2019 10:44

Good thing we have a private beta to test such things before messing up in public 😃

Caleb replying to samcarter — Friday, 6th Dec 2019 10:43

That’s okay I did the same, leading to this feature request for the tools to fix such mistakes.

samcarter replying to Caleb — Friday, 6th Dec 2019 10:40

No, I messed up the import. Sorry!

25 minutes
Caleb — Friday, 6th Dec 2019 10:15

Did you intentionally not import the answer posts for this?

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.