Skip to content

Commit

Permalink
max line width of 80 chars
Browse files Browse the repository at this point in the history
  • Loading branch information
kopeckyf committed Feb 17, 2021
1 parent 2e23376 commit 6cce048
Showing 1 changed file with 123 additions and 55 deletions.
178 changes: 123 additions & 55 deletions langsci-affiliations.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ Please report any bugs or feature requests to
% \begin{macrocode}
\RequirePackage{xparse}
\ProvidesExplPackage {langsci-affiliations}
{2021-02-03} {1.0.0}
{A LaTeX3 package to collect and order authors and their affiliations}
{2021-02-17} {1.0.0}
{A LaTeX3 package to collect and order authors and affiliations}


\NewDocumentCommand{\ResolveAffiliations}{ O{} +m }
Expand All @@ -184,28 +184,50 @@ Please report any bugs or feature requests to

\keys_define:nn { affiliations }
{
mark~style .tl_set:N = \l__affiliations_style_tl,
mark~style .initial:n = { alphabetic },
output~affiliation .bool_set:N = \l__affiliations_output_affiliation_bool,
output~affiliation .initial:n = { true },
output~in~groups .bool_set:N = \l__affiliations_output_grouped_bool,
output~in~groups .initial:n = { true },
separator~between~two .tl_set:N = \l__affiliations_separator_between_two_tl,
separator~between~two .initial:n = {~\&~},
separator~between~multiple .tl_set:N = \l__affiliations_separator_between_mult_tl,
separator~between~multiple .initial:n = {,~},
separator~between~final~two .tl_set:N = \l__affiliations_separator_between_last_two_tl,
separator~between~final~two .initial:n = {~\&~},
separator~between~affiliations .tl_set:N = \l__affiliations_afil_separator_tl,
separator~between~affiliations .initial:n = {,},
output~authors~font .cs_set:Np = \__affiliations_output_authors_font:,
output~authors~font .initial:n = {\Large},
output~affiliation~font .cs_set:Np = \__affiliations_output_affiliation_font:,
output~affiliation~font .initial:n = {\normalsize},
input~names~separator .tl_set:N = \l__affiliations_input_names_sep_tl,
input~names~separator .initial:n = {~and~},
input~affiliation~separator .tl_set:N = \l_affiliations_input_afil_sep_tl,
input~affiliation~separator .initial:n = {;}
mark~style .tl_set:N
= \l__affiliations_style_tl,
mark~style .initial:n
= { alphabetic },
output~affiliation .bool_set:N
= \l__affiliations_output_affiliation_bool,
output~affiliation .initial:n
= { true },
output~in~groups .bool_set:N
= \l__affiliations_output_grouped_bool,
output~in~groups .initial:n
= { true },
separator~between~two .tl_set:N
= \l__affiliations_separator_between_two_tl,
separator~between~two .initial:n
= {~\&~},
separator~between~multiple .tl_set:N
= \l__affiliations_separator_between_mult_tl,
separator~between~multiple .initial:n
= {,~},
separator~between~final~two .tl_set:N
= \l__affiliations_separator_between_last_two_tl,
separator~between~final~two .initial:n
= {~\&~},
separator~between~affiliations .tl_set:N
= \l__affiliations_afil_separator_tl,
separator~between~affiliations .initial:n
= {,},
output~authors~font .cs_set:Np
= \__affiliations_output_authors_font:,
output~authors~font .initial:n
= {\Large},
output~affiliation~font .cs_set:Np
= \__affiliations_output_affiliation_font:,
output~affiliation~font .initial:n
= {\normalsize},
input~names~separator .tl_set:N
= \l__affiliations_input_names_sep_tl,
input~names~separator .initial:n
= {~and~},
input~affiliation~separator .tl_set:N
= \l_affiliations_input_afil_sep_tl,
input~affiliation~separator .initial:n
= {;}
}

\cs_generate_variant:Nn \prop_put:Nnn { Nxx }
Expand All @@ -224,10 +246,11 @@ Please report any bugs or feature requests to

\prop_const_from_keyval:Nn \l__affiliations_icons_prop
{
0 = \char"2460, 1 = \char"2461, 2 = \char"2462, 3 = \char"2463, 4 = \char"2464,
5 = \char"2465, 6 = \char"2466, 7 = \char"2467, 8 = \char"2468, 9 = \char"2469,
10 = \char"246A, 11 = \char"246B, 12 = \char"246C, 13 = \char"246D, 14 = \char"246E,
15 = \char"246F, 16 = \char"2470, 17 = \char"2471, 18 = \char"2472, 19 = \char"2473
0 = \char"2460, 1 = \char"2461, 2 = \char"2462, 3 = \char"2463,
4 = \char"2464, 5 = \char"2465, 6 = \char"2466, 7 = \char"2467,
8 = \char"2468, 9 = \char"2469, 10 = \char"246A, 11 = \char"246B,
12 = \char"246C, 13 = \char"246D, 14 = \char"246E, 15 = \char"246F,
16 = \char"2470, 17 = \char"2471, 18 = \char"2472, 19 = \char"2473
}

\prop_new:N \l__affiliations_output_prop
Expand All @@ -241,12 +264,17 @@ Please report any bugs or feature requests to
\prop_put:Nnn \l__affiliations_output_prop {#1} {}
}
{
\seq_set_split:NVn \l__affiliations_tmpa_seq \l_affiliations_input_afil_sep_tl { #2 }
\seq_set_split:NVn \l__affiliations_tmpa_seq
\l_affiliations_input_afil_sep_tl
{ #2 }
\seq_map_inline:Nn \l__affiliations_tmpa_seq
{
\prop_get:NnNTF \l__affiliations_affiliations_prop {##1} \l__affiliations_tmpa_tl
\prop_get:NnNTF \l__affiliations_affiliations_prop
{##1}
\l__affiliations_tmpa_tl
{
\clist_put_right:NV \l__affiliations_tmpa_clist \l__affiliations_tmpa_tl
\clist_put_right:NV \l__affiliations_tmpa_clist
\l__affiliations_tmpa_tl
}
{
%Not yet present
Expand All @@ -258,7 +286,9 @@ Please report any bugs or feature requests to
{ \prop_count:N \l__affiliations_affiliations_prop }
}
}
\prop_put:NnV \l__affiliations_output_prop {#1} \l__affiliations_tmpa_clist
\prop_put:NnV \l__affiliations_output_prop
{#1}
\l__affiliations_tmpa_clist
}
}

Expand All @@ -269,10 +299,20 @@ Please report any bugs or feature requests to
\int_set:Nn \l__affiliations_tmpa_int { ##2 }
\str_case_e:nn { \l__affiliations_style_tl }
{
{alphabetic} { \textsuperscript{\int_to_alph:n{ \int_eval:n {\l__affiliations_tmpa_int + 1} } } }
{numeric} { \textsuperscript{\int_eval:n {\l__affiliations_tmpa_int + 1} } }
{circled} { \prop_item:Nn \l__affiliations_icons_prop {\l__affiliations_tmpa_int} }
{none} { }
{alphabetic}
{
\textsuperscript{\int_to_alph:n{ \int_eval:n
{ \l__affiliations_tmpa_int + 1 }
} }
}
{numeric}
{ \textsuperscript{\int_eval:n {\l__affiliations_tmpa_int + 1} } }
{circled}
{
\prop_item:Nn \l__affiliations_icons_prop
{\l__affiliations_tmpa_int}
}
{none} { }
}
##1 ~
}
Expand All @@ -283,10 +323,23 @@ Please report any bugs or feature requests to
\int_set:Nn \l__affiliations_tmpa_int { #1 }
\str_case_e:nn { \l__affiliations_style_tl }
{
{alphabetic} { \seq_put_right:Nx \l__affiliations_tmpb_seq { \int_to_alph:n{ \int_eval:n {#1 + 1} } } }
{numeric} { \seq_put_right:Nx \l__affiliations_tmpb_seq { \int_eval:n {\l__affiliations_tmpa_int + 1} } }
{circled} { \seq_put_right:Nx \l__affiliations_tmpb_seq { \prop_item:Nn \l__affiliations_icons_prop { \l__affiliations_tmpa_int} } }
{none} { }
{alphabetic}
{
\seq_put_right:Nx \l__affiliations_tmpb_seq
{ \int_to_alph:n{ \int_eval:n {#1 + 1} } }
}
{numeric}
{
\seq_put_right:Nx \l__affiliations_tmpb_seq
{ \int_eval:n {\l__affiliations_tmpa_int + 1} }
}
{circled}
{
\seq_put_right:Nx \l__affiliations_tmpb_seq
{ \prop_item:Nn \l__affiliations_icons_prop
{ \l__affiliations_tmpa_int} }
}
{none} { }
}
}

Expand All @@ -297,24 +350,33 @@ Please report any bugs or feature requests to
{
\seq_clear:N \l__affiliations_tmpb_seq
\clist_map_function:nN {##2} \__affiliations_return_afil_text:n
\tl_set:Nn \l__affiliations_tmpb_tl {\seq_use:Nn \l__affiliations_tmpb_seq {\l__affiliations_afil_separator_tl}}
\tl_set:Nn \l__affiliations_tmpb_tl
{
\seq_use:Nn \l__affiliations_tmpb_seq
{\l__affiliations_afil_separator_tl}
}
\seq_put_right:Nx \l__affiliations_tmpa_seq
{
\tl_rescan:nn {} {##1} \exp_not:N \textsuperscript{\tl_use:N \l__affiliations_tmpb_tl}
\tl_rescan:nn {} {##1}
\exp_not:N \textsuperscript{\tl_use:N \l__affiliations_tmpb_tl}
}
}
\seq_use:Nnnn \l__affiliations_tmpa_seq {\l__affiliations_separator_between_two_tl}
{\l__affiliations_separator_between_mult_tl}
{\l__affiliations_separator_between_last_two_tl}
\seq_use:Nnnn \l__affiliations_tmpa_seq
{\l__affiliations_separator_between_two_tl}
{\l__affiliations_separator_between_mult_tl}
{\l__affiliations_separator_between_last_two_tl}
}

\cs_new:Npn \affiliations_resolve:n #1
{
\seq_set_split:NVn \l__affiliations_names_seq \l__affiliations_input_names_sep_tl { #1 }
\seq_set_split:NVn \l__affiliations_names_seq
\l__affiliations_input_names_sep_tl
{ #1 }
\seq_map_inline:Nn \l__affiliations_names_seq
{
\seq_clear_new:N \l__affiliations_names_tmp_seq
\seq_set_split:Nnn \l__affiliations_names_tmp_seq { \affiliation } { ##1 }
\seq_set_split:Nnn \l__affiliations_names_tmp_seq { \affiliation }
{ ##1 }
\prop_put:Nxx \l__affiliations_tmpa_prop
{ \seq_item:Nn \l__affiliations_names_tmp_seq {1} }
{ \seq_item:Nn \l__affiliations_names_tmp_seq {2} }
Expand All @@ -323,12 +385,15 @@ Please report any bugs or feature requests to
{
\bool_if:NTF \l__affiliations_output_grouped_bool
{
\prop_map_function:NN \l__affiliations_tmpa_prop \__affiliations_resolve_affiliations:
\prop_map_function:NN \l__affiliations_tmpa_prop
\__affiliations_resolve_affiliations:
\group_begin:
\__affiliations_output_authors_font:\__affiliations_output_authors:
\__affiliations_output_authors_font:
\__affiliations_output_authors:
\group_end:\\[0.5ex]
\group_begin:
\__affiliations_output_affiliation_font:\__affiliations_output_affiliations:
\__affiliations_output_affiliation_font:
\__affiliations_output_affiliations:
\group_end:
}
{
Expand All @@ -337,7 +402,8 @@ Please report any bugs or feature requests to
\__affiliations_output_authors_font:
\tl_rescan:nn {} {##1}\\[0.5ex]
\group_begin:
\__affiliations_output_affiliation_font: \tl_rescan:nn {} {##2}
\__affiliations_output_affiliation_font:
\tl_rescan:nn {} {##2}
\group_end:
\medskip\\
}
Expand All @@ -349,11 +415,13 @@ Please report any bugs or feature requests to
\seq_clear:N \l__affiliations_tmpa_seq
\prop_map_inline:Nn \l__affiliations_tmpa_prop
{
\seq_put_right:Nx \l__affiliations_tmpa_seq {\tl_rescan:nn {} {##1} }
\seq_put_right:Nx \l__affiliations_tmpa_seq
{\tl_rescan:nn {} {##1} }
}
\seq_use:Nnnn \l__affiliations_tmpa_seq {\l__affiliations_separator_between_two_tl}
{\l__affiliations_separator_between_mult_tl}
{\l__affiliations_separator_between_last_two_tl}
\seq_use:Nnnn \l__affiliations_tmpa_seq
{\l__affiliations_separator_between_two_tl}
{\l__affiliations_separator_between_mult_tl}
{\l__affiliations_separator_between_last_two_tl}
\group_end:
}
}
Expand Down

0 comments on commit 6cce048

Please sign in to comment.