diff options
Diffstat (limited to 'Master/texmf-dist/tex/lualatex')
-rw-r--r-- | Master/texmf-dist/tex/lualatex/emojicite/emojicite.sty | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/lualatex/emojicite/emojicite.sty b/Master/texmf-dist/tex/lualatex/emojicite/emojicite.sty new file mode 100644 index 00000000000..3b459046b37 --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/emojicite/emojicite.sty @@ -0,0 +1,101 @@ +%% +%% Copyright (C) 2020 by Leon Sixt <ctan@leon-sixt.de> +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3c 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 Leon Sixt. +%% +\NeedsTeXFormat{LaTeX2e}[2020/02/02] +\ProvidesExplPackage{emoji}{2020/04/14}{0.1}{Add Emojis to Citations (in LuaLaTeX)} + +\usepackage{emoji} +\usepackage{natbib} + +\usepackage{xparse} +\ExplSyntaxOn + +\makeatletter +\NewDocumentCommand{\emojicite}{m} + { + \mjb_multicitep:n { #1 } + } +\makeatother + + +\makeatletter +\NewDocumentCommand{\emojicitep}{m} + { + \NAT@open + \mjb_multicitep:n { #1 } + \NAT@close + } +\makeatother + +\seq_new:N \l_mjb_multicite_in_seq +\seq_new:N \l_mjb_multicite_out_seq +\seq_new:N \l_mjb_cite_seq + +\cs_new_protected:Npn \mjb_multicitep:n #1 + { + \seq_set_split:Nnn \l_mjb_multicite_in_seq { ; } { #1 } + \seq_clear:N \l_mjb_multicite_out_seq + \seq_map_inline:Nn \l_mjb_multicite_in_seq + { + \mjb_cite_process:n { ##1 } + } + \seq_use:Nn \l_mjb_multicite_out_seq { ;~ } + } + +\cs_new_protected:Npn \mjb_cite_process:n #1 +{ + \seq_set_split:Nnn \l_mjb_cite_seq { , } { #1 } + \int_compare:nTF { \seq_count:N \l_mjb_cite_seq == 1 } + { + \seq_put_right:Nn \l_mjb_multicite_out_seq + { \citeauthor{#1},~\citeyear{#1} } + } + { + \int_compare:nTF { \seq_count:N \l_mjb_cite_seq == 2 } + { + \seq_put_right:Nx \l_mjb_multicite_out_seq + { + \exp_not:N \citeauthor{\seq_item:Nn \l_mjb_cite_seq { 1 }},~ + \exp_not:N \citeyear{\seq_item:Nn \l_mjb_cite_seq { 1 }}~ + \emoji{\seq_item:Nn \l_mjb_cite_seq { 2 }} + } + } + % we can handle up to 2 emojis + { + \int_compare:nTF { \seq_count:N \l_mjb_cite_seq == 3 } + { + \seq_put_right:Nx \l_mjb_multicite_out_seq + { + \exp_not:N \citeauthor{\seq_item:Nn \l_mjb_cite_seq { 1 }},~ + \exp_not:N \citeyear{\seq_item:Nn \l_mjb_cite_seq { 1 }}~ + \emoji{\seq_item:Nn \l_mjb_cite_seq { 2 }} + \emoji{\seq_item:Nn \l_mjb_cite_seq { 3 }} + } + } + { + \seq_put_right:Nx \l_mjb_multicite_out_seq + { + \exp_not:N \citeauthor{\seq_item:Nn \l_mjb_cite_seq { 1 }},~ + \exp_not:N \citeyear{\seq_item:Nn \l_mjb_cite_seq { 1 }}~ + \exp_not:N \textbf{emojicite~does~not~support~more~than~two~emojis}. + } + } + } + } + } +\ExplSyntaxOff + |