TransWikia.com

How to create a progress bar in beamer with TikZ?

TeX - LaTeX Asked on July 31, 2021

I want to create my own progress bar in my beamer presentation. This is my preamble code:

documentclass[9pt, hyperref={pdfpagemode=FullScreen}]{beamer}

usepackage[utf8]{inputenc}

definecolor{whitesmoke}{rgb}{0.96, 0.96, 0.96}

title{textbf{COMPLEJOS INTERMOLECULARES DE BASES DE ADN EN ESTADOS ELECTRÓNICOS EXCITADOS}}

definecolor{ghostwhite}{rgb}{0.97, 0.97, 1.0}

definecolor{columbiablue}{rgb}{0.61, 0.87, 1.0}

usefonttheme{serif}

usepackage{lewis} 

usepackage{tikz}

usetikzlibrary{calc}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PROGRESS BAR 


newcommand{progressbar}{

begin{tikzpicture}

    fill [gray] (10,0) rectangle (13.0,0.5) ;

    fill [blue] (0,0) rectangle (10,0.5);  


end{tikzpicture}


}

setbeamertemplate{headline}{ progressbar}

....

begin{document} 

.....
end{document} 

All the slides contain the same rectangles at the top:

enter image description here

I would like that in all slides the gray rectangle fills up with any color until the presentation ends, containing the frame number below.

One Answer

I made this before for myself.

% !TEX encoding = UTF-8 Unicode
% !TEX TS-program = pdflatex
% !TEX spellcheck = English
% !TEX pdfSinglePage



documentclass[14pt]{beamer}
    beamertemplatenavigationsymbolsempty

usepackage{tikz}

title[Math of Communication]{A Mathematical Theory of Communication}
author[C.~E.~Shannon]{Claude E.~Shannon}
institute{University of Informatics}
date[2020-10]{2020-10-10}

begin{document}

framemaketitle

makeatletterdefbeamertemplate*{sidebar right}{pro-bar}{
    pgfmathsetmacrosafetotalframenumber{max(insertmainframenumber-1,1)}
    tikz[remember picture,overlay,x=3mm,y=paperheight]{footnotesize
        pgfmathsetmacrooverlaytotal{insertframeendpage+1-insertframestartpage}
        pgfmathsetmacrooverlayfraction{insertoverlaynumber/overlaytotal}
        path[save path=stare,yscale=1/safetotalframenumber]
            (-1,0)-|(0,1-insertframenumber)-|+(-overlayfraction,1)-|cycle;
        tikzset{bar/.pic={node at(-.55,-.5)[rotate=-90]
            {beamer@shorttitle~beamer@shortdate~beamer@shortauthor};}}
        fill[use path=stare,gray]pic[blue]{bar};
        clip[use path=stare]pic[green]{bar};
    }
}makeatother

frame{{Doe, a deer, a female deer}
    Beamer is a LaTeX document class for creating presentation slides,
    pausevfill
    with a wide range of templates and a set of features for making slideshow effects.
}

frame{{Ray, a drop of golden sun}
    It supports pdfLaTeX, LaTeX + dvips, LuaLaTeX and XeLaTeX.[1]
    pausevfill
    The name is taken from the German word "Beamer"
    pausevfill
    as a pseudo-anglicism for "video projector".
}

frame{{Me, a name I call myself}
    The Beamer class is not the first LaTeX class for creating presentations,
    pausevfill
    and like many of its predecessors
    pausevfill
    (such as slides, seminar, prosper, powerdot),[2]
    pausevfill
    it has special syntax for defining "slides"
    pausevfill
    (known in Beamer as "frames").
}

frame{{Far, a long, long way to run}
    Slides can be built up on-screen in stages
    as if by revealing text that was previously hidden or covered.
    pausevfill
    This is handled with PDF output by creating successive pages
    that preserve the layout but add new elements,
    pausevfill
    so that advancing to the next page in the PDF file
    appears to add something to the displayed page,
    pausevfill
    when in fact it has merely redrawn the page.
}

frame{{Sew, a needle pulling thread}
    The list of features supported by Beamer is quite long.
    pausevfill
    The most important features, according to the user guide[1] are:
}

frame{{La, a note to follow Sew}
    begin{itemize}[<+->]
        item   Beamer can be used with pdfLaTeX, LaTeX+dvips, LuaLaTeX and XeLaTeX.
                LaTeX+dvipdfm isn’t supported.
        item   The standard commands of LaTeX still work.
                A tableofcontents will still create a table of contents,
                section is still used to create structure,
                and itemize still creates a list.
        item   Overlays and dynamic effects can be easily created.
        item   The appearance of presentations can be modified using themes.
    end{itemize}
}

frame{{Tea, a drink with jam and bread}
    begin{itemize}[<+->]
        item   The layout, the colors, and the fonts
                used in a presentation can easily be changed globally,
                while preserving control over the most minute detail.
        item   A special style file allows for the use the LaTeX source of
                a presentation directly in other LaTeX classes such as article or book.
                This makes it easy to create presentations out of
                lecture notes or lecture notes out of presentations.
        item   The final output is typically a PDF file, making it highly portable
                and worry-free, in the sense that a given presentation
                will always look the same no matter the machine it is opened on.
    end{itemize}
}

end{document}

Answered by Symbol 1 on July 31, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP