Created
June 27, 2015 03:37
-
-
Save zr-tex8r/edcbacc4eeb7a7bea8ff to your computer and use it in GitHub Desktop.
LaTeX: Enumeration using 🍣 with aid of coloremoji package
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
%% tcsushi.sty | |
%% package declaration | |
\NeedsTeXFormat{LaTeX2e} | |
\ProvidesPackage{tcsushi} | |
%% preparations | |
\def\tcqss@pkgname{tcsushi} | |
\def\tcqss@error{\PackageError\tcqss@pkgname} | |
%--------------------------------------- handle options | |
\DeclareOption{hires}{% | |
\PassOptionsToPackage{hires}{coloremoji}} | |
\DeclareOption{twitter}{% | |
\PassOptionsToPackage{twitter}{coloremoji}} | |
\DeclareOption{normalimagedir}{% | |
\AtEndOfPackage{\coloremojiusenormalimagedir}} | |
\ProcessOptions\relax | |
%% load packages | |
\PassOptionsToPackage{dvipdfmx}{graphics} | |
\RequirePackage{coloremoji} | |
\RequirePackage{etoolbox} | |
\RequirePackage{amstext} | |
%--------------------------------------- helpers | |
%% unique tokens | |
\def\tcqss@end{\tcqss@end@} | |
\def\tcqss@mt{\tcqss@mt@} | |
\let\tcqss@term\indent % unexpandable | |
%% \tcqss@text{<text>} | |
% \text with xkanjiskip suppressed. | |
% (What is the right way?) | |
\def\tcqss@text#1{% | |
{\hskip\z@\text{#1}\hskip\z@}} | |
%% \tcqss@let@jchar\CS{<code>} | |
% Makes \CS expand to a jchar token with the given code. | |
\def\tcqss@let@jchar#1#2{% | |
\begingroup % the usual \kansuji trick... | |
\kansujichar1=#2\relax | |
\xdef\tcqss@gtmpa{\kansuji1}% | |
\endgroup | |
\let#1=\tcqss@gtmpa} | |
%--------------------------------------- sushi characters | |
%%<*> \coloremojiusenormalimagedir | |
% Uses the 'normal' value of \coloremojidir, as I think it is. | |
\newcommand*\coloremojiusenormalimagedir{% | |
\def\coloremojidir{emoji_images/}} | |
%%<*> \tcsushi / \tcrice / \tcfish | |
% The emoji characters. | |
\newrobustcmd*\tcsushi{\tcsymbol{1F363}}% U+1F363 sushi | |
\newrobustcmd*\tcrice{\tcsymbol{1F35A}} % U+1F35A cooked rice | |
\newrobustcmd*\tcfish{\tcsymbol{1F41F}} % U+1F41F fish | |
%% \tcsymbol{<code-or-char>} | |
% Prints an emoji you like. | |
% If the argument is a hex number, then the character with | |
% that code value is passed to \coloremoji; otherwisw, | |
% the arguent itself is passed to \coloremoji. | |
\newrobustcmd*\tcsymbol[1]{% | |
\relax\ifmmode | |
\tcqss@text{\tcqss@symbol@a{#1}}% | |
\else | |
\tcqss@symbol@a{#1}% | |
\fi} | |
\def\tcqss@symbol@a#1{% | |
\edef\tcqss@tmpa{\uppercase{% | |
\edef\noexpand\tcqss@tmpa{\detokenize{#1}}}}% | |
\tcqss@tmpa | |
\afterassignment\tcqss@symbol@b\@tempcnta"0\tcqss@tmpa\tcqss@term | |
\ifnum\@tempcnta<32 | |
\protected@edef\tcqss@tmpa{#1}% | |
\else | |
\tcqss@let@jchar\tcqss@tmpa\@tempcnta | |
\fi | |
\expandafter\coloremoji\expandafter{\tcqss@tmpa}} | |
\def\tcqss@symbol@b#1\tcqss@term{% | |
\ifx\tcqss@mt#1\tcqss@mt\else \@tempcnta\m@ne \fi} | |
%--------------------------------------- sushi counters | |
%% \tcsushisymbolnum{<number>} | |
% Prins the giver number in the 'sushi-symbol' form. | |
\newcommand*\tcsushisymbolnum{% | |
\tcqss@num@cmd\tcSushiSymbolNum} | |
%% \tcsushitallynum{<number>} | |
% Prins the giver number in the 'sushi-tally' form. | |
\newcommand*\tcsushitallynum{% | |
\tcqss@num@cmd\tcSushiTallyNum} | |
%% \tcsushisymbol{<counter>} | |
% Prins the counter value in the 'sushi-symbol' form. | |
\newcommand*\tcsushisymbol{% | |
\tcqss@ctr@cmd\tcSushiSymbolNum} | |
%% \tcsushitally{<counter>} | |
% Prins the counter value in the 'sushi-tally' form. | |
\newcommand*\tcsushitally{% | |
\tcqss@ctr@cmd\tcSushiTallyNum} | |
%% \tcqss@num@cmd\CS{<number>} | |
% Calls a \CS with the argument numeralized. | |
\def\tcqss@num@cmd#1#2{% | |
\expandafter\tcqss@num@cmd@a\number#2\tcqss@term#1} | |
\def\tcqss@num@cmd@a#1\tcqss@term#2{#2{#1}} | |
%% \tcqss@ctr@cmd\CS{<number>} | |
\def\tcqss@ctr@cmd#1#2{% | |
\tcqss@num@cmd#1{\value{#2}}} | |
%%<+> \tcSushiSymbolNum{<numeral>} | |
% The externalized form os \tcsushisymbolnum. | |
% (A robust macro with a fixed number value.) | |
\newrobustcmd*\tcSushiSymbolNum[1]{% | |
\@tempcnta\numexpr#1+2\relax \divide\@tempcnta3 | |
\edef\tcqss@sym{\ifcase\numexpr#1+2-3*\@tempcnta\relax | |
\tcsushi \or \tcfish \or \tcrice \fi}% | |
\tcqss@tally{\@tempcnta}{\tcqss@sym}} | |
%%<+> \tcSushiTallyNum{<numeral>} | |
% The externalized form os \tcsushitallynum. | |
\newrobustcmd*\tcSushiTallyNum[1]{% | |
\tcqss@tally{#1}{\tcsushi}} | |
%% \tcqss@tally{<number>}{<text>} | |
\def\tcqss@tally#1#2{% | |
\numdef\tcqss@ctr{#1}% | |
\@whilenum{\tcqss@ctr>\z@}\do{% | |
#2% | |
\numdef\tcqss@ctr{\tcqss@ctr-1}}} | |
%--------------------------------------- all done | |
\endinput | |
%% EOF |
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
\documentclass[a4paper,uplatex,dvipdfmx]{jsarticle} | |
\usepackage[twitter]{tcsushi}% オプションはcoloremojiと同じ | |
\renewcommand*{\coloremojidir}{emoji_images/}% 適切に指定 | |
\begin{document} | |
知らず、{\tcsushi}の夢に胡蝶と為れるか、 | |
胡蝶の夢に{\tcsushi}と為れるか。 | |
\newcommand*\xLam[1]{\lambda#1.\,} | |
\[ | |
\tcsushi = \xLam{\tcfish} | |
(\xLam{\tcrice}\tcfish(\tcrice \tcrice)) | |
(\xLam{\tcrice}\tcfish(\tcrice \tcrice)) | |
\] | |
PDCAサイクルでは以下の段階を反復する。 | |
\renewcommand{\theenumi}{\tcsushisymbol{enumi}} | |
\begin{enumerate} | |
\item Plan: 計画を立てる。 | |
\item Do: 計画に基づいて実行する。 | |
\item Check: 計画の実施状況を確認する。 | |
\item Abandon: 全然ダメなので計画を諦める。\label{A} | |
\item 最初に戻って延々と繰り返す。 | |
\end{enumerate} | |
※ただし、\ref{A}のAbandonに | |
ついては異説もある。 | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
\tcsushi
= 🍣 /\tcfish
= 🐟 /\tcrice
= 🍚\tcsymbol{<符号値16進>}
: その符号値の文字を\coloremoji
で出力。\tcsymbol{<文字>}
:\coloremoji{<文字>}
と同じ。\tcsushisymbol{<カウンタ名>}
: カウンタ値を“🍣記号表記”で出力。\tcsushisymbolnum{<整数>}
: その整数を“🍣記号表記”で出力。