summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-04-14 21:08:25 +0000
committerKarl Berry <karl@freefriends.org>2020-04-14 21:08:25 +0000
commit09287ef491c414f8ad2bda4339aa19ee4c957998 (patch)
tree849c34c5362b6bb125f4767662503c119f58398b /Master/texmf-dist/tex/lualatex
parent412d5416d74c4bc4fe5aef8d7612fbc5faece111 (diff)
emojicite (14apr20)
git-svn-id: svn://tug.org/texlive/trunk@54741 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex')
-rw-r--r--Master/texmf-dist/tex/lualatex/emojicite/emojicite.sty101
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
+