

%% This is file `talkpal.sty',
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%%  This file is part of the package TALKPAL 1.0, containing 
%%  a style file and its manual which can be used for producing slides
%%  appropriate for a presentation.
%%
%%  Copyright (C) 2026 Palash Baran Pal 
%%  e-mail: palashbaran.pal.retd@saha.ac.in
%%  internet: palashbaranpal.github.io
%%
%%  Release date: July 2026
%%
%%  This program is free software; you can redistribute it and/or modify
%%  it under the terms of the GNU General Public License as published by
%%  the Free Software Foundation; either version 2 of the License, or
%%  (at your option) any later version.
%%
%%  This program is distributed in the hope that it will be useful,
%%  but WITHOUT ANY WARRANTY; without even the implied warranty of
%%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%%  GNU General Public License for more details.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Permission is granted to copy this file to another file with a 
%% clearly different name and to customize the declarations in that 
%% copy to serve the needs of your installation.
%% 
%% However, NO PERMISSION is granted to generate or to distribute a 
%% modified version of this file under its original name. 
%% 
%% You are NOT ALLOWED to change this file. 
%% 
%% 

%% Protected by GPL (General Public License)

\ProvidesPackage{talkpal}[2026/07/17 talkpal Package version 1.0]

\usepackage{color, graphicx}
%\usepackage{latexsym}
\usepackage{lastpage}
\usepackage{newcent}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\usepackage[papersize={240mm,135mm}]{geometry}
\usepackage{hyperref}
\hypersetup{hidelinks}

\topmargin=-25mm
\oddsidemargin=-20mm
\evensidemargin=\oddsidemargin
\textwidth=230mm
\textheight=100mm

\newcounter{nsegment}
\newcounter{currlap}
\newcounter{totlaps}

\setcounter{currlap}0

\makeatletter
\def\slidebasec@l@r{red}
\def\carryc@l@r{black}


\long\def\beginslide#1\endslide{\newpage
  \setcounter{nsegment}1
  \setcounter{currlap}1
  \setcounter{totlaps}1
  \ifnum\thetotlaps>0
  \loop
  \setcounter{nsegment}1
  \setcounter{totlaps}{\thensegment}
  \addtocounter{totlaps}1
  \vbox{\defaultsize #1}\vfill
  \stepcounter{currlap}
  \newpage
  \ifnum\thecurrlap<\thetotlaps
		\addtocounter{page}{-1}
  \repeat
  \fi
}

\def\newsegment{\stepcounter{totlaps}%
  \ifnum\thensegment=\thecurrlap%
  \global\color{\slidebasec@l@r}\fi\stepcounter{nsegment}%
}

\def\samesegment{\ifnum\thensegment>\thecurrlap%
  \color{\slidebasec@l@r}\fi}

\def\flash#1#2{\newsegment\ifnum\thensegment=\thecurrlap{\vspace{-#1\textheight}#2}\fi}


\let\tcol=\textcolor
\def\textcolor#1#2{\ifnum\thensegment>\thecurrlap%
  \global\color{\slidebasec@l@r}\else%
  \tcol{#1}{#2}\fi}

%% INCLUDING PICTURES

\def\putfigure#1#2#3{\ifnum\thensegment>\thecurrlap
  \vspace*{#1}
  \else
  \includegraphics[height=#1, #2]{#3}
  \fi
}


%% REDEFINING HYPERREF COMMANDS

\def\hyperpairarrow#1#2{\hyperlink{#1}{\fboxrule=.5mm\framebox{$\downarrow$}} 
  \ifnum\thensegment=\thecurrlap
  \hypertarget{#2}{}\fi}

\def\hyperpaircustom[#1]#2#3{\hyperlink{#2}{\fboxrule=.5mm\framebox{#1}} 
  \ifnum\thensegment=\thecurrlap
  \hypertarget{#3}{}\fi}

\def\hyperpair{\@ifnextchar[{\hyperpaircustom}{\hyperpairarrow}}

%% SETTING DEFAULTS

\def\slidebasec@l@r{black}
\pagecolor{\slidebasec@l@r}
\setlength{\fboxrule}{1mm}
\def\defaultsize{\Large} 
\color{yellow}

\def\setbasecolor#1{\def\slidebasec@l@r{#1}\pagecolor{#1}}

\def\foottext{Created with talkpal}
\def\footcolor{white}

\fancyhead{}
\fancyfoot{}
\fancyfoot[C]{\parbox{\textwidth}{\tcol{\footcolor}
    {\null\hrulefill\newline \foottext \hfill Slide~\arabic{page} of \pageref{LastPage}}}} 

\makeatother



