TeX - LaTeX Asked by Aram Papazian on December 7, 2020
I’m trying to set a count in latex on the total number of pages:
newcountmypagecount
mypagecount=insertpresentationendpage
But whenver I do this, it auto "prints" the total number of pages instead of putting the number as a count. Is there a way to set it as a count?
Here is more precisely what I’m trying to do:
newcountmypagenum
newcountmypagecount
newdimenbarwidth
mypagenum=insertpagenumber
mypagecount=insertpresentationendpage
barwidth=paperwidth
multiplybarwidth by mypagenum
dividebarwidth by mypagecount
I tried with counters, but that threw errors as well:
newcounter{mypagecount}
setcounter{mypagecount}{insertpresentationendpage}
Any ideas how I can do the division at the end if I can’t use these numbers and/or how to actually use these numbers?
The following does essentially the same as the current version of insertpresentationendpage
of beamer
, but in a way such that your counter is set instead of the result printed. I also included a proof of concept progress bar output.
documentclass[]{beamer}
newlengthbarwidth
newlengthtmpbarwidth
newcountmypagecount
makeatletter
newcommand*progressbar
{%
ifnummypagecount=0
ifxbeamer@startpageofappendix@empty
mypagecount=beamer@endpageofdocumentrelax
else
mypagecount=beamer@startpageofappendixrelax
advancemypagecountm@ne
fi
ifnummypagecount=0
globalmypagecount=1
else
globalmypagecount=mypagecount
fi
fi
begingroup
tmpbarwidthinsertpagenumberbarwidth
dividetmpbarwidthmypagecount
rule{tmpbarwidth}{5pt}%
advancebarwidth-tmpbarwidth
textcolor{gray}{rule{barwidth}{5pt}}%
endgroup
}
makeatother
setlengthbarwidth{5cm}
begin{document}
begin{frame}
progressbar
end{frame}
begin{frame}
progressbar
end{frame}
begin{frame}
progressbar
end{frame}
begin{frame}
progressbar
end{frame}
end{document}
Correct answer by Skillmon on December 7, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP