diff options
author | Karl Berry <karl@freefriends.org> | 2018-01-30 21:04:41 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-01-30 21:04:41 +0000 |
commit | 1b674ef86fe17b1011f19a929dfd82253eb90995 (patch) | |
tree | 6772c47029840206eb69323587b58e309bf5d161 /Master/texmf-dist/tex/latex/hackthefootline | |
parent | 26b507ff1e2b1d8acaaf4bb212f149f39c436821 (diff) |
hackthefootline (30jan18)
git-svn-id: svn://tug.org/texlive/trunk@46494 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/hackthefootline')
-rw-r--r-- | Master/texmf-dist/tex/latex/hackthefootline/hackthefootline.sty | 181 |
1 files changed, 116 insertions, 65 deletions
diff --git a/Master/texmf-dist/tex/latex/hackthefootline/hackthefootline.sty b/Master/texmf-dist/tex/latex/hackthefootline/hackthefootline.sty index 0882f0fbf07..14d83c28148 100644 --- a/Master/texmf-dist/tex/latex/hackthefootline/hackthefootline.sty +++ b/Master/texmf-dist/tex/latex/hackthefootline/hackthefootline.sty @@ -1,5 +1,5 @@ -%% This is file 'hackthefootline.sty', Version 2018-01-16 -%% Copyright 2017 Sebastian Friedl <sfr682k@t-online.de> +%% This is file 'hackthefootline.sty', Version 2018-01-29 +%% Copyright 2017-18 Sebastian Friedl <sfr682k@t-online.de> %% %% This work may be distributed and/or modified under the conditions of the LaTeX Project %% Public License, either version 1.3c of this license or (at your option) any later version. @@ -32,9 +32,10 @@ %% ------------------------------------------------------------------------------------------- -\ProvidesPackage{hackthefootline}[2018/01/16 hackthefootline: Arbitrary footline selection and configuration for LaTeX beamer's standard themes] +\ProvidesPackage{hackthefootline}[2018/01/29 hackthefootline: Arbitrary footline selection and configuration for LaTeX beamer's standard themes] \mode<presentation> +\RequirePackage{ifthen} \RequirePackage{pgfkeys} \newcommand{\htfprintmessage}{% @@ -42,9 +43,9 @@ \typeout{========================================} \typeout{THE FOOTLINE HAS BEEN TAKEN OVER} \typeout{by the hackthefootline package} - \typeout{Version 2018/01/16} + \typeout{Version 2018/01/29} \typeout{} - \typeout{(c) 2017 Sebastian Friedl} + \typeout{(c) 2017-18 Sebastian Friedl} \typeout{Licensed under LPPL 1.3c or later} \typeout{========================================} \typeout{}} @@ -53,21 +54,14 @@ % PACKAGE OPTIONS AND VARIABLES -- INCLUDES AUXILIARY STUFF ------------------------------------------------------------------------------------- -% Check whether a column package option has been specified -\newif\ifbeamer@htfinitcolsetup -\beamer@htfinitcolsetupfalse - \DeclareOptionBeamer{onecol}{% - \beamer@htfinitcolsetuptrue% \htfconfig{title=short, authinst=both, date=none, framenrs=fraction, atsep=colon}% \AtBeginDocument{\htfconfig{cols=one}}\htfprintmessage} \DeclareOptionBeamer{twocols}{% - \beamer@htfinitcolsetuptrue% - \htfconfig{title=short, authinst=onlyauthor, date=none, framenrs=none}% + \htfconfig{title=short, authinst=onlyauthor, date=none, framenrs=none, atsep=colon}% \AtBeginDocument{\htfconfig{cols=two}}\htfprintmessage} \DeclareOptionBeamer{threecols}{% - \beamer@htfinitcolsetuptrue% - \htfconfig{title=short, authinst=instpths, date=short, framenrs=fraction}% + \htfconfig{title=short, authinst=instpths, date=short, framenrs=fraction, atsep=colon}% \AtBeginDocument{\htfconfig{cols=three}}\htfprintmessage} \newif\ifbeamer@htfcountappendixframes @@ -93,39 +87,9 @@ \newif\ifbeamer@htfnotitle \newif\ifbeamer@htfshowframenrs -% Auxiliary command creating a warning when using a footline without according package option -\newcommand{\htfcheckforinit}{% - \ifbeamer@htfinitcolsetup\else% - \PackageWarning{hackthefootline}{When using hacked footlines, please specify an according package option.} - \fi} - - - -% ACTIONS FOR NOT COUNTING APPENDIX FRAMES ------------------------------------------------------------------------------------------------------ - -\ifbeamer@htfcountappendixframes\else - % Required packages - \RequirePackage{appendixnumberbeamer} - \RequirePackage{etoolbox} - - % Removes frame numbers for appendix slides - \apptocmd{\appendix}{% - \htfconfig{framenrs=none} - }{}{} -\fi - - - -% REQUIREMENTS FOR SOME "FUNNY STUFF" ----------------------------------------------------------------------------------------------------------- - -\ifbeamer@htffunnystuff - % Frame numbering in %: requirements, package settings, variables, commands - \RequirePackage{calc} - \RequirePackage[addmissingzero,autolanguage,nosepfour]{numprint} - \npdefunit{percent}{\%}{1} - \newlength{\progress} - \newcommand{\updateprogress}{\setlength{\progress}{100pt*\ratio{\insertframenumber pt}{\inserttotalframenumber pt}}} -\fi +% Own replacement for \beamer@inappendix; required for compatibility reasons +\newif\ifbeamer@htfinsideappendix +\beamer@htfinsideappendixfalse @@ -153,11 +117,22 @@ % Frame Numbers \defbeamertemplate{htf-framenrs}{none}{} \defbeamertemplate{htf-framenrs}{counter}{\insertframenumber} -\defbeamertemplate{htf-framenrs}{fraction}{\insertframenumber~/~\inserttotalframenumber} +\defbeamertemplate{htf-framenrs}{fraction}{% + \ifbeamer@htfcountappendixframes{\insertframenumber~/~\inserttotalframenumber}% + \else% + \ifx\insertmainframenumber\@undefined{\insertframenumber~/~\inserttotalframenumber}% + \else% + % beamer v3.49 and later: detect whether appendix has been entered and use the required templates and use internal cmds + \ifbeamer@htfinsideappendix{\insertframenumberinappendix~/~\insertappendixframenumber}% + \else{\insertframenumber~/~\insertmainframenumber}% + \fi% + \fi% + \fi} \ifbeamer@htffunnystuff - \defbeamertemplate{htf-framenrs}{percent}{\updateprogress\nprounddigits{0}\lenprint[percent]{\progress}} + \defbeamertemplate{htf-framenrs}{percent}{\htfupdateprogress\nprounddigits{0}\lenprint[htfpercent]{\htfprogress}} \fi + % Author-Title-Seperator \defbeamertemplate{htf-atsep}{colon}{:~~~~} \defbeamertemplate{htf-atsep}{comma}{,~} @@ -167,13 +142,16 @@ % FOOTLINE DEFINITIONS -------------------------------------------------------------------------------------------------------------------------- +% Auxiliary length +\newlength{\htfframenrboxwidth}% + % No footline \defbeamertemplate*{footline}{htf-none}{} % One column \defbeamertemplate{footline}{htf-onecol}{% \begin{beamercolorbox}[wd=\paperwidth,ht=2.25ex,dp=1ex,leftskip=.3cm,rightskip=.3cm]{palette primary}% - \usebeamerfont{author in head/foot} + \usebeamerfont{author in head/foot}% \usebeamertemplate{htf-authinst}% % \beamer@htfinsertsepfalse @@ -190,15 +168,29 @@ \hfill \usebeamercolor{date in head/foot} \usebeamertemplate{htf-date} - % Dummy space for frame numbers - \ifbeamer@htfshowframenrs \hspace{5.75em} \fi + % + % Measure the largest required space when printing frame numbers + \newbox\htfpagenumbox% + \newbox\htfpercframenumbox% + \setbox\htfpagenumbox=\hbox{0\inserttotalframenumber~/~0\inserttotalframenumber}% + \setbox\htfpercframenumbox=\hbox{100\,\%}% + \ifthenelse{\lengthtest{\wd\htfpagenumbox > \wd\htfpercframenumbox}}% + {\setlength{\htfframenrboxwidth}{\wd\htfpagenumbox}}% + {\setlength{\htfframenrboxwidth}{\wd\htfpercframenumbox}}% + % + \ifbeamer@htfshowframenrs \hspace{\htfframenrboxwidth}\hspace{.2\htfframenrboxwidth}~\fi% \end{beamercolorbox}% \ifbeamer@htfshowframenrs \vspace{-3.25ex} \hfill% - \begin{beamercolorbox}[wd=6.25em,ht=2.25ex,dp=1ex,right,rightskip=.3cm]{palette primary} - \usebeamertemplate{htf-framenrs} - \end{beamercolorbox} + \addtolength{\htfframenrboxwidth}{.3cm}% + \addtolength{\htfframenrboxwidth}{2em}% + \addtolength{\htfframenrboxwidth}{.5\htfframenrboxwidth}% + \hspace{-1.3\htfframenrboxwidth}% + \begin{beamercolorbox}[wd=1.3\htfframenrboxwidth,ht=2.25ex,dp=1ex,right,rightskip=.3cm]{bg}% + % The color *has* to be set here; otherwise, the page number box will cover parts of the date + \usebeamercolor[fg]{date in head/foot}\usebeamertemplate{htf-framenrs} + \end{beamercolorbox}% \fi} % Two columns @@ -225,13 +217,26 @@ \end{beamercolorbox}% \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,right,rightskip=.3cm]{date in head/foot}% \usebeamerfont{date in head/foot}\usebeamertemplate{htf-date}% - % Dummy space for frame numbers - \ifbeamer@htfshowframenrs \hspace{5.75em} \fi + % + % Measure the largest required space when printing frame numbers + \newbox\htfpagenumbox% + \newbox\htfpercframenumbox% + \setbox\htfpagenumbox=\hbox{0\inserttotalframenumber~/~0\inserttotalframenumber}% + \setbox\htfpercframenumbox=\hbox{100\,\%}% + \ifthenelse{\lengthtest{\wd\htfpagenumbox > \wd\htfpercframenumbox}}% + {\setlength{\htfframenrboxwidth}{\wd\htfpagenumbox}}% + {\setlength{\htfframenrboxwidth}{\wd\htfpercframenumbox}}% + % + \ifbeamer@htfshowframenrs \hspace{\htfframenrboxwidth}\hspace{.2\htfframenrboxwidth}~\fi% \end{beamercolorbox}% \ifbeamer@htfshowframenrs% - \hspace{-6.25em}% - \begin{beamercolorbox}[wd=6.25em,ht=2.25ex,dp=1ex,right,rightskip=.3cm]{date in head/foot}% - \usebeamertemplate{htf-framenrs} + \addtolength{\htfframenrboxwidth}{.3cm}% + \addtolength{\htfframenrboxwidth}{2em}% + \addtolength{\htfframenrboxwidth}{.5\htfframenrboxwidth}% + \hspace{-1.3\htfframenrboxwidth}% + \begin{beamercolorbox}[wd=1.3\htfframenrboxwidth,ht=2.25ex,dp=1ex,right,rightskip=.3cm]{bg}% + % The color *has* to be set here; otherwise, the page number box will cover parts of the date + \usebeamercolor[fg]{date in head/foot}\usebeamertemplate{htf-framenrs} \end{beamercolorbox}% \fi}% \vskip0pt} @@ -242,12 +247,13 @@ \pgfkeys{/hackthefootline/cols/.cd, .is choice, .default=none, - one/.code={\setbeamertemplate{footline}[htf-onecol]}, - two/.code={\setbeamertemplate{footline}[htf-twocols]}, - three/.code={\setbeamertemplate{footline}[htf-threecols]}, + one/.code={\setbeamertemplate{footline}[htf-onecol]\beamer@calculateheadfoot}, + two/.code={\setbeamertemplate{footline}[htf-twocols]\beamer@calculateheadfoot}, + three/.code={\setbeamertemplate{footline}[htf-threecols]\beamer@calculateheadfoot}, none/.code={% \htfconfig{framenrs=none}% - \setbeamertemplate{footline}[htf-none]}, + \setbeamertemplate{footline}[htf-none]% + \beamer@calculateheadfoot}, } \pgfkeys{/hackthefootline/title/.cd, @@ -339,8 +345,53 @@ -% END OF FILE ----------------------------------------------------------------------------------------------------------------------------------- +% PROCESS OPTIONS ------------------------------------------------------------------------------------------------------------------------------- +% This *has* to be done here, otherwise mysterious things will happen ... +% and too many packages will be required ... \ProcessOptionsBeamer + + + +% ACTIONS FOR NOT COUNTING APPENDIX FRAMES ------------------------------------------------------------------------------------------------------ + +\ifbeamer@htfcountappendixframes\else + % Required packages + \ifx\insertmainframenumber\@undefined\RequirePackage{appendixnumberbeamer}\fi % only beamer v3.48 and earlier + \RequirePackage{etoolbox} + + % Removes frame numbers for appendix slides + \apptocmd{\appendix}{% + \htfconfig{framenrs=none} + \beamer@htfinsideappendixtrue + }{}{} +\fi + + + +% REQUIREMENTS FOR SOME "FUNNY STUFF" ----------------------------------------------------------------------------------------------------------- + +\ifbeamer@htffunnystuff + % Frame numbering in %: requirements, package settings, variables, commands + \RequirePackage{calc} + \RequirePackage[addmissingzero,autolanguage,nosepfour]{numprint} + \npdefunit{htfpercent}{\%}{1} + \newlength{\htfprogress} + \def\htfupdateprogress{% + \ifbeamer@htfcountappendixframes\setlength{\htfprogress}{100pt*\ratio{\insertframenumber pt}{\inserttotalframenumber pt}}% + \else% + \ifx\insertmainframenumber\@undefined\setlength{\htfprogress}{100pt*\ratio{\insertframenumber pt}{\inserttotalframenumber pt}}% + \else% + \ifbeamer@htfinsideappendix\setlength{\htfprogress}{100pt*\ratio{\insertframenumberinappendix pt}{\insertappendixframenumber pt}}% + \else\setlength{\htfprogress}{100pt*\ratio{\insertframenumber pt}{\insertmainframenumber pt}}% + \fi% + \fi% + \fi} +\fi + + + +% END OF FILE ----------------------------------------------------------------------------------------------------------------------------------- + \mode<all> \endinput
\ No newline at end of file |