% -------------------------------------------------------------------------- % the ACRO package % % Typeset Acronyms % % -------------------------------------------------------------------------- % Clemens Niederberger % Web: https://bitbucket.org/cgnieder/acro/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- % Copyright 2011-2013 Clemens Niederberger % % 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 `maintained'. % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- % The acro package consists of the files % - acro.sty, acro0.def, acro1.def, acro_en.tex, acro_en.pdf, README % -------------------------------------------------------------------------- % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % -------------------------------------------------------------------------- \ProvidesFile{acro0.def} % -------------------------------------------------------------------------- % adding an acronym, internal command: % #1: use/replace plural (boolean) % #2: id % #3: short % #4: short plural % #5: alt % #6: long % #7: long plural % #8: class % #9: extra \cs_new:Npn \acro_new:nnnnnnnnn #1#2#3#4#5#6#7#8#9 { \IfBooleanTF { #1 } { \prop_put:Nnn \l__acro_replace_plural_prop { #2 } { \c_true_bool } } { \prop_put:Nnn \l__acro_replace_plural_prop { #2 } { \c_false_bool } } \prop_put:Nnn \l__acro_short_prop { #2 } { #3 } \prop_put:Nnn \l__acro_sort_prop { #2 } { #2 } \prop_put:Nnn \l__acro_pdfstring_prop { #2 } { #3 } \acro_create_page_records:n { #2 } \IfNoValueTF { #4 } { \prop_put:Nnn \l__acro_short_plural_prop { #2 } { \l__acro_default_plural_tl } \prop_put:Nnx \l__acro_pdfstring_plural_prop { #2 } { \exp_not:n { #3 } \exp_not:V \l__acro_default_plural_tl } } { \prop_put:Nnn \l__acro_short_plural_prop { #2 } { #4 } \prop_put:Nnx \l__acro_pdfstring_plural_prop { #2 } { \exp_not:n { #3 #4 } } } \IfNoValueTF { #5 } { \prop_put:Nnn \l__acro_alt_prop { #2 } { #2 } } { \prop_put:Nnn \l__acro_alt_prop { #2 } { #5 } } \prop_put:Nnn \l__acro_long_prop { #2 } { #6 } \IfNoValueTF { #7 } { \prop_put:Nnn \l__acro_long_plural_prop { #2 } { \l__acro_default_plural_tl } } { \prop_put:Nnn \l__acro_long_plural_prop { #2 } { #7 } } \IfNoValueF { #8 } { \prop_put:Nnn \l__acro_class_prop { #2 } { #8 } } \IfNoValueF { #9 } { \prop_put:Nnn \l__acro_extra_prop { #2 } { #9 } } \bool_new:c { g__acro_#2_first_use_bool } \bool_new:c { g__acro_#2_used_bool } \bool_new:c { g__acro_#2_label_bool } \bool_if:NT \l__acro_create_macros_bool { \cs_if_exist:cTF { #2 } { \bool_if:NT \l__acro_strict_bool { \cs_set:cpn { #2 } { \ac { #2 } \acro_xspace: } } } { \cs_new:cpn { #2 } { \ac { #2 } \acro_xspace: } } } } % set custom format: \cs_new:Npn \acro_format:nn #1#2 { \prop_put:Nnn \l__acro_format_prop { #1 } { #2 } } % add citation: \cs_new:Npn \acro_citation:nnnn #1#2#3#4 { \prop_put:Nnn \l__acro_citation_prop { #1 } { #4 } \IfNoValueF { #2 } { \prop_put:Nnn \l__acro_citation_pre_prop { #1 } { #2 } } \IfNoValueF { #3 } { \prop_put:Nnn \l__acro_citation_post_prop { #1 } { #3 } } } % add pdfstring: \cs_new:Npn \acro_pdfstring:nnn #1#2#3 { \prop_put:Nnx \l__acro_pdfstring_prop { #1 } { #2 } \IfNoValueTF { #3 } { \prop_put:Nnx \l__acro_pdfstring_plural_prop { #1 } { #2 \l__acro_default_plural_tl } } { \prop_put:Nnx \l__acro_pdfstring_plural_prop { #1 } { #2 #3 } } } % -------------------------------------------------------------------------- % USER COMMANDS % adding an acronym, user command: % #1: use/replace plural (boolean) % #2: id % #3: short % #4: short plural % #5: alt % #6: long % #7: long plural % #8: class % #9: extra \NewDocumentCommand \DeclareAcronym { sm>{\SplitArgument{1}{,}}mo>{\SplitArgument{1}{,}}+mgo } { \acro_new:nnnnnnnnn { #1 } { #2 } #3 { #4 } #5 { #7 } { #6 } } \@onlypreamble \DeclareAcronym \NewDocumentCommand \DeclareAcronymFormat { mm } { \acro_format:nn { #1 } { #2 } } \@onlypreamble \DeclareAcronymFormat \NewDocumentCommand \DeclareAcronymCitation { moom } { \acro_citation:nnnn { #1 } { #2 } { #3 } { #4 } } \@onlypreamble \DeclareAcronymCitation \NewDocumentCommand \DeclareAcronymPDFString { m >{ \SplitArgument { 1 } { , } } m } { \acro_pdfstring:nnn { #1 } #2 } \@onlypreamble \DeclareAcronymPDFstring % -------------------------------------------------------------------------- % print the list: \cs_new:Npn \acro_print_acronyms:nn #1#2 { \iow_now:Nx \@auxout { \string \acro@print@list } \bool_if:NT \l__acro_sort_bool { \acro_sort_prop:N \l__acro_short_prop } \UseInstance { acro-title } { \l__acro_list_title_tl } { \l__acro_list_name_tl } \cs_if_exist:NTF \acro@printed@list { \UseInstance { acro-list } { \l__acro_list_instance_tl } { \l__acro_list_type_tl } { #1 } { #2 } } { \@latex@warning@no@line {Rerun~to~get~acronym~list~right} } } % user command: \NewDocumentCommand \printacronyms { G{}O{} } { \acro_print_acronyms:nn { #1 } { #2 } } \tex_endinput:D