%
%  Set up base fontsizes other than the standard 10, 11, and 12-point
%  offerings of the article class.
%
%  H.A.Trujillo,    26 June 2011
%  Last Change:     27 Jun 2017

\ProvidesPackage{fontsize}%
	 [2017/06/26  v3.1 Non-Standard font-sizes (H.A.Trujillo)]

%
%
%	Usage:	\usepackage    [size] {fontsize}
%	   or:  \documentclass [size] {classname}
%
%			size = 7pt, 8pt, 9pt, 14pt
%
%	     (analogous to "\documentclass[10pt]{article}" etc)
%
%
%	caveats:
%	    - not all fonts will scale smaller than 5pt or larger than 25.
%	      some observations:
%
%		default cm		% does not scale.
%		cmolddig		% doesn't work
%		lmodern			% works -- same as cm, but no osf
%		cfr-lm			% works -- like cm but *with* osf
%		mathpazo		% works
%		newcent			% works
%		type1ec			% no help
%
%	    - Does not play nicely w/ setspace.sty's "\singlespacing"
%	
%	
%	User Commands:
%	    \begin{smaller}	maps each fontsize to the next smaller
%	    \begin{larger}	maps each fontsize to the next larger
%	    \smaller			idem
%	    \larger			idem
%

% \get@current:  get current font-size %<<<
%
%   define \trunc@pt to be the same as “\strip@pt” without the decimal places
%				     (based on ltfssbas.dtx, lines 263-269)
\begingroup
  \catcode`P=12
  \catcode`T=12
  \catcode`.=12
  \lowercase{
    \def\x{\def\trn@pt##1.##2PT{##1}}}
  \expandafter\endgroup\x
\def\trunc@pt{\expandafter\trn@pt\the}

% \get@currsize :
% 	leaves the current point size, rounded to the nearest integer, in \count255
\newcommand{\get@currsize}{%
    \dimen0=\f@size pt
    \advance\dimen0 0.5pt
    \global\count255=\trunc@pt\dimen0\relax
    }%>>>

% Smaller/Larger environments %<<<
\newenvironment{smaller} % Scale all fonts down one notch
   {\let\Huge = \huge%
    \let\huge = \LARGE%
    \let\LARGE = \Large%
    \let\Large = \large%
    \let\large = \normalsize%
    \let\normalsize = \small%
    \let\small = \footnotesize%
    \let\footnotesize = \scriptsize%
    \let\scriptsize = \tiny%
    \get@currsize
    \set@currsize}{}


\newenvironment{larger} % Scale all fonts up one notch
   {\let\tiny = \scriptsize%
    \let\scriptsize = \footnotesize%
    \let\footnotesize = \small%
    \let\small = \normalsize%
    \let\normalsize = \large%
    \let\large = \Large%
    \let\Large = \LARGE%
    \let\LARGE = \huge%
    \let\huge = \Huge%
    \get@currsize
    \set@currsize}{}
%>>>


%	7-pt normal	
\DeclareOption{7pt}{%<<<
    \renewcommand{\tiny}	{\fontsize{3.5pt}{4.0pt}\selectfont}
    \renewcommand{\scriptsize}	{\fontsize{4pt}{4.5pt} \selectfont}
    \renewcommand{\footnotesize}{\fontsize{5pt}{5.5pt} \selectfont}
    \renewcommand{\small}	{\fontsize{6pt}{6.6pt} \selectfont}
    \renewcommand{\normalsize}	{\fontsize{7pt}{7.7pt} \selectfont}
    \renewcommand{\large}	{\fontsize{8pt} {9pt}  \selectfont}
    \renewcommand{\Large}	{\fontsize{9pt}{10pt}  \selectfont}
    \renewcommand{\LARGE}	{\fontsize{10pt}{11pt} \selectfont}
    \renewcommand{\huge}	{\fontsize{11pt}{12pt} \selectfont}
    \renewcommand{\Huge}	{\fontsize{12pt}{14pt} \selectfont}

    \newcommand{\set@currsize}{%
	\ifcase\count255
	    \or 	%  1 pt
	    \or 	%  2 pt
	    \or 	%  3 pt
	    \or \scriptsize	%  4 pt
	    \or \footnotesize	%  5 pt
	    \or \small		%  6 pt
	    \or \normalsize	%  7 pt
	    \or \large	%  8 pt
	    \or \Large	%  9 pt
	    \or \LARGE	% 10 pt
	    \or \huge	% 11 pt
	    \or \Huge	% 12 pt
	    \else \normalsize
	\fi}
}%>>>>
%	8-pt normal	(sizes from MemMan; leading = size + 10 %)
\DeclareOption{8pt}{%<<<
    \renewcommand{\tiny}	{\fontsize{4pt}{4.5pt} \selectfont}
    \renewcommand{\scriptsize}	{\fontsize{5pt}{5.5pt} \selectfont}
    \renewcommand{\footnotesize}{\fontsize{6pt}{6.6pt} \selectfont}
    \renewcommand{\small}	{\fontsize{7pt}{7.7pt} \selectfont}
    \renewcommand{\normalsize}	{\fontsize{8pt} {9pt}  \selectfont}
    \renewcommand{\large}	{\fontsize{9pt}{10pt}  \selectfont}
    \renewcommand{\Large}	{\fontsize{10pt}{11pt} \selectfont}
    \renewcommand{\LARGE}	{\fontsize{11pt}{12pt} \selectfont}
    \renewcommand{\huge}	{\fontsize{12pt}{14pt} \selectfont}
    \renewcommand{\Huge}	{\fontsize{14pt}{16pt} \selectfont}

    \newcommand{\set@currsize}{%
	\ifcase\count255
	    \or 	%  1 pt
	    \or 	%  2 pt
	    \or 	%  3 pt
	    \or \tiny		%  4 pt
	    \or \scriptsize	%  5 pt
	    \or \footnotesize	%  6 pt
	    \or \small		%  7 pt
	    \or \normalsize	%  8 pt
	    \or \large	%  9 pt
	    \or \Large	% 10 pt
	    \or \LARGE	% 11 pt
	    \or \huge	% 12 pt
	    \or \Huge 	% 13 pt
	    \or \Huge	% 14 pt
	    \else \normalsize
	\fi}
}%>>>
%	9-pt normal	(sizes from MemMan; leading = size + 10 %)
\DeclareOption{9pt}{%<<<
    \renewcommand{\tiny}	{\fontsize{5pt}{5.5pt} \selectfont}
    \renewcommand{\scriptsize}	{\fontsize{6pt}{6.6pt} \selectfont}
    \renewcommand{\footnotesize}{\fontsize{7pt}{7.7pt} \selectfont}
    \renewcommand{\small}	{\fontsize{8pt} {9pt}  \selectfont}
    \renewcommand{\normalsize}	{\fontsize{9pt} {10pt} \selectfont}
    \renewcommand{\large}	{\fontsize{10pt}{11pt} \selectfont}
    \renewcommand{\Large}	{\fontsize{11pt}{12pt} \selectfont}
    \renewcommand{\LARGE}	{\fontsize{12pt}{14pt} \selectfont}
    \renewcommand{\huge}	{\fontsize{14pt}{16pt} \selectfont}
    \renewcommand{\Huge}	{\fontsize{17pt}{20pt} \selectfont}

    \newcommand{\set@currsize}{%
	\ifcase\count255
	    \or 	%  1 pt
	    \or 	%  2 pt
	    \or 	%  3 pt
	    \or 	%  4 pt
	    \or \tiny		%  5 pt
	    \or \scriptsize	%  6 pt
	    \or \footnotesize	%  7 pt
	    \or \small		%  8 pt
	    \or \normalsize	%  9 pt
	    \or \large	% 10 pt
	    \or \Large	% 11 pt
	    \or \LARGE	% 12 pt
	    \or \LARGE	% 13 pt
	    \or \huge	% 14 pt
	    \or \huge	% 15 pt
	    \or \Huge	% 16 pt
	    \or \Huge	% 17 pt
	    \else \normalsize
	\fi}
}%>>>
%	10-pt normal	
\DeclareOption{10pt}{%<<<
    \newcommand{\set@currsize}{%
	\ifcase\count255
	    \or 	%  1 pt
	    \or 	%  2 pt
	    \or 	%  3 pt
	    \or \tiny	 	%  4 pt
	    \or \tiny	 	%  5 pt
	    \or \scriptsize	%  6 pt
	    \or \scriptsize	%  7 pt
	    \or \footnotesize	%  8 pt
	    \or \small		%  9 pt
	    \or \normalsize	% 10 pt
	    \or \normalsize	% 11 pt
	    \or \large	% 12 pt
	    \or \large	% 13 pt
	    \or \Large	% 14 pt
	    \or \Large	% 15 pt
	    \or \LARGE	% 16 pt
	    \or \LARGE	% 17 pt
	    \or \LARGE	% 18 pt
	    \or \huge	% 19 pt
	    \or \huge	% 20 pt
	    \or \huge	% 21 pt
	    \or \huge	% 22 pt
	    \or \huge	% 23 pt
	    \or \Huge	% 24 pt
	    \or \Huge	% 25 pt
	    \or \Huge	% 26 pt
	    \else \normalsize
	\fi}
}%>>>>
%	11-pt normal	
\DeclareOption{11pt}{%<<<
    \newcommand{\set@currsize}{%
	\ifcase\count255
	    \or 	%  1 pt
	    \or 	%  2 pt
	    \or 	%  3 pt
	    \or 	%  4 pt
	    \or 	%  5 pt
	    \or \tiny	%  6 pt
	    \or \tiny	%  7 pt
	    \or \scriptsize	%  8 pt
	    \or \footnotesize	%  9 pt
	    \or \small		% 10 pt
	    \or \normalsize	% 11 pt
	    \or \large	% 12 pt
	    \or \Large	% 13 pt
	    \or \Large	% 14 pt
	    \or \Large	% 15 pt
	    \or \LARGE	% 16 pt
	    \or \LARGE	% 17 pt
	    \or \LARGE	% 18 pt
	    \or \huge	% 19 pt
	    \or \huge	% 20 pt
	    \or \huge	% 21 pt
	    \or \huge	% 22 pt
	    \or \huge	% 23 pt
	    \or \Huge	% 24 pt
	    \or \Huge	% 25 pt
	    \else \normalsize
	\fi}
}%>>>>
%	12-pt normal	
\DeclareOption{12pt}{%<<<
    \newcommand{\set@currsize}{%
	\ifcase\count255
	    \or 	%  1 pt
	    \or 	%  2 pt
	    \or 	%  3 pt
	    \or 	%  4 pt
	    \or 	%  5 pt
	    \or \tiny	%  6 pt
	    \or \tiny	%  7 pt
	    \or \scriptsize	%  8 pt
	    \or \scriptsize	%  9 pt
	    \or \footnotesize	% 10 pt
	    \or \small		% 11 pt
	    \or \normalsize	% 12 pt
	    \or \normalsize	% 13 pt
	    \or \large	% 14 pt
	    \or \large	% 15 pt
	    \or \large	% 16 pt
	    \or \Large	% 17 pt
	    \or \Large	% 18 pt
	    \or \LARGE	% 19 pt
	    \or \LARGE	% 20 pt
	    \or \LARGE	% 21 pt
	    \or \LARGE	% 22 pt
	    \or \LARGE	% 23 pt
	    \or \huge	% 24 pt
	    \or \huge	% 25 pt
	    \or \huge	% 26 pt
	    \or \huge	% 26 pt
	    \or \Huge	% 26 pt
	    \or \Huge	% 26 pt
	    \or \Huge	% 26 pt
	    \else \normalsize
	\fi}
}%>>>>
%	14-pt normal	(sizes from MemMan; leading = size + 10 %)
\DeclareOption{14pt}{%<<<
    \renewcommand{\tiny}	{\fontsize{9pt} {10pt} \selectfont}
    \renewcommand{\scriptsize}	{\fontsize{10pt}{11pt} \selectfont}
    \renewcommand{\footnotesize}{\fontsize{11pt}{12pt} \selectfont}
    \renewcommand{\small}	{\fontsize{12pt}{14pt} \selectfont}
    \renewcommand{\normalsize}	{\fontsize{14pt}{16pt} \selectfont}
    \renewcommand{\large}	{\fontsize{17pt}{20pt} \selectfont}
    \renewcommand{\Large}	{\fontsize{20pt}{22pt} \selectfont}
    \renewcommand{\LARGE}	{\fontsize{25pt}{28pt} \selectfont}
    \renewcommand{\huge}	{\fontsize{30pt}{33pt} \selectfont}
    \renewcommand{\Huge}	{\fontsize{36pt}{40pt} \selectfont}

    \newcommand{\set@currsize}{%
	\ifcase\count255
	    \or 	%  1 pt
	    \or 	%  2 pt
	    \or 	%  3 pt
	    \or 	%  4 pt
	    \or 	%  5 pt
	    \or 	%  6 pt
	    \or 	%  7 pt
	    \or \tiny	%  8 pt
	    \or \tiny	%  9 pt
	    \or \scriptsize	% 10 pt
	    \or \footnotesize	% 11 pt
	    \or \small		% 12 pt
	    \or \small		% 13 pt
	    \or \normalsize	% 14 pt
	    \or \normalsize	% 15 pt
	    \or \large	% 16 pt
	    \or \large	% 17 pt
	    \or \Large	% 18 pt
	    \or \Large	% 19 pt
	    \or \Large	% 20 pt
	    \or \Large	% 21 pt
	    \or \Large	% 22 pt
	    \or \Large	% 23 pt
	    \or \LARGE	% 24 pt
	    \or \LARGE	% 25 pt
	    \or \LARGE	% 26 pt
	    \or \LARGE	% 27 pt
	    \or \huge	% 28 pt
	    \or \huge	% 29 pt
	    \or \huge	% 30 pt
	    \or \huge	% 31 pt
	    \or \huge	% 32 pt
	    \or \huge	% 33 pt
	    \or \Huge	% 34 pt
	    \or \Huge	% 35 pt
	    \or \Huge	% 36 pt
	    \or \Huge	% 37 pt
	    \else \normalsize
	\fi}
}%>>>

\ProcessOptions

%	implicit 10-point option	
%	    (on chance that size not specified in \documenclass declaration)
\@ifundefined{set@currsize}{%<<<
    \newcommand{\set@currsize}{%
	\ifcase\count255
	    \or 	%  1 pt
	    \or 	%  2 pt
	    \or 	%  3 pt
	    \or \tiny	 	%  4 pt
	    \or \tiny	 	%  5 pt
	    \or \scriptsize	%  6 pt
	    \or \scriptsize	%  7 pt
	    \or \footnotesize	%  8 pt
	    \or \small		%  9 pt
	    \or \normalsize	% 10 pt
	    \or \normalsize	% 11 pt
	    \or \large	% 12 pt
	    \or \large	% 13 pt
	    \or \Large	% 14 pt
	    \or \Large	% 15 pt
	    \or \LARGE	% 16 pt
	    \or \LARGE	% 17 pt
	    \or \LARGE	% 18 pt
	    \or \huge	% 19 pt
	    \or \huge	% 20 pt
	    \or \huge	% 21 pt
	    \or \huge	% 22 pt
	    \or \huge	% 23 pt
	    \or \Huge	% 24 pt
	    \or \Huge	% 25 pt
	    \or \Huge	% 26 pt
	    \else \normalsize
	\fi%
    }%
}%>>>>

% Version History:
%
% 2017/06/26  v3.1 
%	bug-fix: "larger" and "smaller" no longer bomb if font-size not
%	specified in \documentclass declaration.
%
%[2016/03/20  v3.0 Non-Standard font-sizes (H.A.Trujillo)]
%	"larger" and "smaller" environments now respect the current font-size,
%	rather than reverting to \normalsize.
%
%[2014/05/22  v2.0 Non-Standard font-sizes (H.A.Trujillo)]
%	"larger" and "smaller" environments added.
%
%[2011/06/26  v1.0 Non-Standard font-sizes (H.A.Trujillo)]


%  	vim: foldmethod=marker foldmarker=<<<,>>>
