Created
May 14, 2014 15:59
-
-
Save scmbradley/832bb693fd899b43b44a to your computer and use it in GitHub Desktop.
This is a sort-of-working version of a LaTeX class I'm working on for typesetting conference programmes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% conference.cls | |
%% Copyright 2014 Seamus Bradley | |
% | |
% This work may be distributed and/or modified under the | |
% conditions of the LaTeX Project Public License, either version 1.3 | |
% of this license or (at your option) any later version. | |
% The latest version of this license is in | |
% http://www.latex-project.org/lppl.txt | |
% and version 1.3 or later is part of all distributions of LaTeX | |
% version 2005/12/01 or later. | |
% | |
% This work has the LPPL maintenance status `author-maintained'. | |
% | |
% The Current Maintainer of this work is Seamus Bradley | |
% tex@seamusbradley.net | |
% | |
% This work consists of the files conference.cls | |
% and README. | |
\RequirePackage{expl3} | |
\ProvidesExplClass{conference}{2013/05/13}{0.2}{Conference Schedule Class} | |
\LoadClass[fontsize=11pt,]{scrartcl} | |
%\LoadClassWithOptions{article}[12pt] | |
\RequirePackage{xparse,l3sort,multirow,typearea,hyperref,tabularx,array} | |
\areaset{160mm}{270mm} | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% Title set up | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% We set up a property list that holds all the relevant information for the title block | |
\prop_new:N \g_titleblock_prop | |
% We generate some document commands that allow the user to set the parts of the title block | |
\NewDocumentCommand{\SetTitle}{m}{ | |
\prop_gput:Nnn \g_titleblock_prop {title} {#1} | |
} | |
\NewDocumentCommand{\SetInstitute}{m}{ | |
\prop_gput:Nnn \g_titleblock_prop {institute} {#1} | |
} | |
\NewDocumentCommand{\SetDates}{m}{ | |
\prop_gput:Nnn \g_titleblock_prop {dates} {#1} | |
} | |
\NewDocumentCommand{\SetWebsite}{m}{ | |
\prop_gput:Nnn \g_titleblock_prop {website} {#1} | |
} | |
\NewDocumentCommand{\SetVenue}{m}{ | |
\prop_gput:Nnn \g_titleblock_prop {venue} {#1} | |
} | |
% Finally, we define a document command to print the title block. | |
% Currently, rather crude. | |
\NewDocumentCommand{\MakeTitle}{}{ | |
\begin{center} | |
{\Large \bfseries \prop_get:Nn \g_titleblock_prop {title} }\\[1em] | |
{\large\itshape \prop_get:Nn \g_titleblock_prop {institute} }\\[1em] | |
{\url{\prop_get:Nn \g_titleblock_prop {website} }}\\[1em] | |
{\itshape \prop_get:Nn \g_titleblock_prop {venue} } | |
\end{center} | |
} | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% Setup | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% We setup a sequence that holds the sort names (defined by the first option of the \AddTalk macro). | |
% We also need a variable that holds the current date. | |
\seq_new:N \g_names_seq | |
\tl_new:N \l_thedate_tl | |
\tl_new:N \l_tmpnote_tl | |
\tl_new:N \l_thetime_tl | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% The AddTalk macro | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% Time, Name, Title | |
% Sort, Name, Title, Abstract | |
\NewDocumentCommand{\AddTalk}{mmm+m o}{ | |
\prop_new:c {g_#1_prop} | |
\prop_gput:cnn {g_#1_prop} {name} {#2} | |
\prop_gput:cnn {g_#1_prop} {title} {#3} | |
\prop_gput:cnn {g_#1_prop} {abstract} {#4} | |
\seq_gput_right:Nn \g_names_seq {#1} | |
\IfNoValueTF{#5}{ | |
}{ | |
\prop_gput:cnn {g_#1_prop} {note} {#5} | |
} | |
} | |
% \NewDocumentCommand{\ConferenceBreak}{mm}{ | |
% && \\ | |
% \emph{#1} & | |
% \multicolumn{2}{c}{ | |
% \textbf{#2}\hspace*{5em} | |
% } | |
% \\ | |
% &&\\ | |
% } | |
% | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% Timing | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
\int_new:N \l_timing_tmp_hour | |
\int_new:N \l_timing_tmp_min | |
\int_new:N \l_timing_tmp_min_inc | |
\int_new:N \l_timing_tmp_hour_inc | |
\tl_new:N \l_timing_tmp_return | |
\prop_new:N \timing_mytime | |
\cs_new:Npn \timing_new_time:n #1 { | |
\prop_new:c {timing_#1_time} | |
\prop_gput:cnn {timing_#1_time}{hour}{0} | |
\prop_gput:cnn {timing_#1_time}{minute}{0} | |
} | |
\cs_new:Npn \timing_set_time:nnn #1#2#3 { | |
\prop_gput:cnn {timing_#1_time}{hour}{#2} | |
\prop_gput:cnn {timing_#1_time}{minute}{#3} | |
} | |
\cs_new:Npn \timing_return_time:n #1 { | |
\tl_set:Nx \l_timing_tmp_return { | |
\int_compare:nNnTF {\prop_get:cn{timing_#1_time}{hour}} < {10} {0}{} | |
\prop_get:cn {timing_#1_time}{hour}: | |
\int_compare:nNnTF {\prop_get:cn{timing_#1_time}{minute}} < {10} {0}{} | |
\prop_get:cn {timing_#1_time}{minute} | |
} | |
% \tl_show:N \l_timing_tmp_return | |
\l_timing_tmp_return | |
} | |
\cs_new:Npn \timing_add_time:nn #1#2{ | |
\int_set_eq:NN \l_timing_tmp_hour \prop_get:cn{timing_#1_time}{hour} | |
\int_set_eq:NN \l_timing_tmp_min \prop_get:cn{timing_#1_time}{minute} | |
\int_set:Nn \l_timing_tmp_hour_inc {\int_div_truncate:nn {\l_timing_tmp_min + #2}{60}} | |
\int_set:Nn \l_timing_tmp_min_inc {\int_mod:nn {\l_timing_tmp_min +#2}{60}} | |
\int_set:Nn \l_tmpa_int {\int_eval:n {\l_timing_tmp_hour + \l_timing_tmp_hour_inc}} | |
\prop_gput:cnV{timing_#1_time} {hour} \l_tmpa_int | |
\int_set:Nn \l_tmpa_int { \int_eval:n {\l_timing_tmp_min_inc} } | |
\prop_gput:cnV{timing_#1_time} {minute} \l_tmpa_int | |
} | |
\cs_new_protected:Npn \timing_store_time:nn #1#2 { | |
% name, increment | |
\tl_gset:Nn \l_thetime_tl { | |
\timing_return_time:n{conf} -- | |
\timing_add_time:nn{conf}{#2} | |
\timing_return_time:n{conf} | |
} | |
\prop_gput:cnV {g_#1_prop} {time} {\l_thetime_tl} | |
} | |
\NewDocumentCommand{\NewTime}{m}{ | |
\timing_new_time:n{#1} | |
} | |
\NewDocumentCommand{\SetTime}{mmm}{ | |
\timing_set_time:nnn{#1}{#2}{#3} | |
} | |
\NewDocumentCommand{\PrintTime}{m}{ | |
\timing_return_time:n{#1} | |
} | |
\NewDocumentCommand{\AddTime}{mm}{ | |
\timing_add_time:nn {#1}{#2} | |
} | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% The Day environment | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
\setlength\extrarowheight{0.4em} | |
\NewTime{conf} | |
\NewDocumentEnvironment{Day}{mmm}{ | |
% Parameters: Date, Start hour, Start minute | |
\tl_set:Nn \l_thedate_tl {#1} | |
\SetTime{conf}{#2}{#3} | |
\begin{center} | |
\textbf{#1} | |
\end{center} | |
\begin{tabular}{l>{\raggedright}p{18em}p{20em}} | |
}{ | |
\end{tabular} | |
} | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% The UseTalk command | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% \NewDocumentCommand{\PrintTalk}{mmmm}{ | |
% \emph{#1} & \textbf{#2} & #3 \\ | |
% } | |
\NewDocumentCommand{\UseTalk}{mm}{ | |
\prop_gput:cnV {g_#1_prop} {date} {\l_thedate_tl} | |
\timing_store_time:nn{g_#1_prop}{#2} | |
% \tl_set:Nn \l_thetime_tl { | |
% \timing_return_time:n{conf} -- | |
% \timing_add_time:nn{conf}{#2} | |
% \timing_return_time:n{conf} | |
% } | |
% \prop_gput:cnV {g_#1_prop} {time} {\l_thetime_tl} | |
\prop_show:c {g_#1_prop} | |
\emph{\l_thetime_tl} & \textbf{\prop_get:cn {g_#1_prop}{name}} & \prop_get:cn{g_#1_prop}{title} \\ | |
} | |
\NewDocumentCommand{\ConferenceBreak}{mm}{ | |
&& \\ | |
\tl_set:Nn \l_thetime_tl { | |
\timing_return_time:n{conf} -- | |
\timing_add_time:nn{conf}{#2} | |
\timing_return_time:n{conf} | |
} | |
\emph{\l_thetime_tl} & | |
\multicolumn{2}{c}{ | |
\textbf{#1}\hspace*{5em} | |
} | |
\\ | |
&&\\ | |
} | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% The PrintAbstract command | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
\NewDocumentCommand{\PrintAbstract}{m}{ | |
\hspace{-2em} | |
\textbf{\prop_get:cn {g_#1_prop} {title}},~ | |
\emph{\prop_get:cn {g_#1_prop} {name}},~ | |
\prop_get:cn {g_#1_prop} {date},~ | |
\prop_get:cn {g_#1_prop} {time}.~ | |
\prop_get:cnNTF {g_#1_prop} {note} \l_tmpa_tl {\emph{[\tl_use:N \l_tmpa_tl]}.~}{} | |
\prop_get:cn {g_#1_prop} {abstract}\\[1em]\par | |
} | |
\NewDocumentCommand{\ListAbstracts}{}{ | |
\begin{center} | |
\textbf{Abstracts} | |
\end{center} | |
\setlength\parindent{0pt} | |
\seq_map_inline:Nn \g_names_seq {\PrintAbstract{##1}} | |
} | |
%%%%%%%%% Testfile: | |
% \documentclass{conference} | |
% \begin{document} | |
% \AddTalk{foo}{Name foo}{Title foo}{Abstract foo} | |
% \AddTalk{bar}{Name bar}{Title bar}{Abstract bar} | |
% \begin{Day}{14 May}{9}{30} | |
% \UseTalk{foo}{45} | |
% \UseTalk{bar}{45} | |
% \end{Day} | |
% \ListAbstracts | |
% \end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment