% \iffalse meta-comment % (The MIT License) % % Copyright (c) 2021-2024 Yegor Bugayenko % % Permission is hereby granted, free of charge, to any person obtaining a copy % of this software and associated documentation files (the 'Software'), to deal % in the Software without restriction, including without limitation the rights % to use, copy, modify, merge, publish, distribute, sublicense, and/or sell % copies of the Software, and to permit persons to whom the Software is % furnished to do so, subject to the following conditions: % % The above copyright notice and this permission notice shall be included in all % copies or substantial portions of the Software. % % THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR % IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, % FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE % AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER % LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, % OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE % SOFTWARE. % \fi % \CheckSum{0} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z % Digits \0\1\2\3\4\5\6\7\8\9 % Exclamation \! Double quote \" Hash (number) \# % Dollar \$ Percent \% Ampersand \& % Acute accent \' Left paren \( Right paren \) % Asterisk \* Plus \+ Comma \, % Minus \- Point \. Solidus \/ % Colon \: Semicolon \; Less than \< % Equals \= Greater than \> Question mark \? % Commercial at \@ Left bracket \[ Backslash \\ % Right bracket \] Circumflex \^ Underscore \_ % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % \GetFileInfo{ppt-slides.dtx} % \DoNotIndex{\endgroup,\begingroup,\let,\else,\s,\n,\r,\\,\1,\fi} % \iffalse %<*driver> \ProvidesFile{ppt-slides.dtx} % %\NeedsTeXFormat{LaTeX2e} %\ProvidesPackage{ppt-slides} %<*package> [2024-01-23 0.3.2 Slide Decks a la Power Point] % %<*driver> \documentclass{ltxdoc} \usepackage[T1]{fontenc} \usepackage[tt=false, type1=true]{libertine} \usepackage{microtype} \AddToHook{env/verbatim/begin}{\microtypesetup{protrusion=false}} \usepackage{graphicx} \usepackage{xcolor} \usepackage[runs=2,dtx,margin=0,small]{docshots} \usepackage{href-ul} \PageIndex \EnableCrossrefs \CodelineIndex \RecordChanges \begin{document} \DocInput{ppt-slides.dtx} \PrintChanges \PrintIndex \end{document} % % \fi % \title{|ppt-slides|: \LaTeX{} Package for \\ Slide Decks \`{a} la Power Point\thanks{The sources are in GitHub at \href{https://github.com/yegor256/ppt-slides}{yegor256/ppt-slides}}} % \author{Yegor Bugayenko \\ \texttt{yegor256@gmail.com}} % \date{\filedate, \fileversion} % % \maketitle % % \section{Introduction} % % This package helps you render slide decks in PowerPoint\texttrademark{} style: % \begin{docshot} % \documentclass{article} % \usepackage[template,scheme=dark]{ppt-slides} % \begin{document} % \begin{pptMiddle} % \pptTitle{Hello, world!}{How are you?} % \end{pptMiddle} % \end{document} % \end{docshot} % It is recommended to use this package together with % \href{https://github.com/yegor256/clicks}{clicks}: % \begin{docshot} % \documentclass{article} % \usepackage[template,scheme=dark]{ppt-slides} % \usepackage[static]{clicks} % \begin{document} % We help you make slide decks in \LaTeX: % \plick{\pptBanner{Making Slides Is Easy}} % \plick{Just use this package...} % \plush{together with 'clicks' package.} % They will look similar to what PowerPoint can % make, but with the precision of \LaTeX. We % recommend using us together with ``clicks.'' % \end{document} % \end{docshot} % \section{Layout} % \DescribeMacro{\pptToc} % \DescribeMacro{\pptChapter} % First, split your story into chapters: %\iffalse %<*verb> %\fi \begin{verbatim} \documentclass{article} \usepackage{clicks} \usepackage[template,scheme=light]{ppt-slides} \begin{document} \pptToc \plush{\pptChapter{About Me}} ... \plush{\pptChapter[Idea]{My Idea Is Novel}} ... \plush{\pptChapter[FAQ]{Discussion \& Questions}} ... \end{document} \end{verbatim} %\iffalse % %\fi % |\pptToc| will render the table of contents in an interactive ``clickable'' format. % Thanks to the use of \href{https://github.com/yegor256/crumbs}{crumbs}, there will % be a navigation at the top left corner. % \DescribeMacro{\pptSection} % Then, put sections inside chapters: %\iffalse %<*verb> %\fi \begin{verbatim} \begin{document} \pptToc \plush{\pptChapter{About Me}} \plush{\pptSection[Student]{I'm a Student}} ... \plush{\pptSection[Athlete]{Also, I'm an Athlete}} ... \plush{\pptChapter[Idea]{My Idea Is Novel}} \plush{\pptSection{Novelty}} \plush{\pptSection{Impact}} \end{document} \end{verbatim} %\iffalse % %\fi % The |\pptChapter| and |\pptSection| commands used together will render % nice two-level nagivation menu at the top left corner. % \DescribeMacro{\pptLeft} % \DescribeMacro{\pptRight} % You can place the title of the presentation and your name at the bottom % of each slide, on the left and on the right respectively: %\iffalse %<*verb> %\fi \begin{verbatim} \documentclass{article} \usepackage{clicks} \usepackage[template,scheme=light]{ppt-slides} \pptLeft{How Did I Spend Last Summer} \pptRight{Yegor Bugayenko} \begin{document} ... \end{document} \end{verbatim} %\iffalse % %\fi % If you don't use the |\pptLeft| or |\pptRight| commands, nothing will % be printed at the bottom. % \section{Commands} % \DescribeMacro{\pptPic} % You can add an image to the slide (the first argument is the width % of the image in relation to |\textwidth|, % while the second one is the path of it): % \begin{docshot} % \documentclass{article} % \usepackage[template,scheme=dark]{ppt-slides} % \begin{document} % \pptPic{0.2}{socrates.jpg} \\ % This is Socrates, a Greek philosopher. % \end{document} % \end{docshot} % \DescribeMacro{\pptHeader} % You can add a piece of code to the slide (we recommend using \href{https://github.com/yegor256/ffcode}{ffcode}): % \begin{docshot} % \documentclass{article} % \usepackage[template,scheme=dark]{ppt-slides} % \usepackage{ffcode} % \begin{document} % \pptHeader{This is How You Print to Console:} % \begin{ffcode} % void main(char** args) { % printf("Hello, world!"); % } % \end{ffcode} % \end{document} % \end{docshot} % Don't use |\plick| or |\plush|, they won't work with code snippets. % The |\pptHeader| command prints a header similar to what the |\pptSection| command prints, but % doesn't start a new section. % \DescribeMacro{\pptQuote} % \DescribeMacro{\pptBanner} % You can put a quote next to the image, by using the |\pptQuote| command: % \begin{docshot} % \documentclass{article} % \usepackage[template,scheme=dark]{ppt-slides} % \begin{document} % \pptBanner{My Favorite Quote} % \pptQuote{socrates.jpg}{The only true wisdom % is in knowing you know nothing}{Socrates} % \end{document} % \end{docshot} % \DescribeMacro{\pptThought} % For an interesting thought in the middle of the slide, use |\pptThought|: % \begin{docshot} % \documentclass{article} % \usepackage[template,scheme=dark]{ppt-slides} % \begin{document} % \pptThought{Socrates said that the only true % wisdom is in knowing you know nothing. Was he % a wise man?...} % \end{document} % \end{docshot} % \DescribeMacro{pptMiddle} % You can put your content vertically in the middle of the page, using the |pptMiddle| environment: % \begin{docshot} % \documentclass{article} % \usepackage[template,scheme=dark]{ppt-slides} % \begin{document} % \begin{pptMiddle} % ``Your time is limited, so don't waste it % living someone else's life.'' --- Steve Jobs % \end{pptMiddle} % \end{document} % \end{docshot} % \DescribeMacro{\pptQR} % Sometimes it's convenient to show a QR code to your audience instead of % a URL, since it's easier to use --- they can scan it: % \begin{docshot} % \documentclass{article} % \usepackage[template,scheme=dark]{ppt-slides} % \begin{document} % Check my blog post by this link: \\ % \pptQR{https://www.yegor256.com} % \end{document} % \end{docshot} % The code will look like this, thanks to \href{https://ctan.org/pkg/qrcode}{qrcode} package that % we use behind the scene. % \DescribeMacro{pptWide} % \DescribeMacro{pptWideOne} % Sometimes you need your slide content to take all visible horizontal space: % \begin{docshot} % \documentclass{article} % \usepackage[template,scheme=dark]{ppt-slides} % \begin{document} % \begin{pptWideOne} % This paragraph is too long for some reasons, % that's why must take all visible horizontal % space, while normally the content has a wide % margin on the left side of the page. % \end{pptWideOne} % \end{document} % \end{docshot} % You can also use |\begin{pptWide}{X}|, % where |X| is the number of columns to render. % \section{Package Options} % \DescribeMacro{template} % You start with a template for your slide deck: %\iffalse %<*verb> %\fi \begin{verbatim} \documentclass{article} \usepackage[template=9x6]{ppt-slides} \begin{document} ... \end{document} \end{verbatim} %\iffalse % %\fi % There is only one template, which is used by default: |9x6|. If you don't % specify the name, it will be used. If you don't use the |template| option at all, % the default |article| will be rendered, which is not what you want. % \DescribeMacro{scheme} % You can choose a color scheme for your slides, using the |scheme| option % of the package: %\iffalse %<*verb> %\fi \begin{verbatim} \usepackage[template,scheme=light]{ppt-slides} \end{verbatim} %\iffalse % %\fi % There are a few out-of-the-box schemes available: |light|, |dark|, % |light-mono|, and |dark-mono|. You can design your own, using % |ppt-light.tex| file as an example: %\iffalse %<*verb> %\fi \begin{verbatim} \usepackage[template,scheme=/usr/local/my-colors.tex]{ppt-slides} \end{verbatim} %\iffalse % %\fi % \DescribeMacro{directory} % You can change the location of the templates and schemes by means of the |directory| package option: %\iffalse %<*verb> %\fi \begin{verbatim} \usepackage[directory=/tmp,template=foo]{ppt-slides} \end{verbatim} %\iffalse % %\fi % \DescribeMacro{nominutes} % By default, if you render your slide deck in non-static mode (the |static| option for the ``clicks'' package), % there will be minutes tracking in the right top corner of each slide. You can turn this off % by using the |nominutes| option of the package: %\iffalse %<*verb> %\fi \begin{verbatim} \usepackage[nominutes]{ppt-slides} \end{verbatim} %\iffalse % %\fi % \StopEventually{} % \section{Implementation} % \changes{0.0.1}{2022/09/11}{First draft.} % \changes{0.1.4}{2022/09/15}{The \texttt{nominutes} package option added.} % \changes{0.1.5}{2022/09/19}{The default directory fixed.} % \changes{0.2.0}{2022/12/03}{We migrated to the \texttt{ltxdoc} format and \texttt{.dtx} file.} % First, we parse the package options: % \begin{macrocode} \RequirePackage{pgfopts} \makeatletter \pgfkeys{ /ppt-slides/.is family, /ppt-slides, template/.estore in = \ppt@template, template/.default = 9x6, scheme/.estore in = \ppt@scheme, directory/.estore in = \ppt@directory, directory/.default = , nominutes/.estore in = \ppt@nominutes, directory } \ProcessPgfPackageOptions{/ppt-slides} \makeatother % \end{macrocode} % Then, we include the template: % \begin{macrocode} \makeatletter\ifdefined\ppt@template \input{\ppt@directory ppt-templates/ppt-\ppt@template.tex} \else \message{^^Jppt: No template is loaded, because the 'template' option is not specified} \fi\makeatother % \end{macrocode} % Then, we include the scheme: % \begin{macrocode} \makeatletter\ifdefined\ppt@scheme \RequirePackage{xcolor} \input{\ppt@directory ppt-schemes/ppt-\ppt@scheme.tex} \else \message{^^Jppt: No color scheme is loaded, because the 'scheme' option is not specified} \fi\makeatother % \end{macrocode} % Then, we include \href{https://ctan.org/pkg/ifthen}{ifthen} % in order to enable |if/then/else| commands: % \begin{macrocode} \RequirePackage{ifthen} % \end{macrocode} % Then, we include \href{https://ctan.org/pkg/href-ul}{href-ul} % in order to enable underlined hyperlinks: % \begin{macrocode} \RequirePackage{href-ul} % \end{macrocode} % Then, we include \href{https://ctan.org/pkg/pagecolor}{pagecolor} % in order to make it possible to change the background color of a page: % \begin{macrocode} \RequirePackage{pagecolor} % \end{macrocode} % Then, we include \href{https://ctan.org/pkg/varwidth}{varwidth} % in order to change the width of the page, inside |pptWide|: % \begin{macrocode} \RequirePackage{varwidth} % \end{macrocode} % Then, we include \href{https://ctan.org/pkg/qrcode}{qrcode} % in order to render QR codes: % \begin{macrocode} \RequirePackage{qrcode} % \end{macrocode} % Then, we include \href{https://ctan.org/pkg/tikz}{tikz} % in order to position elements on the page, especially in the Table of Contents: % \begin{macrocode} \RequirePackage{tikz} % \end{macrocode} % Then, we include \href{https://ctan.org/pkg/tikzpagenodes}{tikzpagenodes} % in order to pin a block in |\pptPin|: % \begin{macrocode} \RequirePackage{tikzpagenodes} % \end{macrocode} % Then, we include \href{https://ctan.org/pkg/enumitem}{enumitem} % in order to render inline lists in crumbs: % \begin{macrocode} \RequirePackage[inline]{enumitem} % \end{macrocode} % Then, we include \href{https://ctan.org/pkg/crumbs}{crumbs} % in order to show top-page menus: % \begin{macrocode} \RequirePackage{crumbs} % \end{macrocode} % Then, we include \href{https://ctan.org/pkg/calc}{calc} % in order to calculate positions of elements more precisely: % \changes{0.3.1}{2024/01/13}{The \texttt{calc} package added.} % \begin{macrocode} \RequirePackage{calc} % \end{macrocode} % Then, we include \href{https://ctan.org/pkg/tabularx}{tabularx} % in order to render |\pptQuote|: % \begin{macrocode} \RequirePackage{tabularx} % \end{macrocode} % Then, we include \href{https://ctan.org/pkg/seqsplit}{seqsplit} % in order to split long links: % \begin{macrocode} \RequirePackage{seqsplit} % \end{macrocode} % \begin{macro}{\pptMiddle} % \changes{0.2.1}{2022/12/04}{The \texttt{\char`\\pptMiddle} command turned into \texttt{pptMiddle} environment.} % Then, we define the |pptMiddle| environment: % \begin{macrocode} \newenvironment{pptMiddle} {\vspace*{\fill}} {\vspace*{\fill}} % \end{macrocode} % \end{macro} % \begin{macro}{\pptBanner} % Then, we define the |\pptBanner| command: % \begin{macrocode} \newcommand\pptBanner[2][green]{% \par% {\setlength{\fboxsep}{6pt}% \colorbox{#1}{\color{\thepagecolor}\large #2}}% \par% } % \end{macrocode} % \end{macro} % \begin{macro}{\pptChapter} % Then, we define the |\pptChapter| command: % \begin{macrocode} \newcommand\pptChapter[2][]{% \crumbection[#1]{#2}% \begin{pptMiddle}% {\large\ttfamily Chapter \#\the\value{section}:}% \newline% \rotatebox{1}{\pptBanner[blue]{\LARGE#2}}% \end{pptMiddle}% } % \end{macrocode} % \end{macro} % \begin{macro}{\pptSection} % Then, we define the |\pptSection| command: % \begin{macrocode} \newcommand\pptSection[2][]{% \subcrumbection[#1]{#2}% \pptHeader{#2}% } % \end{macrocode} % \end{macro} % \begin{macro}{\pptHeader} % Then, we define the |\pptHeader| command: % \begin{macrocode} \newcommand\pptHeader[1]{% \vspace*{-0.75in}\hspace*{-0.5in}% \rotatebox{1}{\pptBanner[orange]{\Large #1}}\vspace*{0.15in}% \par% } % \end{macrocode} % \end{macro} % \begin{macro}{\pptTitle} % Then, we define the |\pptTitle| command, which prints the |title| and |subtitle| on the % first page. The first argument is the title, the second is the subtitle. If the second % argument is empty, it won't be printed: % \begin{macrocode} \newcommand\pptTitle[2]{% {\pptBanner{\Huge #1}}% \def\param{#2}% \ifx\param\empty\else% {\pptBanner{\large #2}}% \fi% } % \end{macrocode} % \end{macro} % \begin{macro}{\pptToc} % Then, we define the |\pptToc| command: % \begin{macrocode} \newcommand*\pptTOC{} \newcommand\pptToc[1][]{% \renewcommand*\pptTOC{}% \print{% \def\param{#1}% \ifx\param\empty\else% \pptBanner{#1}% \fi% \tikz{% \node (z) {% \begin{varwidth}{\textwidth}% \ifx\pptTOC\empty\else% \begin{itemize}[label={}] \pptTOC \end{itemize} \fi% \end{varwidth}% };% \path [draw=blue,line width=4pt] (z.north west) -- (z.south west);% }% }% \begin{@empty}% \renewcommand\crumb[2]{% \ifx\pptTOC\empty\else\ifdefined\click\click[0]\fi\fi \gappto\pptTOC{\item ##2} } \crumbs \end{@empty}% \ifdefined\flush\flush[1]\fi% } % \end{macrocode} % \end{macro} % \begin{macro}{\pptQuote} % Then, we define the |\pptQuote| command, with one optional and three mandatory arguments: % \changes{0.3.0}{2023/11/08}{The \texttt{\char`\\pptQuote} command has got an optional parameter, where the name of the person on the photo can be specified.} % \begin{macrocode} \newcommand\pptQuote[4][]{% \begin{tabularx}{\columnwidth}{c>{\raggedright\arraybackslash}X}% \raisebox{\dimexpr-\height+\ht\strutbox}{ \parbox{0.25\textwidth+2pt}{% \raggedright% \pptPic{0.25}{#2}% \def\person{#1}% \ifx\person\empty\else% \par% \small% \person% \fi% }% }% &% ``#3''% \def\param{#4}% \ifx\param\empty\else% \par\vspace*{1em}% \small% --- \param% \par% \fi% \\% \end{tabularx}% } % \end{macrocode} % \end{macro} % \begin{macro}{\pptPic} % Then, we define the |\pptPic| command: % \begin{macrocode} \newcommand\pptPic[2]{% {% \setlength{\fboxsep}{0pt}% \setlength{\fboxrule}{1pt}% \fcolorbox{gray}{white}{% \includegraphics[width=#1\columnwidth]{#2}% }% }% } % \end{macrocode} % \end{macro} % \begin{macro}{\pptPin} % Then, we define the |\pptPin| command: % \begin{macrocode} \newcommand\pptPin[2][right]{% \begin{tikzpicture}[remember picture,overlay]% \ifthenelse{\equal{#1}{left}}% {% \node[anchor=north east] at ($(current page text area.north west) - (24pt, 18pt)$) {% \begin{minipage}{0.25\textwidth}% \raggedleft #2% \end{minipage}% };% }% {% \node[anchor=north east] at (current page text area.north east) {% \begin{minipage}{0.25\textwidth}% \raggedright #2% \end{minipage}% };% }% \end{tikzpicture}% } % \end{macrocode} % \end{macro} % \begin{macro}{\pptThought} % \changes{0.3.0}{2023/09/19}{The \texttt{\char`\\pptThought} command aligns text to the left.} % Then, we define the |\pptThought| command: % \begin{macrocode} \newcommand\pptThought[1]{% \begin{pptMiddle}% \tikz{% \node [inner sep=18pt] (z) {% \begin{varwidth}{0.8\textwidth}% \raggedright\Large #1% \end{varwidth}% }; \path [draw=green,line width=8pt] (z.north west) -- (z.south west); }% \end{pptMiddle}% } % \end{macrocode} % \end{macro} % \begin{macro}{\pptSnippet} % Then, we define the |\pptSnippet| command: % \begin{macrocode} \newcommand\pptSnippet[2][\small]{% \begin{samepage}% #1\verbatiminput{#2}% \end{samepage}% } % \end{macrocode} % \end{macro} % \begin{macro}{\pptQR} % Then, we define the |\pptQR| command: % \begin{macrocode} \newcommand\pptQR[2][2in]{% \tikz{% \node[draw=white]{% \href{#2}{% \qrcode[height=#1]{#2}% }% }% }% } % \end{macrocode} % \end{macro} % \begin{macro}{\pptPinQR} % Then, we define the |\pptPinQR| command: % \begin{macrocode} \newcommand\pptPinQR[2][right]{% \pptPin[#1]{% \begin{minipage}{1.4in}% \raggedleft% \pptQR[1in]{#2}% \\[3pt] \ttfamily\fontsize{8pt}{10pt}\selectfont% \seqsplit{#2} \href{#2}{$\rightarrow$}% \\ \end{minipage}% }% } % \end{macrocode} % \end{macro} % \begin{macro}{pptWide} % Finally, we define the |pptWide| and |pptWideOne| environments: % \begin{macrocode} \newenvironment{pptWideOne} {\begin{adjustwidth}{-2in}{-1in}} {\end{adjustwidth}} \newenvironment{pptWide}[1] {\begin{pptWideOne}\begin{multicols}{#1}} {\end{multicols}\end{pptWideOne}} % \end{macrocode} % \end{macro} % \begin{macrocode} \endinput % \end{macrocode} % \Finale % \PrintChanges % \clearpage % \PrintIndex