%        File: PhotoGrid.ltx
%     Created: Mon May 04 09:00 PM 2015 E
% Last Change:     11 May 2015
%
\documentclass[10pt]{article}						%<<<1
% packages                                                              %<<<2

\usepackage[landscape]{geometry}
  \geometry{margin=1in, bottom=0.05in}
\usepackage{longtable}
\usepackage{graphicx}

% Formatting Settings & Initialization                                  %<<<2

\count255=0		       % Size of final document:   0=11x17  1=legal  2=letter
\chardef\Ncols=7				% number of columns
\renewcommand{\arraystretch}{3} 		% vert. gap between cells
\chardef\gapfactor=30				% horiz gap   (small value = big gap)
\tabcolsep=0pt				
\newcount\col		\col=1
\parindent=0pt
\pagestyle{empty}

\ifcase\count255
    % settings for 11x17 paper
	\geometry{paperheight=17in,paperwidth=11in}
	\newcommand{\Tfmt}	{\Huge}		% format for title
	\newcommand{\fmti}  	{\large}	% format for name
	\newcommand{\fmtii} 	{\small}	% format for town
	\newcommand{\fmtiii}	{}		% format for major/year
	\linespread{0.95}			% caption linespacing
    \or
    % settings for legal paper
	\geometry{legalpaper}
	\newcommand{\Tfmt}	{\Huge}
	\newcommand{\fmti}  	{}
	\newcommand{\fmtii} 	{\footnotesize}
	\newcommand{\fmtiii}	{\small}
	\linespread{0.9}
    \or
    % settings for letter paper
	\geometry{letterpaper}
	\newcommand{\Tfmt}	{\huge}
	\newcommand{\fmti}  	{\small}
	\newcommand{\fmtii} 	{\scriptsize}	
	\newcommand{\fmtiii}	{\footnotesize}
	\linespread{0.75}
    \fi

% Calculate size of pictures                                            %<<<2
%					gap = TW / gapfactor
%  					cellwidth = [TW - (Ncols-1)·(gap)] / Ncols
\makeatletter 
  \dimen0=\textwidth				% "corrected" textwidth
    \advance\dimen0 -\Gm@rmargin

  \newdimen\cellgap				% gap between photos
    \cellgap=\dimen0
    \divide\cellgap \gapfactor

  \newdimen\cellwidth				% width of photos
    \cellwidth=\dimen0
    \count255=\Ncols
    \advance\count255 -1
    \advance\cellwidth -\count255\cellgap
    \divide\cellwidth \Ncols
\makeatother


% New Commands                                                           %<<<2
\newcommand{\tab}{&}

\newcommand{\student} [5] {% 	Read in record for each student
  {\centering
    \fbox{\includegraphics[width=\cellwidth]{#5}}\par\kern 0.75ex% pict
    \textbf{\fmti #1}\par% name
    {\fmtii #2}\par% town
    {\fmtiii \uppercase{#3}, #4}\par% major, year
  }
  \ifnum \col = \Ncols
    \\
    \global\col=1
  \else
    \tab
    \global\advance\col 1
  \fi
}
%>>>1

\begin{document}
\newcommand{\AcadYr} {2015/16}

%<<<
\centering
{\bfseries\Tfmt Chemistry and Biochemistry Majors --- \AcadYr}
\vspace{7mm}

\dimen0=\cellwidth
\advance\dimen0 \cellgap

%>>>
% Importing photos:
% 	click rosters-photo to open ("size=orig"), then save image
% 			(better quality than saving linked file from student-page)

% Verifying names:
% 	single name:	id `pbpaste | cut -f2 -d\{ | cut -f1 -d\} | tr \  .`
%	whole list:	pipe this file into
%{}		awk 'BEGIN{FS="\{|\}"}; /\\student\{/{sub(/ /,".",$2); print $2}' | 
%			xargs -n1 id | grep "no such"

% Sorting:
% 	by name:	sort -k4 -t' '
%	by class:	sort -k5,5 -r -s -t\{	then manually move Jr before So
%	by major:	sort -k6,6 -t\{


\begin{longtable}{*{\Ncols}{p{\dimen0}}}
% \student{First Lastname}  {Town, PA}  {major}  {Fr|So|Jr|Sr} {picture filename}
%
  \student{Brittany Clem}	{Lewes, DE}		{CHM}	{Sr}	{Clem}
  \student{Mich\ae l McCleaf}	{Farifield, PA}		{CHM}	{Sr}	{McCleaf}
  \student{Khushali Parikh}	{Kingston, PA}		{CHM}	{Sr}	{Parikh}
  \student{Krista Rehrig}	{Lehighton, PA}		{CHM}	{Sr}	{Rehrig}
  \student{Travis Weaver}	{Cogan Station, PA}	{bioc}	{Sr}	{Weaver}
  \student{Krista Boyer}	{Montoursville, PA}	{bioc}	{Jr}	{Boyer}
  \student{Jarret Colvin}	{Stroudsburg, PA}	{CHM}	{Jr}	{Colvin}
  \student{Emily Gruver}	{Wilkes-Barre, PA}	{CHM}	{Jr}	{Gruver}
  \student{Sarah Hankey}	{Tamaqua, PA}		{bioc}	{Jr}	{Hankey}
  \student{Rach\ae l Hohol}	{Wilkes-Barre, PA}	{CHM}	{Jr}	{Hohol}
  \student{David Hontz}		{White Haven, PA}	{bioc}	{Jr}	{smile}
  \student{Jared Luchetta}	{Tresckow, PA}		{bioc}	{Jr}	{Luchetta}
  \student{Oscar Rodriguez}	{Easton, PA}		{CHM}	{Jr}	{Rodriguez}
  \student{Alisha Black}	{Sunbury, PA}		{CHM}	{So}	{Black}
  \student{Thatcher David}	{Lehighton, PA}		{BIOC}	{So}	{David}
  \student{Briana DeLong}	{Temple, PA}		{bioc}	{So}	{DeLong}
  \student{Amber Ferry}		{Drums, PA}		{CHM}	{So}	{Ferry}
  \student{Brendan Fritz}	{Easton, PA}		{CHM}	{So}	{Fritz}
  \student{Justin Larsen}	{Blairstown, NJ}	{bioc}	{So}	{Larsen}
  \student{Alexander Miner}	{Gilbertsville, PA}	{bioc}	{So}	{Miner}
  \student{Benjamin Sharp}	{Yardley, PA}		{CHM}	{So}	{Sharp}
  \student{Kenneth Werkheiser}	{Bear Creek Twp, PA}	{bioc}	{So}	{Werkheiser}
  \student{Alexandria Aspey}	{Dover, PA}		{BIOC}	{Fr}	{smile}
  \student{Morgan Balliet}	{Bowmanstown, PA}	{CHM}	{Fr}	{smile}
  \student{Dillon Davis}	{Curwensville, PA}	{BIOC}	{Fr}	{smile}
  \student{Dionna DeFazio}	{Taylor, PA}		{bioc}	{Fr}	{smile}
  \student{Zachary Faust}	{Wilkes-Barre, PA}	{CHM}	{Fr}	{smile}
  \student{Madeline Frank}	{Phillipsburg, NJ}	{CHM}	{Fr}	{smile}
  \student{Maddison Lawrence}	{Mahanoy City, PA}	{bioc}	{Fr}	{smile}
  \student{Kelly McGraw}	{Wilkes-Barre, PA}	{CHM}	{Fr}	{smile}
  \student{Jordan McKeaige}	{Hanover Township, PA}	{bioc}	{Fr}	{smile}
  \student{Isaiah Pinkerton}	{Manheim, PA}		{CHM}	{Fr}	{smile}
  \student{Jasmine Quintana}	{Scranton, PA}		{bioc}	{Fr}	{smile}
  \student{Tyler Sipple}	{Zion Grove, PA}	{bioc}	{Fr}	{smile}
  \student{Kyle Snyder-Strawser}	{Sunbury, PA}	{bioc}	{Fr}	{smile}
  \student{Hannah Thornton}	{Mountain Top, PA}	{bioc}	{Fr}	{smile}
  \student{Jordan Vasarkovy}	{Toms River, NJ} 	{bioc}	{Fr}	{smile}
  %
\end{longtable}


\par
\end{document}

\includegraphics{smile}	% clue lview in to jpg/pdf-graphics

%			vim: sw=2 tw=0 ft=TexNoPlugin fmr=<<<,>>> fdm=marker
