Skip to content

Instantly share code, notes, and snippets.

@zr-tex8r
Created January 1, 2022 11:50
Show Gist options
  • Save zr-tex8r/51a8c20d851d9d3f6debcfbc94d29487 to your computer and use it in GitHub Desktop.
Save zr-tex8r/51a8c20d851d9d3f6debcfbc94d29487 to your computer and use it in GitHub Desktop.
LaTeX: New year post card of the year 2022
%#!lualatex
\documentclass{article}
\usepackage[papersize={100mm,148mm},margin=0cm,
noheadfoot]{geometry}
\usepackage{luatexja-fontspec}
\usepackage{amsmath,tikz,graphicx,xcolor,xparse,pgfmath}
\usetikzlibrary{calc,positioning}
\newcommand{\cLet}{\pgfmathsetmacro}
\newfontface{\fEthi}{NotoSerifEthiopic-Black.ttf}[FakeSlant=0.1]
\newfontface{\fAleg}{Alegreya-ExtraBoldItalic.otf}
\newfontface{\fQing}{ZCOOLQingKeHuangYou-Regular.ttf}
\newfontface{\fNishiki}{Nishiki-teki.ttf}
\newjfontface{\jNishiki}{Nishiki-teki.ttf}
\newfontface{\fYuji}{YujiSyuku-Regular.ttf}
\newjfontface{\jYuji}{YujiSyuku-Regular.ttf}
\newfontface{\fVLG}{VL-Gothic-Regular.ttf}
\newfontfamily{\fSHSans}{HaranoAjiGothic-Medium.otf}[
BoldFont=HaranoAjiGothic-Heavy.otf]
\newjfontfamily{\jSHSans}{HaranoAjiGothic-Medium.otf}[
BoldFont=HaranoAjiGothic-Bold.otf]
\definecolor{mygray}{rgb}{0.3,0.3,0.3}
\definecolor{myred}{rgb}{1,0,0}
\definecolor{myblue}{rgb}{0,0.2,1}
\definecolor{mygreen}{rgb}{0,0.6,0.1}
\definecolor{mycgreen}{rgb}{0,0.45,0.05}
\NewDocumentCommand{\xZ}{}{\hspace*{0pt}}
\newcommand*{\?}[1]{%
{\fSHSans\hspace{.04em}\raisebox{.08ex}{#1}\hspace{.04em}}}
\NewDocumentEnvironment{xPar}{}{%
\par}{\par}
\NewDocumentCommand\xSize{O{0}m}{%
\fontsize{#2}{#1}\selectfont}
\begin{document}
%=================================================
\begin{xPar}\centering
\fEthi\xSize{36}\color{myred}
\raisebox{0pt}[18mm][0mm]{%
እንኳን አደረሳችሁ}
\end{xPar}
%=================================================
\vspace{6mm}
%=================================================
\begin{xPar}\centering
%
\newlength{\lU}\setlength{\lU}{0.01cm}
\cLet{\vS}{1.620375}
\colorlet{b}{black}
\cLet{\vP}{6}\cLet{\xPP}{12}\cLet{\yPP}{8}\cLet{\vLW}{\vP*2}
\cLet{\xA}{0}\cLet{\xZ}{400}
\cLet{\yA}{0}\cLet{\yZ}{400}
\cLet{\xS}{\xA-99}\cLet{\xT}{\xZ+99}
\cLet{\xB}{\vP}\cLet{\xF}{\xZ-\vP}
\cLet{\xC}{120}\cLet{\xD}{220}\cLet{\xE}{320}
\cLet{\yS}{\yA-99}\cLet{\yT}{\yZ+99}
\cLet{\yB}{\vP}\cLet{\yC}{100}\cLet{\yD}{180}
\cLet{\yE}{240}\cLet{\yF}{290}\cLet{\yG}{370}
\newcommand\cFBack[1]{%
\path[top color=#1, bottom color=#1!30!b, shading angle=45]}
\newcommand\cFRect[1]{%
\path[draw=#1!60, line width=\vLW\lU*\vS, rounded corners=30\lU,
top color=#1, bottom color=#1!30!b, shading angle=45]}
\newcommand\cERect[1]{%
\path[draw=#1!60, line width=\vLW\lU*\vS, rounded corners=30\lU]}
%
\begin{tikzpicture}[x=\lU,y=\lU,scale=\vS]
\fill[black, use as bounding box] (-16,-16) rectangle (416,416);
%\node[transform shape] at (368,-8)
% {\includegraphics[width=7.04mm]{yato.png}};
%
\clip (\xA,\yA) rectangle (\xZ,\yZ);
\cFBack{green!80!b!40!blue} (\xA,\yA) rectangle (\xZ,\yZ);
\cFRect{red} (\xS,\yB) rectangle (\xC,\yD);
\cFRect{blue!50!cyan} (\xE,\yB) rectangle (\xT,\yD);
\cFRect{blue} (\xB,\yC) rectangle (\xF,\yE);
\cFRect{yellow!75!b} (\xB,\yC) rectangle (\xD+\xPP,\yD+\yPP);
\cFRect{green!75!b} (\xD,\yD) rectangle (\xT,\yT);
\cERect{blue} (\xB,\yC) rectangle (\xF,\yE);
\cFRect{blue!10!cyan} (\xB,\yF) rectangle (\xF,\yG);
%
\node[scale=1.8, text=white, font={\fQing}, above left]
at (\xF-4,\yC-4) {2022};
%
\end{tikzpicture}
\end{xPar}
%=================================================
\vspace{1mm}
\begin{xPar}\centering
\fYuji\jYuji\xSize[13]{12}%
\ltjsetparameter{kanjiskip=-.14\zw,xkanjiskip=-.08\zw}
皆様のご健康とご多幸を\\
お祈り申し上げます
\end{xPar}
\vspace{3mm}
\begin{xPar}\centering\begin{minipage}{90mm}
\begin{xPar}
\fNishiki\jNishiki\xSize{16}\color{myred}
New Year Puzzle%
\hfill
{\xSize{14}\color{myred}%
2022}%
{\xSize{9}\color{mygreen!75!black}%
\,年(令和\,}%
{\xSize{14}\color{myred}%
4}%
{\xSize{9}\color{mygreen!75!black}%
\,年)}%
\end{xPar}
\begin{xPar}
\fNishiki\jNishiki\xSize{12}\color{myblue!75!black}%
~年賀パズル~
\end{xPar}
\par\vspace{-3.5mm}
\begin{minipage}[b]{40mm}
\setlength\leftmargini{14pt}
\setlength\leftmargin{14pt}
\fSHSans\jSHSans\xSize{7}
以下の条件に従って掛け算の虫食い算を解きなさい。
\par\vspace{-8pt}
\begin{itemize}
\setlength{\itemsep}{-3pt}
\item \textcolor{myred}{\bfseries 4}は
\<(表出の)\<2か所しかない。
\item \textcolor{myred}{\bfseries 4}の
上下左右にある数字は全て\textcolor{myred}{同じ}である。
\item \textcolor{myblue}{\bfseries 3}は
1か所にしか入らない。
\item \textcolor{myblue}{\bfseries 3}の
上下左右にある“もの”は全て\textcolor{myblue}{異なって}いる。
\end{itemize}
\par\vspace{-10pt}
{\xSize{4.7}\textcolor{mygreen!75!black}{※}%
“もの”とは数字または余白を指す。
つまり、\textcolor{myblue}{\bfseries 3}の
周囲のうち高々1か所は余白(マス無し)かも
しれない。
}
\par\vspace{-1mm}
\end{minipage}%
\begin{minipage}[b]{50mm}\raggedleft
\DeclareDocumentCommand{\crB}{r()}{%
\node[crbox] at (#1) {};
}
\DeclareDocumentCommand{\crF}{r()}{%
\node[crfour] at (#1) {4};
}
%
\scalebox{0.42}{\begin{tikzpicture}[x=1mm,y=1mm,
crline/.style={draw=myblue, line width=1.8pt},
crfour/.style={text=myred, font={\fSHSans\bfseries\xSize{25}}},
crbox/.style={draw=mygreen},
every node/.style={rectangle, line width=1.8pt,
minimum width=7.5mm, minimum height=7.5mm}]
\fill[myred!30] (-5,-5) rectangle (35,5);
\crB(50,64)\crB(60,64)\crB(70,64)\crB(80,64)\crB(90,64)
\crB(50,54)\crB(60,54)\crB(70,54)\crB(80,54)\crB(90,54)
\crB(50,42)\crB(60,42)\crB(70,42)\crB(80,42)\crB(90,42)
\crB(20,32)\crB(30,32)\crB(40,32)\crB(50,32)\crB(60,32)\crB(70,32)
\crB(10,22)\crB(20,22)\crB(30,22)\crF(40,22)\crB(50,22)\crB(60,22)
\crB(00,12)\crB(10,12)\crB(20,12)\crF(30,12)\crB(40,12)\crB(50,12)
\crB(00,00)\crB(10,00)\crB(20,00)\crB(30,00)\crB(40,00)
\crB(50,00)\crB(60,00)\crB(70,00)\crB(80,00)\crB(90,00)
\draw[crline] (-7,48)--(97,48);
\draw[crline] (-7,6)--(97,6);
\draw[crline] (-2,56)--(2,52) (-2,52)--(2,56);
\end{tikzpicture}}%
\end{minipage}%
\par\vspace{-1mm}
\end{minipage}\end{xPar}
\end{document}
@zr-tex8r
Copy link
Author

zr-tex8r commented Jan 1, 2022

The output is shown in my log post.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment