\usepackage[table]{xcolor} \usepackage[many]{tcolorbox} \usepackage{anyfontsize} \usepackage{tikz} \definecolor{kanjiColor}{RGB}{72, 194, 78} \colorlet{kunyomiColor}{blue} \colorlet{onyomiColor}{red} \colorlet{meaningColor}{black} % ---------------------------------------------------------------------------- % % JLPT Section % % ---------------------------------------------------------------------------- % \setcounter{secnumdepth}{0} \newcommand{\jlptSection}[2]{ % For some reason, I'm not able to use \uppercase in order to use % a single argument. In the end, I found that just using two arguments % was going to be easier than trying to override the way the LaTeX % kernel handles this command. \section{#1} \begin{center} \fontsize{16}{16} \input{./data/tables/#2.tex} \end{center} \localtableofcontents \break } % ---------------------------------------------------------------------------- % % Kanji Table % % ---------------------------------------------------------------------------- % \newenvironment{kanjiTable}[1] { \begin{longtable}{#1} } { \end{longtable} } % ---------------------------------------------------------------------------- % % Header line % % ---------------------------------------------------------------------------- % \newcommand{\taughtIn}[1]{ Taught in: #1 \newline } \newcommand{\jlptLevel}[1]{ JLPT Level: #1 \newline } \newcommand{\strokeCount}[1]{ Stroke count: #1 \newline } \newcommand{\kanji}[1]{ \begin{center} \resizebox{\textwidth}{!}{ \begin{tikzpicture} \fill[rounded corners=2pt, fill=kanjiColor, draw=black] (0,0) rectangle (1,1); \draw (0.5,0.23) node[white, anchor=base, scale=2]{#1}; \end{tikzpicture} } \phantomsection \addcontentsline{toc}{subsection}{#1} \end{center} } \newcommand{\radicalHeader}[1]{ \begin{center} \resizebox{.4\textwidth}{!}{ \begin{tikzpicture} \draw[thick] (0,0) rectangle (1,1); \draw (0.5,0.23) node[anchor=base, scale=2]{#1}; \end{tikzpicture} } \end{center} } \newcommand{\kanjiPageHeader}[5]{ \begin{minipage}{0.3\textwidth} \begin{flushleft} \taughtIn{#2} \jlptLevel{#3} \strokeCount{#4} \end{flushleft} \end{minipage} \hfill \begin{minipage}{0.3\textwidth} \kanji{#1} \end{minipage} \hfill \begin{minipage}{0.3\textwidth} \begin{flushright} \radicalHeader{#5} \end{flushright} \end{minipage} \vspace{1cm} } % ---------------------------------------------------------------------------- % % Meaning % % ---------------------------------------------------------------------------- % \newtcolorbox{meaningBox}{ tcbox width=auto limited, capture=hbox, enhanced, colback=meaningColor!20, left=15pt, right=15pt, top=15pt, bottom=15pt, arc=0pt, outer arc=0pt, attach boxed title to top center={yshift=-12pt, yshifttext=-6pt}, title={\fontsize{15}{20}\textcolor{white}{\textbf{意味}}}, colbacktitle=meaningColor!60, boxed title style={arc=0pt, outer arc=0pt} } \newcommand{\kanjiMeaning}[1]{ \begin{center} \begin{meaningBox} \Large #1 \end{meaningBox} \end{center} } % ---------------------------------------------------------------------------- % % Kunyomi and Onyomi % % ---------------------------------------------------------------------------- % \newtcolorbox{kunyomiBox}{ enhanced, attach boxed title to top left={yshift=-12pt,xshift=10pt}, colback=kunyomiColor!20, colframe=kunyomiColor!60, left=15pt, right=15pt, top=15pt, bottom=5pt, title={\fontsize{15}{20}\textcolor{white}{\textbf{訓読み}}}, colbacktitle=kunyomiColor!60, width=\textwidth } \newcommand{\kunyomi}[1]{ \begin{kunyomiBox} \fontsize{15}{20} #1 \end{kunyomiBox} } \newtcolorbox{onyomiBox}{ enhanced, attach boxed title to top left={yshift=-12pt,xshift=10pt}, colback=onyomiColor!20, colframe=onyomiColor!60, left=15pt, right=15pt, top=15pt, bottom=5pt, title={\fontsize{15}{20}\textcolor{white}{\textbf{音読み}}}, colbacktitle=onyomiColor!60, width=\textwidth, } \newcommand{\onyomi}[1]{ \begin{onyomiBox} \fontsize{15}{20} \textbf{\textcolor{kanjiColor!80!black}{#1}} \end{onyomiBox} \vspace{0.5cm} } % ---------------------------------------------------------------------------- % % Kanji Drawing Box % % ---------------------------------------------------------------------------- % \newCJKfontfamily\drawingKanji[ Path = {./font/}, Extension = .ttf, ]{Choumei} \newCJKfontfamily\drawingFirstKanji[ Path = {./font/}, Extension = .ttf, ]{KanjiStrokeOrders} \newcommand{\kanjiRow}[1]{ \resizebox{\textwidth}{!}{ \begin{tikzpicture}[font=\drawingKanji, anchor=base] \clip (-0.1,-0.1) rectangle (14.1,6.1); % Main Frame \draw[line width=1.6pt] (0, 0) rectangle (14, 6); % Horizontal lines \draw (0,2) -- (14,2); \draw (0,4) -- (14,4); % Vertical lines \draw (2,0) -- (2,6); \draw (4,0) -- (4,6); \draw (6,0) -- (6,6); \draw (8,0) -- (8,6); \draw (10,0) -- (10,6); \draw (12,0) -- (12,6); % Grid Top \draw[dashed, opacity=.5] (0,5) -- (14,5); \draw[dashed, opacity=.5] (1,4) -- (1,6); \draw[dashed, opacity=.5] (3,4) -- (3,6); \draw[dashed, opacity=.5] (5,4) -- (5,6); \draw[dashed, opacity=.5] (7,4) -- (7,6); \draw[dashed, opacity=.5] (9,4) -- (9,6); \draw[dashed, opacity=.5] (11,4) -- (11,6); \draw[dashed, opacity=.5] (13,4) -- (13,6); % Grid Bottom \draw(0,1) -- (14,1); \draw (1,0) -- (1,2); \draw (3,0) -- (3,2); \draw (5,0) -- (5,2); \draw (7,0) -- (7,2); \draw (9,0) -- (9,2); \draw (11,0) -- (11,2); \draw (13,0) -- (13,2); % Big Characters \draw (0.95,4.42) node[scale=5, font=\drawingFirstKanji]{#1}; \draw (3,4.3) node[scale=5, opacity=.2, inner sep=0pt]{#1}; \draw (5,4.3) node[scale=5, opacity=.15]{#1}; \draw (7,4.3) node[scale=5, opacity=.12]{#1}; \draw (9,4.3) node[scale=5, opacity=.08]{#1}; \draw (11,4.3) node[scale=5, opacity=.04]{#1}; % Small characters \draw (0.5,1.15) node[scale=2]{#1}; \draw (0.5,0.15) node[scale=2, opacity=.3]{#1}; \draw (1.5,1.15) node[scale=2, opacity=.2]{#1}; \draw (1.5,0.15) node[scale=2, opacity=.15]{#1}; \draw (2.5,1.15) node[scale=2, opacity=.1]{#1}; \draw (2.5,0.15) node[scale=2, opacity=.05]{#1}; \end{tikzpicture} } }