How to place a figure representing progress percentage in a custom progress bar?












1















In a progress bar, I would like to place a percentage figure representing the amount of progress. The original code I obtained for the bar is from Progress bar for latex-beamer. The image below shows what I am looking to get but the 85% here is placed manually.



enter image description here



After trying to solve it by myself and looking on previous question I learnt that the command used to calculate percent progress is



newcommand{progressframepercent}{
{textnormal{pgfmathparse{insertframenumber*100/inserttotalframenumber}%
pgfmathprintnumber[fixed,precision=2]{pgfmathresult},%}}
}


However, the percent indicator is still vertically centered. To solve this, the box must have the same height of the progress bar with the contents being vertically centered.



enter image description here



documentclass[aspectratio=169, xcolor={x11names}]{beamer}

usecolortheme{rose}

setbeamercolor{itemize item}{fg=black}

useoutertheme{miniframes}

useinnertheme{inmargin}

setbeamersize{text margin left=2mm, text margin right=2mm}

newlength{sidebarWidth}
setlength{sidebarWidth}{0.2paperwidth}

setbeamersize{sidebar width left=sidebarWidth, sidebar width right=0cm}

usefonttheme{structurebold}

usepackage{tikz}
usetikzlibrary{calc}

% Custom progress bar
% BEGIN_FOLD

setbeamercolor{progress bar progress}{use=progress bar,bg=progress bar.fg}
newlength{heightNavigationSymbol}
setlength{heightNavigationSymbol}{2.5mm} % around 2.5mm or 7.1pt
newlength{widthProgressBarFull}
setlength{widthProgressBarFull}{sidebarWidth}
newcommand{totalslideinframe}{0}
defbeamertemplate{footline}{progress bar}{
% Calculate bars widths
dimen0=widthProgressBarFull
multiplydimen0 by insertframenumber
dividedimen0 by inserttotalframenumber
edefwidthProgressBar{thedimen0}
leavevmode%
%
% The bar itself
begin{beamercolorbox}[wd=widthProgressBarFull, ht=heightNavigationSymbol, dp=1ex]{progress bar}
begin{beamercolorbox}[wd=widthProgressBar, ht=heightNavigationSymbol, dp=1ex]{progress bar progress}
end{beamercolorbox}%
end{beamercolorbox}%
{hspace{-widthProgressBarFull}color{white} adjustbox{minipage={sidebarWidth}, frame}{hspace*{fill} $progressframepercent$ hspace*{fill}}}%
}
setbeamertemplate{footline}[progress bar]
setbeamercolor{progress bar}{fg=DodgerBlue3,bg=PeachPuff3}

% END_FOLD

usepackage{adjustbox}

newcommand{progressframepercent}{
{textnormal{pgfmathparse{insertframenumber*100/inserttotalframenumber}%
pgfmathprintnumber[fixed,precision=2]{pgfmathresult},%}}
}



begin{document}

begin{frame}
Some contents
end{frame}

begin{frame}





Some contents
end{frame}

begin{frame}
Some contents
end{frame}

begin{frame}
Some contents
end{frame}

begin{frame}
Some contents
end{frame}

end{document}









share|improve this question

























  • If you are using luatex, there are certainly ways (that I don't master) to do it. Some examples of ConTeXt presentation introduce that kind of progress bar. You may dig into ConTeXt wiki to find them.

    – sztruks
    Mar 17 at 10:38











  • tex.stackexchange.com/a/59749/134144 shows how to autmatically calculate the percentage and use it in combination with a progress bar.

    – leandriis
    Mar 17 at 11:08











  • @lendriis. I have successfully done the calculation and will modify the code accordingly, but I still need to know how to center the content vertically

    – Al-Motasem Aldaoudeyeh
    Mar 17 at 11:17
















1















In a progress bar, I would like to place a percentage figure representing the amount of progress. The original code I obtained for the bar is from Progress bar for latex-beamer. The image below shows what I am looking to get but the 85% here is placed manually.



enter image description here



After trying to solve it by myself and looking on previous question I learnt that the command used to calculate percent progress is



newcommand{progressframepercent}{
{textnormal{pgfmathparse{insertframenumber*100/inserttotalframenumber}%
pgfmathprintnumber[fixed,precision=2]{pgfmathresult},%}}
}


However, the percent indicator is still vertically centered. To solve this, the box must have the same height of the progress bar with the contents being vertically centered.



enter image description here



documentclass[aspectratio=169, xcolor={x11names}]{beamer}

usecolortheme{rose}

setbeamercolor{itemize item}{fg=black}

useoutertheme{miniframes}

useinnertheme{inmargin}

setbeamersize{text margin left=2mm, text margin right=2mm}

newlength{sidebarWidth}
setlength{sidebarWidth}{0.2paperwidth}

setbeamersize{sidebar width left=sidebarWidth, sidebar width right=0cm}

usefonttheme{structurebold}

usepackage{tikz}
usetikzlibrary{calc}

% Custom progress bar
% BEGIN_FOLD

setbeamercolor{progress bar progress}{use=progress bar,bg=progress bar.fg}
newlength{heightNavigationSymbol}
setlength{heightNavigationSymbol}{2.5mm} % around 2.5mm or 7.1pt
newlength{widthProgressBarFull}
setlength{widthProgressBarFull}{sidebarWidth}
newcommand{totalslideinframe}{0}
defbeamertemplate{footline}{progress bar}{
% Calculate bars widths
dimen0=widthProgressBarFull
multiplydimen0 by insertframenumber
dividedimen0 by inserttotalframenumber
edefwidthProgressBar{thedimen0}
leavevmode%
%
% The bar itself
begin{beamercolorbox}[wd=widthProgressBarFull, ht=heightNavigationSymbol, dp=1ex]{progress bar}
begin{beamercolorbox}[wd=widthProgressBar, ht=heightNavigationSymbol, dp=1ex]{progress bar progress}
end{beamercolorbox}%
end{beamercolorbox}%
{hspace{-widthProgressBarFull}color{white} adjustbox{minipage={sidebarWidth}, frame}{hspace*{fill} $progressframepercent$ hspace*{fill}}}%
}
setbeamertemplate{footline}[progress bar]
setbeamercolor{progress bar}{fg=DodgerBlue3,bg=PeachPuff3}

% END_FOLD

usepackage{adjustbox}

newcommand{progressframepercent}{
{textnormal{pgfmathparse{insertframenumber*100/inserttotalframenumber}%
pgfmathprintnumber[fixed,precision=2]{pgfmathresult},%}}
}



begin{document}

begin{frame}
Some contents
end{frame}

begin{frame}





Some contents
end{frame}

begin{frame}
Some contents
end{frame}

begin{frame}
Some contents
end{frame}

begin{frame}
Some contents
end{frame}

end{document}









share|improve this question

























  • If you are using luatex, there are certainly ways (that I don't master) to do it. Some examples of ConTeXt presentation introduce that kind of progress bar. You may dig into ConTeXt wiki to find them.

    – sztruks
    Mar 17 at 10:38











  • tex.stackexchange.com/a/59749/134144 shows how to autmatically calculate the percentage and use it in combination with a progress bar.

    – leandriis
    Mar 17 at 11:08











  • @lendriis. I have successfully done the calculation and will modify the code accordingly, but I still need to know how to center the content vertically

    – Al-Motasem Aldaoudeyeh
    Mar 17 at 11:17














1












1








1








In a progress bar, I would like to place a percentage figure representing the amount of progress. The original code I obtained for the bar is from Progress bar for latex-beamer. The image below shows what I am looking to get but the 85% here is placed manually.



enter image description here



After trying to solve it by myself and looking on previous question I learnt that the command used to calculate percent progress is



newcommand{progressframepercent}{
{textnormal{pgfmathparse{insertframenumber*100/inserttotalframenumber}%
pgfmathprintnumber[fixed,precision=2]{pgfmathresult},%}}
}


However, the percent indicator is still vertically centered. To solve this, the box must have the same height of the progress bar with the contents being vertically centered.



enter image description here



documentclass[aspectratio=169, xcolor={x11names}]{beamer}

usecolortheme{rose}

setbeamercolor{itemize item}{fg=black}

useoutertheme{miniframes}

useinnertheme{inmargin}

setbeamersize{text margin left=2mm, text margin right=2mm}

newlength{sidebarWidth}
setlength{sidebarWidth}{0.2paperwidth}

setbeamersize{sidebar width left=sidebarWidth, sidebar width right=0cm}

usefonttheme{structurebold}

usepackage{tikz}
usetikzlibrary{calc}

% Custom progress bar
% BEGIN_FOLD

setbeamercolor{progress bar progress}{use=progress bar,bg=progress bar.fg}
newlength{heightNavigationSymbol}
setlength{heightNavigationSymbol}{2.5mm} % around 2.5mm or 7.1pt
newlength{widthProgressBarFull}
setlength{widthProgressBarFull}{sidebarWidth}
newcommand{totalslideinframe}{0}
defbeamertemplate{footline}{progress bar}{
% Calculate bars widths
dimen0=widthProgressBarFull
multiplydimen0 by insertframenumber
dividedimen0 by inserttotalframenumber
edefwidthProgressBar{thedimen0}
leavevmode%
%
% The bar itself
begin{beamercolorbox}[wd=widthProgressBarFull, ht=heightNavigationSymbol, dp=1ex]{progress bar}
begin{beamercolorbox}[wd=widthProgressBar, ht=heightNavigationSymbol, dp=1ex]{progress bar progress}
end{beamercolorbox}%
end{beamercolorbox}%
{hspace{-widthProgressBarFull}color{white} adjustbox{minipage={sidebarWidth}, frame}{hspace*{fill} $progressframepercent$ hspace*{fill}}}%
}
setbeamertemplate{footline}[progress bar]
setbeamercolor{progress bar}{fg=DodgerBlue3,bg=PeachPuff3}

% END_FOLD

usepackage{adjustbox}

newcommand{progressframepercent}{
{textnormal{pgfmathparse{insertframenumber*100/inserttotalframenumber}%
pgfmathprintnumber[fixed,precision=2]{pgfmathresult},%}}
}



begin{document}

begin{frame}
Some contents
end{frame}

begin{frame}





Some contents
end{frame}

begin{frame}
Some contents
end{frame}

begin{frame}
Some contents
end{frame}

begin{frame}
Some contents
end{frame}

end{document}









share|improve this question
















In a progress bar, I would like to place a percentage figure representing the amount of progress. The original code I obtained for the bar is from Progress bar for latex-beamer. The image below shows what I am looking to get but the 85% here is placed manually.



enter image description here



After trying to solve it by myself and looking on previous question I learnt that the command used to calculate percent progress is



newcommand{progressframepercent}{
{textnormal{pgfmathparse{insertframenumber*100/inserttotalframenumber}%
pgfmathprintnumber[fixed,precision=2]{pgfmathresult},%}}
}


However, the percent indicator is still vertically centered. To solve this, the box must have the same height of the progress bar with the contents being vertically centered.



enter image description here



documentclass[aspectratio=169, xcolor={x11names}]{beamer}

usecolortheme{rose}

setbeamercolor{itemize item}{fg=black}

useoutertheme{miniframes}

useinnertheme{inmargin}

setbeamersize{text margin left=2mm, text margin right=2mm}

newlength{sidebarWidth}
setlength{sidebarWidth}{0.2paperwidth}

setbeamersize{sidebar width left=sidebarWidth, sidebar width right=0cm}

usefonttheme{structurebold}

usepackage{tikz}
usetikzlibrary{calc}

% Custom progress bar
% BEGIN_FOLD

setbeamercolor{progress bar progress}{use=progress bar,bg=progress bar.fg}
newlength{heightNavigationSymbol}
setlength{heightNavigationSymbol}{2.5mm} % around 2.5mm or 7.1pt
newlength{widthProgressBarFull}
setlength{widthProgressBarFull}{sidebarWidth}
newcommand{totalslideinframe}{0}
defbeamertemplate{footline}{progress bar}{
% Calculate bars widths
dimen0=widthProgressBarFull
multiplydimen0 by insertframenumber
dividedimen0 by inserttotalframenumber
edefwidthProgressBar{thedimen0}
leavevmode%
%
% The bar itself
begin{beamercolorbox}[wd=widthProgressBarFull, ht=heightNavigationSymbol, dp=1ex]{progress bar}
begin{beamercolorbox}[wd=widthProgressBar, ht=heightNavigationSymbol, dp=1ex]{progress bar progress}
end{beamercolorbox}%
end{beamercolorbox}%
{hspace{-widthProgressBarFull}color{white} adjustbox{minipage={sidebarWidth}, frame}{hspace*{fill} $progressframepercent$ hspace*{fill}}}%
}
setbeamertemplate{footline}[progress bar]
setbeamercolor{progress bar}{fg=DodgerBlue3,bg=PeachPuff3}

% END_FOLD

usepackage{adjustbox}

newcommand{progressframepercent}{
{textnormal{pgfmathparse{insertframenumber*100/inserttotalframenumber}%
pgfmathprintnumber[fixed,precision=2]{pgfmathresult},%}}
}



begin{document}

begin{frame}
Some contents
end{frame}

begin{frame}





Some contents
end{frame}

begin{frame}
Some contents
end{frame}

begin{frame}
Some contents
end{frame}

begin{frame}
Some contents
end{frame}

end{document}






beamer






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 17 at 11:24







Al-Motasem Aldaoudeyeh

















asked Mar 17 at 9:58









Al-Motasem AldaoudeyehAl-Motasem Aldaoudeyeh

1,857414




1,857414













  • If you are using luatex, there are certainly ways (that I don't master) to do it. Some examples of ConTeXt presentation introduce that kind of progress bar. You may dig into ConTeXt wiki to find them.

    – sztruks
    Mar 17 at 10:38











  • tex.stackexchange.com/a/59749/134144 shows how to autmatically calculate the percentage and use it in combination with a progress bar.

    – leandriis
    Mar 17 at 11:08











  • @lendriis. I have successfully done the calculation and will modify the code accordingly, but I still need to know how to center the content vertically

    – Al-Motasem Aldaoudeyeh
    Mar 17 at 11:17



















  • If you are using luatex, there are certainly ways (that I don't master) to do it. Some examples of ConTeXt presentation introduce that kind of progress bar. You may dig into ConTeXt wiki to find them.

    – sztruks
    Mar 17 at 10:38











  • tex.stackexchange.com/a/59749/134144 shows how to autmatically calculate the percentage and use it in combination with a progress bar.

    – leandriis
    Mar 17 at 11:08











  • @lendriis. I have successfully done the calculation and will modify the code accordingly, but I still need to know how to center the content vertically

    – Al-Motasem Aldaoudeyeh
    Mar 17 at 11:17

















If you are using luatex, there are certainly ways (that I don't master) to do it. Some examples of ConTeXt presentation introduce that kind of progress bar. You may dig into ConTeXt wiki to find them.

– sztruks
Mar 17 at 10:38





If you are using luatex, there are certainly ways (that I don't master) to do it. Some examples of ConTeXt presentation introduce that kind of progress bar. You may dig into ConTeXt wiki to find them.

– sztruks
Mar 17 at 10:38













tex.stackexchange.com/a/59749/134144 shows how to autmatically calculate the percentage and use it in combination with a progress bar.

– leandriis
Mar 17 at 11:08





tex.stackexchange.com/a/59749/134144 shows how to autmatically calculate the percentage and use it in combination with a progress bar.

– leandriis
Mar 17 at 11:08













@lendriis. I have successfully done the calculation and will modify the code accordingly, but I still need to know how to center the content vertically

– Al-Motasem Aldaoudeyeh
Mar 17 at 11:17





@lendriis. I have successfully done the calculation and will modify the code accordingly, but I still need to know how to center the content vertically

– Al-Motasem Aldaoudeyeh
Mar 17 at 11:17










1 Answer
1






active

oldest

votes


















2














To vertically centre the percentage indicator, you could put the text in a raisebox. The value of 0.02cm used below is just a quick guess, if necessary you can fine tune it further.



documentclass[aspectratio=169, xcolor={x11names}]{beamer}

usecolortheme{rose}

setbeamercolor{itemize item}{fg=black}

useoutertheme{miniframes}

useinnertheme{inmargin}

setbeamersize{text margin left=2mm, text margin right=2mm}

newlength{sidebarWidth}
setlength{sidebarWidth}{0.2paperwidth}

setbeamersize{sidebar width left=sidebarWidth, sidebar width right=0cm}

usefonttheme{structurebold}

usepackage{tikz}
usetikzlibrary{calc}

% Custom progress bar
% BEGIN_FOLD

setbeamercolor{progress bar progress}{use=progress bar,bg=progress bar.fg}
newlength{heightNavigationSymbol}
setlength{heightNavigationSymbol}{2.5mm} % around 2.5mm or 7.1pt
newlength{widthProgressBarFull}
setlength{widthProgressBarFull}{sidebarWidth}
newcommand{totalslideinframe}{0}
defbeamertemplate{footline}{progress bar}{
% Calculate bars widths
dimen0=widthProgressBarFull
multiplydimen0 by insertframenumber
dividedimen0 by inserttotalframenumber
edefwidthProgressBar{thedimen0}
leavevmode%
%
% The bar itself
begin{beamercolorbox}[wd=widthProgressBarFull, ht=heightNavigationSymbol, dp=1ex]{progress bar}
begin{beamercolorbox}[wd=widthProgressBar, ht=heightNavigationSymbol, dp=1ex]{progress bar progress}
end{beamercolorbox}%
end{beamercolorbox}%
raisebox{0.02cm}{hspace{-widthProgressBarFull}color{white} adjustbox{minipage={sidebarWidth}, frame}{hspace*{fill} $progressframepercent$ hspace*{fill}}}%
}
setbeamertemplate{footline}[progress bar]
setbeamercolor{progress bar}{fg=DodgerBlue3,bg=PeachPuff3}

% END_FOLD

usepackage{adjustbox}

newcommand{progressframepercent}{
{textnormal{pgfmathparse{insertframenumber*100/inserttotalframenumber}%
pgfmathprintnumber[fixed,precision=2]{pgfmathresult},%}}
}



begin{document}

begin{frame}
Some contents
end{frame}

begin{frame}





Some contents
end{frame}

begin{frame}
Some contents
end{frame}

begin{frame}
Some contents
end{frame}

begin{frame}
Some contents
end{frame}

end{document}


enter image description here






share|improve this answer
























  • This should work for now, but it is just interesting to ask how we align the percentage text automatically to horizontal middle of the bar

    – Al-Motasem Aldaoudeyeh
    Mar 18 at 5:37











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f479902%2fhow-to-place-a-figure-representing-progress-percentage-in-a-custom-progress-bar%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














To vertically centre the percentage indicator, you could put the text in a raisebox. The value of 0.02cm used below is just a quick guess, if necessary you can fine tune it further.



documentclass[aspectratio=169, xcolor={x11names}]{beamer}

usecolortheme{rose}

setbeamercolor{itemize item}{fg=black}

useoutertheme{miniframes}

useinnertheme{inmargin}

setbeamersize{text margin left=2mm, text margin right=2mm}

newlength{sidebarWidth}
setlength{sidebarWidth}{0.2paperwidth}

setbeamersize{sidebar width left=sidebarWidth, sidebar width right=0cm}

usefonttheme{structurebold}

usepackage{tikz}
usetikzlibrary{calc}

% Custom progress bar
% BEGIN_FOLD

setbeamercolor{progress bar progress}{use=progress bar,bg=progress bar.fg}
newlength{heightNavigationSymbol}
setlength{heightNavigationSymbol}{2.5mm} % around 2.5mm or 7.1pt
newlength{widthProgressBarFull}
setlength{widthProgressBarFull}{sidebarWidth}
newcommand{totalslideinframe}{0}
defbeamertemplate{footline}{progress bar}{
% Calculate bars widths
dimen0=widthProgressBarFull
multiplydimen0 by insertframenumber
dividedimen0 by inserttotalframenumber
edefwidthProgressBar{thedimen0}
leavevmode%
%
% The bar itself
begin{beamercolorbox}[wd=widthProgressBarFull, ht=heightNavigationSymbol, dp=1ex]{progress bar}
begin{beamercolorbox}[wd=widthProgressBar, ht=heightNavigationSymbol, dp=1ex]{progress bar progress}
end{beamercolorbox}%
end{beamercolorbox}%
raisebox{0.02cm}{hspace{-widthProgressBarFull}color{white} adjustbox{minipage={sidebarWidth}, frame}{hspace*{fill} $progressframepercent$ hspace*{fill}}}%
}
setbeamertemplate{footline}[progress bar]
setbeamercolor{progress bar}{fg=DodgerBlue3,bg=PeachPuff3}

% END_FOLD

usepackage{adjustbox}

newcommand{progressframepercent}{
{textnormal{pgfmathparse{insertframenumber*100/inserttotalframenumber}%
pgfmathprintnumber[fixed,precision=2]{pgfmathresult},%}}
}



begin{document}

begin{frame}
Some contents
end{frame}

begin{frame}





Some contents
end{frame}

begin{frame}
Some contents
end{frame}

begin{frame}
Some contents
end{frame}

begin{frame}
Some contents
end{frame}

end{document}


enter image description here






share|improve this answer
























  • This should work for now, but it is just interesting to ask how we align the percentage text automatically to horizontal middle of the bar

    – Al-Motasem Aldaoudeyeh
    Mar 18 at 5:37
















2














To vertically centre the percentage indicator, you could put the text in a raisebox. The value of 0.02cm used below is just a quick guess, if necessary you can fine tune it further.



documentclass[aspectratio=169, xcolor={x11names}]{beamer}

usecolortheme{rose}

setbeamercolor{itemize item}{fg=black}

useoutertheme{miniframes}

useinnertheme{inmargin}

setbeamersize{text margin left=2mm, text margin right=2mm}

newlength{sidebarWidth}
setlength{sidebarWidth}{0.2paperwidth}

setbeamersize{sidebar width left=sidebarWidth, sidebar width right=0cm}

usefonttheme{structurebold}

usepackage{tikz}
usetikzlibrary{calc}

% Custom progress bar
% BEGIN_FOLD

setbeamercolor{progress bar progress}{use=progress bar,bg=progress bar.fg}
newlength{heightNavigationSymbol}
setlength{heightNavigationSymbol}{2.5mm} % around 2.5mm or 7.1pt
newlength{widthProgressBarFull}
setlength{widthProgressBarFull}{sidebarWidth}
newcommand{totalslideinframe}{0}
defbeamertemplate{footline}{progress bar}{
% Calculate bars widths
dimen0=widthProgressBarFull
multiplydimen0 by insertframenumber
dividedimen0 by inserttotalframenumber
edefwidthProgressBar{thedimen0}
leavevmode%
%
% The bar itself
begin{beamercolorbox}[wd=widthProgressBarFull, ht=heightNavigationSymbol, dp=1ex]{progress bar}
begin{beamercolorbox}[wd=widthProgressBar, ht=heightNavigationSymbol, dp=1ex]{progress bar progress}
end{beamercolorbox}%
end{beamercolorbox}%
raisebox{0.02cm}{hspace{-widthProgressBarFull}color{white} adjustbox{minipage={sidebarWidth}, frame}{hspace*{fill} $progressframepercent$ hspace*{fill}}}%
}
setbeamertemplate{footline}[progress bar]
setbeamercolor{progress bar}{fg=DodgerBlue3,bg=PeachPuff3}

% END_FOLD

usepackage{adjustbox}

newcommand{progressframepercent}{
{textnormal{pgfmathparse{insertframenumber*100/inserttotalframenumber}%
pgfmathprintnumber[fixed,precision=2]{pgfmathresult},%}}
}



begin{document}

begin{frame}
Some contents
end{frame}

begin{frame}





Some contents
end{frame}

begin{frame}
Some contents
end{frame}

begin{frame}
Some contents
end{frame}

begin{frame}
Some contents
end{frame}

end{document}


enter image description here






share|improve this answer
























  • This should work for now, but it is just interesting to ask how we align the percentage text automatically to horizontal middle of the bar

    – Al-Motasem Aldaoudeyeh
    Mar 18 at 5:37














2












2








2







To vertically centre the percentage indicator, you could put the text in a raisebox. The value of 0.02cm used below is just a quick guess, if necessary you can fine tune it further.



documentclass[aspectratio=169, xcolor={x11names}]{beamer}

usecolortheme{rose}

setbeamercolor{itemize item}{fg=black}

useoutertheme{miniframes}

useinnertheme{inmargin}

setbeamersize{text margin left=2mm, text margin right=2mm}

newlength{sidebarWidth}
setlength{sidebarWidth}{0.2paperwidth}

setbeamersize{sidebar width left=sidebarWidth, sidebar width right=0cm}

usefonttheme{structurebold}

usepackage{tikz}
usetikzlibrary{calc}

% Custom progress bar
% BEGIN_FOLD

setbeamercolor{progress bar progress}{use=progress bar,bg=progress bar.fg}
newlength{heightNavigationSymbol}
setlength{heightNavigationSymbol}{2.5mm} % around 2.5mm or 7.1pt
newlength{widthProgressBarFull}
setlength{widthProgressBarFull}{sidebarWidth}
newcommand{totalslideinframe}{0}
defbeamertemplate{footline}{progress bar}{
% Calculate bars widths
dimen0=widthProgressBarFull
multiplydimen0 by insertframenumber
dividedimen0 by inserttotalframenumber
edefwidthProgressBar{thedimen0}
leavevmode%
%
% The bar itself
begin{beamercolorbox}[wd=widthProgressBarFull, ht=heightNavigationSymbol, dp=1ex]{progress bar}
begin{beamercolorbox}[wd=widthProgressBar, ht=heightNavigationSymbol, dp=1ex]{progress bar progress}
end{beamercolorbox}%
end{beamercolorbox}%
raisebox{0.02cm}{hspace{-widthProgressBarFull}color{white} adjustbox{minipage={sidebarWidth}, frame}{hspace*{fill} $progressframepercent$ hspace*{fill}}}%
}
setbeamertemplate{footline}[progress bar]
setbeamercolor{progress bar}{fg=DodgerBlue3,bg=PeachPuff3}

% END_FOLD

usepackage{adjustbox}

newcommand{progressframepercent}{
{textnormal{pgfmathparse{insertframenumber*100/inserttotalframenumber}%
pgfmathprintnumber[fixed,precision=2]{pgfmathresult},%}}
}



begin{document}

begin{frame}
Some contents
end{frame}

begin{frame}





Some contents
end{frame}

begin{frame}
Some contents
end{frame}

begin{frame}
Some contents
end{frame}

begin{frame}
Some contents
end{frame}

end{document}


enter image description here






share|improve this answer













To vertically centre the percentage indicator, you could put the text in a raisebox. The value of 0.02cm used below is just a quick guess, if necessary you can fine tune it further.



documentclass[aspectratio=169, xcolor={x11names}]{beamer}

usecolortheme{rose}

setbeamercolor{itemize item}{fg=black}

useoutertheme{miniframes}

useinnertheme{inmargin}

setbeamersize{text margin left=2mm, text margin right=2mm}

newlength{sidebarWidth}
setlength{sidebarWidth}{0.2paperwidth}

setbeamersize{sidebar width left=sidebarWidth, sidebar width right=0cm}

usefonttheme{structurebold}

usepackage{tikz}
usetikzlibrary{calc}

% Custom progress bar
% BEGIN_FOLD

setbeamercolor{progress bar progress}{use=progress bar,bg=progress bar.fg}
newlength{heightNavigationSymbol}
setlength{heightNavigationSymbol}{2.5mm} % around 2.5mm or 7.1pt
newlength{widthProgressBarFull}
setlength{widthProgressBarFull}{sidebarWidth}
newcommand{totalslideinframe}{0}
defbeamertemplate{footline}{progress bar}{
% Calculate bars widths
dimen0=widthProgressBarFull
multiplydimen0 by insertframenumber
dividedimen0 by inserttotalframenumber
edefwidthProgressBar{thedimen0}
leavevmode%
%
% The bar itself
begin{beamercolorbox}[wd=widthProgressBarFull, ht=heightNavigationSymbol, dp=1ex]{progress bar}
begin{beamercolorbox}[wd=widthProgressBar, ht=heightNavigationSymbol, dp=1ex]{progress bar progress}
end{beamercolorbox}%
end{beamercolorbox}%
raisebox{0.02cm}{hspace{-widthProgressBarFull}color{white} adjustbox{minipage={sidebarWidth}, frame}{hspace*{fill} $progressframepercent$ hspace*{fill}}}%
}
setbeamertemplate{footline}[progress bar]
setbeamercolor{progress bar}{fg=DodgerBlue3,bg=PeachPuff3}

% END_FOLD

usepackage{adjustbox}

newcommand{progressframepercent}{
{textnormal{pgfmathparse{insertframenumber*100/inserttotalframenumber}%
pgfmathprintnumber[fixed,precision=2]{pgfmathresult},%}}
}



begin{document}

begin{frame}
Some contents
end{frame}

begin{frame}





Some contents
end{frame}

begin{frame}
Some contents
end{frame}

begin{frame}
Some contents
end{frame}

begin{frame}
Some contents
end{frame}

end{document}


enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 17 at 14:40









samcartersamcarter

93k7105300




93k7105300













  • This should work for now, but it is just interesting to ask how we align the percentage text automatically to horizontal middle of the bar

    – Al-Motasem Aldaoudeyeh
    Mar 18 at 5:37



















  • This should work for now, but it is just interesting to ask how we align the percentage text automatically to horizontal middle of the bar

    – Al-Motasem Aldaoudeyeh
    Mar 18 at 5:37

















This should work for now, but it is just interesting to ask how we align the percentage text automatically to horizontal middle of the bar

– Al-Motasem Aldaoudeyeh
Mar 18 at 5:37





This should work for now, but it is just interesting to ask how we align the percentage text automatically to horizontal middle of the bar

– Al-Motasem Aldaoudeyeh
Mar 18 at 5:37


















draft saved

draft discarded




















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f479902%2fhow-to-place-a-figure-representing-progress-percentage-in-a-custom-progress-bar%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to send String Array data to Server using php in android

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

Is anime1.com a legal site for watching anime?