\documentclass[luatex,fontsize=10pt,paper=b5,twoside]{jlreq}%
\usepackage{KKsymbols}
\usepackage[dvipsnames, svgnames, x11names]{xcolor}
\usepackage{hyperref}
\usepackage{listings}
\lstset{
    basicstyle=\ttfamily\small,
    keywordstyle=\color{blue},
    commentstyle=\color{gray},
    stringstyle=\color{red},
    breaklines=true,
    breakatwhitespace=false,  
    columns=flexible           
}

\usepackage{hyperref} 
\hypersetup{
  luatex, pdfencoding=auto, 
  colorlinks=true,
  linkcolor=black,     
  citecolor=black,     
  urlcolor=DeepSkyBlue3,      
  pdfborder={0 0 0}, 
}

\title{\texttt{KKsymbols} Package Documentation}
\author{Kosei Kawaguchi a.k.a KKTeX}
\date{Version 1.0.0 (2025/10/03)}
\begin{document}

\begin{titlepage}
  \maketitle
\end{titlepage}
\newpage
\tableofcontents
\newpage

\section{Acknowledgements / Credit}
In developing this package, I made extensive use of the advice I received from Yusuke Terada.

\section{Installation}
Place \texttt{KKsymbols.sty} in a directory where LaTeX can find it, e.g., your local \texttt{texmf} tree or alongside your document.

Dependencies:
\begin{itemize}
    \item \texttt{tikz}
\end{itemize}

Load the package:

\begin{verbatim}
\usepackage{KKsymbols}
\end{verbatim}

\section{Caution}
Since this package internally calls \verb|\ltjghostbeforejachar| and \verb|\ltjghostafterjachar|, it can be used only in a LuaLaTeX environment.

\section{Commands}
\subsection{The maru series}
This package provides \verb|\maru|, \verb|\kuromaru|, and \verb|\nmaru|. Each of them takes one mandatory argument and no optional arguments. You can pass strings of any length and in any font as arguments. \textbf{However, using lowercase letters as arguments is not recommended.}

They are used as follows.

\begin{table}[h]
\centering
\caption{maru series}
\begin{tabular}{|c|c|c|c|}
\hline
argument & \texttt{\textbackslash maru} & \texttt{\textbackslash kuromaru} & \texttt{\textbackslash nmaru} \\
\hline
1     & \maru{1}     & \kuromaru{1}     & \nmaru{1}     \\
97    & \maru{97}    & \kuromaru{97}    & \nmaru{97}    \\
だ    & \maru{だ}    & \kuromaru{だ}    & \nmaru{だ}    \\
ばばば & \maru{ばばば} & \kuromaru{ばばば} & \nmaru{ばばば} \\
\hline
\end{tabular}
\end{table}

They behave as if they were single kanji or hiragana characters:

\fboxsep=0pt\fboxrule=0.2pt
\begin{quotation}
  あいう\fbox{\maru{あ}}\fbox{あ}いう\maru{1}\maru{2}\maru{3}あいうえお
\end{quotation}

The spacing between \verb|\maru| and other characters is adjusted using \verb|\ltjghostbeforejachar| and \verb|\ltjghostafterjachar| so that it behaves like hiragana or kanji.

\textbf{Naturally, these commands also work correctly in vertical writing environments.}

When changing the font size using commands such as \verb|\Large|, each command is scaled proportionally according to the font size change:

\begin{quotation}
  \tiny \maru{あああ}\kuromaru{2222}\nmaru{亀}
  \normalsize \maru{あああ}\kuromaru{2222}\nmaru{亀}
  \Huge \maru{あああ}\kuromaru{2222}\nmaru{亀}
\end{quotation}

You can also change the current font:
\begin{quotation}
  \LARGE\maru{あいう}\kuromaru{午後}\nmaru{悟}
  \gtfamily \maru{あいう}\kuromaru{午後}\nmaru{悟}
\end{quotation}

As mentioned earlier, using lowercase letters as arguments for this macro is not recommended. However, \textbf{it is not entirely impossible if you really want to do so}. This package provides two commands, \verb|\dccare| and \verb|\ndccare|. Characters with descenders, such as \verb|g| or \verb|y|, can be handled using \verb|\dccare{g}|, while characters without descenders can be handled using \verb|\ndccare{a}|.

\begin{lstlisting}
  \maru{\dccare{g}}\maru{\dccare{ggg}}\maru{\dccare{j}}\maru{\dccare{jjj}}\maru{\ndccare{a}}
  \maru{\dccare{j}\ndccare{b}\dccare{j}}\maru{あ\dccare{g}}\maru{A\dccare{j}}\maru{田\ndccare{a}}
\end{lstlisting}

\begin{quotation}
  \maru{\dccare{g}}\maru{\dccare{ggg}}\maru{\dccare{j}}\maru{\dccare{jjj}}\maru{\ndccare{a}}

  \maru{\dccare{j}\ndccare{b}\dccare{j}}\maru{あ\dccare{g}}\maru{A\dccare{j}}\maru{田\ndccare{a}}
\end{quotation}

For certain fonts, the characters may still extend beyond the frame even with these adjustments. In such cases, use commands like \verb|\scalebox| or \verb|\raisebox| to adjust them as needed.

\section{The seihou series}
The commands introduced below are used in exactly the same way as the maru series.

\begin{table}[h]
\centering
\caption{seihou series}
\begin{tabular}{|c|c|c|}
\hline
argument & \texttt{\textbackslash seihou} & \texttt{\textbackslash kuroseihou} \\
\hline
1     & \seihou{1}     & \kuroseihou{1}     \\
97    & \seihou{97}    & \kuroseihou{97}    \\
だ    & \seihou{だ}    & \kuroseihou{だ}    \\
ばばば & \seihou{ばばば} & \kuroseihou{ばばば} \\
\hline
\end{tabular}
\end{table}

\begin{table}[h]
\centering
\caption{seimaru series}
\begin{tabular}{|c|c|c|}
\hline
argument & \texttt{\textbackslash seimaru} & \texttt{\textbackslash kuroseimaru} \\
\hline
1     & \seimaru{1}     & \kuroseimaru{1}     \\
97    & \seimaru{97}    & \kuroseimaru{97}    \\
だ    & \seimaru{だ}    & \kuroseimaru{だ}    \\
ばばば & \seimaru{ばばば} & \kuroseimaru{ばばば} \\
\hline
\end{tabular}
\end{table}

\begin{table}[h]
\centering
\caption{hishi series}
\begin{tabular}{|c|c|c|c|c|}
\hline
argument & \texttt{\textbackslash hishi} & \texttt{\textbackslash kurohishi} & \texttt{\textbackslash maruhishi} & \texttt{\textbackslash kuromaruhishi} \\
\hline
1     & \hishi{1}     & \kurohishi{1}     & \maruhishi{1}     & \kuromaruhishi{1} \\
97    & \hishi{97}    & \kurohishi{97}    & \maruhishi{97}    & \kuromaruhishi{97} \\
だ    & \hishi{だ}    & \kurohishi{だ}    & \maruhishi{だ}    & \kuromaruhishi{だ} \\
ばばば & \hishi{ばばば} & \kurohishi{ばばば} & \maruhishi{ばばば} & \kuromaruhishi{ばばば} \\
\hline
\end{tabular}
\end{table}

Examples with lowercase alphabet characters are additionally provided.

\begin{lstlisting}
  \seihou{\dccare{g}}\seihou{\dccare{ggg}}\seihou{\dccare{j}}\seihou{\dccare{jjj}}\seihou{\ndccare{a}}
  \seihou{\dccare{j}\ndccare{b}\dccare{j}}\seihou{あ\dccare{g}}\seihou{A\dccare{j}}\seihou{田\ndccare{a}}
  \hishi{\dccare{g}}\hishi{\dccare{ggg}}\hishi{\dccare{j}}\hishi{\dccare{jjj}}\hishi{\ndccare{a}}
  \hishi{\dccare{j}\ndccare{b}\dccare{j}}\hishi{あ\dccare{g}}\hishi{A\dccare{j}}\hishi{田\ndccare{a}}
\end{lstlisting}

\begin{quotation}
  \seihou{\dccare{g}}\seihou{\dccare{ggg}}\seihou{\dccare{j}}\seihou{\dccare{jjj}}\seihou{\ndccare{a}}

  \seihou{\dccare{j}\ndccare{b}\dccare{j}}\seihou{あ\dccare{g}}\seihou{A\dccare{j}}\seihou{田\ndccare{a}}

  \hishi{\dccare{g}}\hishi{\dccare{ggg}}\hishi{\dccare{j}}\hishi{\dccare{jjj}}\hishi{\ndccare{a}}

  \hishi{\dccare{j}\ndccare{b}\dccare{j}}\hishi{あ\dccare{g}}\hishi{A\dccare{j}}\hishi{田\ndccare{a}}
\end{quotation}

\section{The kakko series}
The commands introduced below are used in exactly the same way as the maru series.

\begin{table}[h]
\centering
\caption{kakko series\maru{1}}
\begin{tabular}{|c|c|c|c|c|c|}
\hline
argument & \texttt{\textbackslash kakko} & \texttt{\textbackslash sumikakko} & \texttt{\textbackslash kakukakko} & \texttt{\textbackslash kikakko} & \texttt{\textbackslash ykakko} \\
\hline
1     & \kakko{1}     & \sumikakko{1}     & \kakukakko{1}     & \kikakko{1}     & \ykakko{1} \\
97    & \kakko{97}    & \sumikakko{97}    & \kakukakko{97}    & \kikakko{97}    & \ykakko{97} \\
だ    & \kakko{だ}    & \sumikakko{だ}    & \kakukakko{だ}    & \kikakko{だ}    & \ykakko{だ} \\
ばばば & \kakko{ばばば} & \sumikakko{ばばば} & \kakukakko{ばばば} & \kikakko{ばばば} & \ykakko{ばばば} \\
\hline
\end{tabular}
\end{table}

\begin{table}[h]
\centering
\caption{kakko series\maru{2}}
\begin{tabular}{|c|c|c|c|c|c|}
\hline
argument & \texttt{\textbackslash nykakko} & \texttt{\textbackslash namikakko} & \texttt{\textbackslash kagikakko} & \texttt{\textbackslash nkagikakko} & \texttt{\textbackslash period} \\
\hline
1     & \nykakko{1}     & \namikakko{1}     & \kagikakko{1}     & \nkagikakko{1}     & \period{1} \\
97    & \nykakko{97}    & \namikakko{97}    & \kagikakko{97}    & \nkagikakko{97}    & \period{97} \\
だ    & \nykakko{だ}    & \namikakko{だ}    & \kagikakko{だ}    & \nkagikakko{だ}    & \period{だ} \\
ばばば & \nykakko{ばばば} & \namikakko{ばばば} & \kagikakko{ばばば} & \nkagikakko{ばばば} & \period{ばばば} \\
\hline
\end{tabular}
\end{table}

Examples with lowercase alphabet characters are additionally provided.

\begin{lstlisting}
  \kakko{\dccare{g}}\kakko{\dccare{ggg}}\kakko{\dccare{j}}\kakko{\dccare{jjj}}\kakko{\ndccare{a}}
  \kakko{\dccare{j}\ndccare{b}\dccare{j}}\kakko{あ\dccare{g}}\kakko{A\dccare{j}}\kakko{田\ndccare{a}}
\end{lstlisting}

\begin{quotation}
  \kakko{\dccare{g}}\kakko{\dccare{ggg}}\kakko{\dccare{j}}\kakko{\dccare{jjj}}\kakko{\ndccare{a}}

  \kakko{\dccare{j}\ndccare{b}\dccare{j}}\kakko{あ\dccare{g}}\kakko{A\dccare{j}}\kakko{田\ndccare{a}}
\end{quotation}

\section{License}

Released under the \href{https://www.latex-project.org/lppl/}{LaTeX Project Public License (LPPL) 1.3c}.

\section{Version History}

\begin{itemize}
    \item \textbf{v1.0.0 (2025/10/03)} --- Initial public release.
\end{itemize}

\section{Source Code}

\begin{lstlisting}
  \NeedsTeXFormat{LaTeX2e}
  \ProvidesPackage{KKsymbols}[2025/10/03, Version 1.0.0]

  \RequirePackage{tikz}
  \usetikzlibrary{shapes}

  \makeatletter
  \newcommand{\dccare}[1]{\vphantom{田}\raisebox{\dimexpr.18\dimexpr\f@size pt\relax}{\scalebox{1}[.8]{#1}}}
  \newcommand{\ndccare}[1]{\vphantom{田}{#1}}
  \makeatother

  \makeatletter
  \newcommand{\VerticalAdjustMaru}{%
    \ifnum\ltjgetparameter{direction}=3
      -0.06ex % 縦組
    \else
      0.19ex  % 横組
    \fi
  }
  \makeatother

  \makeatletter
  \newcommand{\maybescale}[3]{%
    \ifdim #1 > #2%
      \ifdim #1 > 0pt%
        \edef\scalefactor{%
          \fpeval{ \strip@pt\dimexpr #2\relax / \strip@pt\dimexpr #1\relax }%
        }%
      \else%
        \def\scalefactor{1}%
      \fi%
      \scalebox{\scalefactor}[1]{#3}%
    \else%
      #3%
    \fi%
  }

  %maru系縦方向
  \makeatletter
  \newcommand{\maybescaleV}[3]{%
    \ifnum\ltjgetparameter{direction}=3
      #3%
    \else
      \ifdim \dimexpr 1.5\dimexpr #1\relax < #2%
        \edef\verticalscale{%
          \fpeval{0.72 * (\strip@pt\dimexpr #2\relax / \strip@pt\dimexpr #1\relax)}%
        }%
        \scalebox{1}[\verticalscale]{#3}%
      \else%
        #3%
      \fi%
    \fi
  }

  %seihou系縦方向
  \newcommand{\maybescaleVV}[3]{%
    \ifnum\ltjgetparameter{direction}=3
      #3%
    \else
      \ifdim \dimexpr 1.5\dimexpr #1\relax < #2%
        \edef\verticalscale{%
          \fpeval{0.64 * (\strip@pt\dimexpr #2\relax / \strip@pt\dimexpr #1\relax)}%
        }%
        \scalebox{1}[\verticalscale]{#3}%
      \else%
        #3%
      \fi%
    \fi
  }

  %hishi系縦方向
  \newcommand{\maybescaleVVV}[3]{%
    \ifnum\ltjgetparameter{direction}=3
      #3%
    \else
      \ifdim \dimexpr 1.5\dimexpr #1\relax < #2%
        \edef\verticalscale{%
          \fpeval{0.58 * (\strip@pt\dimexpr #2\relax / \strip@pt\dimexpr #1\relax)}%
        }%
        \scalebox{1}[\verticalscale]{#3}%
      \else%
        #3%
      \fi%
    \fi
  }

  %kakko系
  \newcommand{\maybescaleVVVV}[3]{%
    \ifnum\ltjgetparameter{direction}=3
      #3%
    \else
      \ifdim \dimexpr 1.5\dimexpr #1\relax < #2%
        \edef\verticalscale{%
          \fpeval{0.58 * (\strip@pt\dimexpr #2\relax / \strip@pt\dimexpr #1\relax)}%
        }%
        \scalebox{1}[\verticalscale]{#3}%
      \else%
        #3%
      \fi%
    \fi
  }
  \makeatother

  \makeatother

  \makeatletter
  \newlength{\maru@boxwidth}
  \newlength{\maru@textwidth}
  \newlength{\maru@textheight}
  \DeclareRobustCommand{\maru}[1]{%
    \settowidth{\maru@textwidth}{#1}%
    \settoheight{\maru@textheight}{#1}%
    \setlength{\maru@boxwidth}{\f@size pt}%
    \multiply\maru@boxwidth by 105 % 123から105へ
    \divide\maru@boxwidth by 100 %
    \ltjghostbeforejachar%
    \vphantom{羅}\raisebox{\VerticalAdjustMaru}{%
      \hbox to \maru@boxwidth{%
        \hss
        \tikz[baseline=(char.base), overlay]{%
          \node[
            shape=circle,
            line width=0.1ex,  
            minimum size=.9\maru@boxwidth, % .92から.9へ
            draw,
            inner sep=\dimexpr -0.22\dimexpr\f@size pt % .25から.22へ   
          ] (char){%
            \raisebox{0.033ex}{\scalebox{0.75}{\vphantom{羅}\makebox[.83\maru@boxwidth][c]{\maybescale{\maru@textwidth}{.83\maru@boxwidth}{\maybescaleV{\maru@textheight}{\maru@boxwidth}{#1}}}}}% 0.8倍から0.75倍へ・.9\maru@boxwidth から 85\maru@boxwidthへ
          };
        }%
        \hss
      }%
    }%
    \ltjghostafterjachar
  }
  \makeatother

  \makeatletter
  \newlength{\kuromaru@boxwidth}
  \newlength{\kuromaru@textwidth}
  \newlength{\kuromaru@textheight}
  \DeclareRobustCommand{\kuromaru}[1]{%
    \settowidth{\kuromaru@textwidth}{#1}%
    \settoheight{\kuromaru@textheight}{#1}%
    \setlength{\kuromaru@boxwidth}{\f@size pt}%
    \multiply\kuromaru@boxwidth by  105 %
    \divide\kuromaru@boxwidth by 100 %
    \ltjghostbeforejachar%
    \vphantom{羅}\raisebox{\VerticalAdjustMaru}{%
      \hbox to \kuromaru@boxwidth{%
        \hss
        \tikz[baseline=(char.base), overlay]{%
          \node[
            shape=circle,
            line width=0.1ex,  
            minimum size=.9\kuromaru@boxwidth,  
            draw, fill=black,
            inner sep=\dimexpr -0.22\dimexpr\f@size pt    
          ] (char){%
            \raisebox{0.033ex}{\textcolor{white}{\scalebox{0.75}{\vphantom{羅}\makebox[.85\kuromaru@boxwidth][c]{\maybescale{\kuromaru@textwidth}{.85\kuromaru@boxwidth}{\maybescaleV{\kuromaru@textheight}{\kuromaru@boxwidth}{#1}}}}}}%
          };
        }%
        \hss
      }%
    }%
    \ltjghostafterjachar
  }
  \makeatother

  \makeatletter
  \newlength{\nmaru@boxwidth}
  \newlength{\nmaru@textwidth}
  \newlength{\nmaru@textheight}
  \DeclareRobustCommand{\nmaru}[1]{%
    \settowidth{\nmaru@textwidth}{#1}%
    \settoheight{\nmaru@textheight}{#1}%
    \setlength{\nmaru@boxwidth}{\f@size pt}%
    \multiply\nmaru@boxwidth by 105 %
    \divide\nmaru@boxwidth by 100 %
    \ltjghostbeforejachar%
    \vphantom{羅}\raisebox{\VerticalAdjustMaru}{%
      \hbox to 1.02\nmaru@boxwidth{%
        \hss
        \tikz[baseline=(char.base), overlay, scale=.93]{%
          \node[
            shape=circle,
            line width=0.1ex,  
            minimum size=.9\nmaru@boxwidth,  
            draw, double, double distance=0.08ex,
            inner sep=\dimexpr -0.22\dimexpr\f@size pt    
          ] (char){%
            \raisebox{0.033ex}{\scalebox{0.7}{\vphantom{羅}\makebox[.85\nmaru@boxwidth][c]{\maybescale{\nmaru@textwidth}{.85\nmaru@boxwidth}{\maybescaleV{\nmaru@textheight}{\nmaru@boxwidth}{#1}}}}}%
          };
        }%
        \hss
      }%
    }%
    \ltjghostafterjachar
  }
  \makeatother


  \newcommand{\VerticalAdjustMaruX}{%
    \ifnum\ltjgetparameter{direction}=3
      -.13ex % 縦組
    \else
      -.11ex  % 横組
    \fi
  }

  \newcommand{\VerticalAdjustMaruY}{%
    \ifnum\ltjgetparameter{direction}=3
      .124ex % 縦組
    \else
      .25ex  % 横組
    \fi
  }

  \makeatletter
  \newlength{\seihou@boxwidth}
  \newlength{\seihou@textwidth}
  \newlength{\seihou@textheight}
  \DeclareRobustCommand{\seihou}[1]{%
    \settowidth{\seihou@textwidth}{#1}%
    \settoheight{\seihou@textheight}{#1}%
    \setlength{\seihou@boxwidth}{\f@size pt}%
    \multiply\seihou@boxwidth by 123 %
    \divide\seihou@boxwidth by 100 %
    \ltjghostbeforejachar\vphantom{羅}\raisebox{\VerticalAdjustMaruX}{%
    \mbox{%
    \hbox to \seihou@boxwidth{%
    \hss
    \tikz[baseline=(char.base)]{%
        \node[draw, line width=0.1ex, minimum size=\dimexpr 0.95\dimexpr\f@size pt, inner sep=-\dimexpr 0.125\dimexpr\f@size pt, align=center] (char) {\vphantom{\raisebox{0.124ex}{羅}}{\raisebox{\VerticalAdjustMaruY}{\scalebox{.8}{\hspace*{\dimexpr 0.1\seihou@boxwidth}\makebox[.82\seihou@boxwidth][c]{\maybescale{\seihou@textwidth}{.82\seihou@boxwidth}{\maybescaleVV{\seihou@textheight}{\seihou@boxwidth}{#1}}}\hspace*{\dimexpr 0.1\seihou@boxwidth}}}}};
    }\hss}}}\ltjghostafterjachar
  }
  \makeatother

  \makeatletter
  \newlength{\kuroseihou@boxwidth}
  \newlength{\kuroseihou@textwidth}
  \newlength{\kuroseihou@textheight}
  \DeclareRobustCommand{\kuroseihou}[1]{%
    \settowidth{\kuroseihou@textwidth}{#1}%
    \settoheight{\kuroseihou@textheight}{#1}%
    \setlength{\kuroseihou@boxwidth}{\f@size pt}%
    \multiply\kuroseihou@boxwidth by 123 %
    \divide\kuroseihou@boxwidth by 100 %
    \ltjghostbeforejachar\vphantom{羅}\raisebox{\VerticalAdjustMaruX}{%
    \mbox{%
    \hbox to \kuroseihou@boxwidth{%
    \hss
    \tikz[baseline=(char.base)]{%
        \node[draw, fill=black, line width=0.1ex, minimum size=\dimexpr 0.95\dimexpr\f@size pt, inner sep=-\dimexpr 0.125\dimexpr\f@size pt, align=center] (char) {\vphantom{\raisebox{0.124ex}{羅}}{\raisebox{\VerticalAdjustMaruY}{\scalebox{.8}{\hspace*{\dimexpr 0.1\kuroseihou@boxwidth}\textcolor{white}{\makebox[.82\kuroseihou@boxwidth][c]{\maybescale{\kuroseihou@textwidth}{.82\kuroseihou@boxwidth}{\maybescaleVV{\kuroseihou@textheight}{\kuroseihou@boxwidth}{#1}}}}\hspace*{\dimexpr 0.1\kuroseihou@boxwidth}}}}};
    }\hss}}}\ltjghostafterjachar
  }
  \makeatother

  \makeatletter
  \newlength{\seimaru@boxwidth}
  \newlength{\seimaru@textwidth}
  \newlength{\seimaru@textheight}
  \DeclareRobustCommand{\seimaru}[1]{%
    \settowidth{\seimaru@textwidth}{#1}%
    \settoheight{\seimaru@textheight}{#1}%
    \setlength{\seimaru@boxwidth}{\f@size pt}%
    \multiply\seimaru@boxwidth by 123 %
    \divide\seimaru@boxwidth by 100 %
    \ltjghostbeforejachar\vphantom{羅}\raisebox{\VerticalAdjustMaruX}{%
    \mbox{%
    \hbox to \seimaru@boxwidth{%
    \hss
    \tikz[baseline=(char.base)]{%
        \node[draw, rounded corners=0.435ex, line width=0.1ex, minimum size=.8\seimaru@boxwidth, inner sep=-\dimexpr 0.125\dimexpr\f@size pt, align=center] (char) {\vphantom{\raisebox{0.124ex}{羅}}{\raisebox{\VerticalAdjustMaruY}{\scalebox{.8}{\hspace*{\dimexpr 0.1\seimaru@boxwidth}\makebox[.8\seimaru@boxwidth][c]{\maybescale{\seimaru@textwidth}{.82\seimaru@boxwidth}{\maybescaleVV{\seimaru@textheight}{\seimaru@boxwidth}{#1}}}\hspace*{\dimexpr 0.1\seimaru@boxwidth}}}}};
    }\hss}}}\ltjghostafterjachar
  }
  \makeatother

  \makeatletter
  \newlength{\kuroseimaru@boxwidth}
  \newlength{\kuroseimaru@textwidth}
  \newlength{\kuroseimaru@textheight}
  \DeclareRobustCommand{\kuroseimaru}[1]{%
    \settowidth{\kuroseimaru@textwidth}{#1}%
    \settoheight{\kuroseimaru@textheight}{#1}%
    \setlength{\kuroseimaru@boxwidth}{\f@size pt}%
    \multiply\kuroseimaru@boxwidth by 123 %
    \divide\kuroseimaru@boxwidth by 100 %
    \ltjghostbeforejachar\vphantom{羅}\raisebox{\VerticalAdjustMaruX}{%
    \mbox{%
    \hbox to \kuroseimaru@boxwidth{%
    \hss
    \tikz[baseline=(char.base)]{%
        \node[draw, fill=black, rounded corners=0.435ex, line width=0.1ex, minimum size=.8\kuroseimaru@boxwidth, inner sep=-\dimexpr 0.125\dimexpr\f@size pt, align=center] (char) {\vphantom{\raisebox{0.124ex}{羅}}{\raisebox{\VerticalAdjustMaruY}{\scalebox{.8}{\hspace*{\dimexpr 0.1\kuroseimaru@boxwidth}\textcolor{white}{\makebox[.8\kuroseimaru@boxwidth][c]{\maybescale{\kuroseimaru@textwidth}{.82\kuroseimaru@boxwidth}{\maybescaleVV{\kuroseimaru@textheight}{\kuroseimaru@boxwidth}{#1}}}}\hspace*{\dimexpr 0.1\kuroseimaru@boxwidth}}}}};
    }\hss}}}\ltjghostafterjachar
  }
  \makeatother

  \newcommand{\VerticalAdjustMaruZ}{%
    \ifnum\ltjgetparameter{direction}=3
      .1ex % 縦組
    \else
      .42ex  % 横組
    \fi
  }

  \makeatletter
  \newlength{\hishi@boxwidth}
  \newlength{\hishi@textwidth}
  \newlength{\hishi@textheight}
  \DeclareRobustCommand{\hishi}[1]{%
    \settowidth{\hishi@textwidth}{#1}%
    \settoheight{\hishi@textheight}{#1}%
    \setlength{\hishi@boxwidth}{\f@size pt}%
    \multiply\hishi@boxwidth by 123 %
    \divide\hishi@boxwidth by 100 %
    \ltjghostbeforejachar\vphantom{羅}\raisebox{\VerticalAdjustMaruX}{%
    \mbox{%
    \hbox to 1.05\hishi@boxwidth{%
    \hss
    \tikz[baseline=(char.base)]{%
        \node[draw, shape=diamond, line width=0.1ex, minimum size=\dimexpr 0.95\dimexpr\f@size pt, inner sep=-\dimexpr .13\hishi@boxwidth, align=center] (char) {\vphantom{\raisebox{0.124ex}{羅}}{\raisebox{\VerticalAdjustMaruZ}{\scalebox{.7}{\hspace*{\dimexpr 0.1\hishi@boxwidth}\makebox[.7\hishi@boxwidth][c]{\maybescale{\hishi@textwidth}{.7\hishi@boxwidth}{\maybescaleVVV{\hishi@textheight}{\hishi@boxwidth}{#1}}}\hspace*{\dimexpr 0.1\hishi@boxwidth}}}}};
    }\hss}}}\ltjghostafterjachar
  }
  \makeatother

  \makeatletter
  \newlength{\kurohishi@boxwidth}
  \newlength{\kurohishi@textwidth}
  \newlength{\kurohishi@textheight}
  \DeclareRobustCommand{\kurohishi}[1]{%
    \settowidth{\kurohishi@textwidth}{#1}%
    \settoheight{\kurohishi@textheight}{#1}%
    \setlength{\kurohishi@boxwidth}{\f@size pt}%
    \multiply\kurohishi@boxwidth by 123 %
    \divide\kurohishi@boxwidth by 100 %
    \ltjghostbeforejachar\vphantom{羅}\raisebox{\VerticalAdjustMaruX}{%
    \mbox{%
    \hbox to 1.05\kurohishi@boxwidth{%
    \hss
    \tikz[baseline=(char.base)]{%
        \node[draw, shape=diamond, fill=black, line width=0.1ex, minimum size=\dimexpr 0.95\dimexpr\f@size pt, inner sep=-\dimexpr .13\kurohishi@boxwidth, align=center] (char) {\vphantom{\raisebox{0.124ex}{羅}}{\raisebox{\VerticalAdjustMaruZ}{\scalebox{.7}{\hspace*{\dimexpr 0.1\kurohishi@boxwidth}\textcolor{white}{\makebox[.7\kurohishi@boxwidth][c]{\maybescale{\kurohishi@textwidth}{.7\kurohishi@boxwidth}{\maybescaleVVV{\kurohishi@textheight}{\kurohishi@boxwidth}{#1}}}\hspace*{\dimexpr 0.1\kurohishi@boxwidth}}}}}};
    }\hss}}}\ltjghostafterjachar
  }
  \makeatother

  \makeatletter
  \newlength{\maruhishi@boxwidth}
  \newlength{\maruhishi@textwidth}
  \newlength{\maruhishi@textheight}
  \DeclareRobustCommand{\maruhishi}[1]{%
    \settowidth{\maruhishi@textwidth}{#1}%
    \settoheight{\maruhishi@textheight}{#1}%
    \setlength{\maruhishi@boxwidth}{\f@size pt}%
    \multiply\maruhishi@boxwidth by 123 %
    \divide\maruhishi@boxwidth by 100 %
    \ltjghostbeforejachar\vphantom{羅}\raisebox{\VerticalAdjustMaruX}{%
    \mbox{%
    \hbox to 1.05\maruhishi@boxwidth{%
    \hss
    \tikz[baseline=(char.base)]{%
        \node[draw, rounded corners=0.3ex, shape=diamond, line width=0.1ex, minimum size=\dimexpr 0.95\dimexpr\f@size pt, inner sep=-\dimexpr .13\maruhishi@boxwidth, align=center] (char) {\vphantom{\raisebox{0.124ex}{羅}}{\raisebox{\VerticalAdjustMaruZ}{\scalebox{.7}{\hspace*{\dimexpr 0.1\maruhishi@boxwidth}\makebox[.7\maruhishi@boxwidth][c]{\maybescale{\maruhishi@textwidth}{.7\maruhishi@boxwidth}{\maybescaleVVV{\maruhishi@textheight}{\maruhishi@boxwidth}{#1}}}\hspace*{\dimexpr 0.1\maruhishi@boxwidth}}}}};
    }\hss}}}\ltjghostafterjachar
  }
  \makeatother

  \makeatletter
  \newlength{\kuromaruhishi@boxwidth}
  \newlength{\kuromaruhishi@textwidth}
  \newlength{\kuromaruhishi@textheight}
  \DeclareRobustCommand{\kuromaruhishi}[1]{%
    \settowidth{\kuromaruhishi@textwidth}{#1}%
    \settoheight{\kuromaruhishi@textheight}{#1}%
    \setlength{\kuromaruhishi@boxwidth}{\f@size pt}%
    \multiply\kuromaruhishi@boxwidth by 123 %
    \divide\kuromaruhishi@boxwidth by 100 %
    \ltjghostbeforejachar\vphantom{羅}\raisebox{\VerticalAdjustMaruX}{%
    \mbox{%
    \hbox to 1.05\kuromaruhishi@boxwidth{%
    \hss
    \tikz[baseline=(char.base)]{%
        \node[draw, fill=black, rounded corners=0.3ex, shape=diamond, line width=0.1ex, minimum size=\dimexpr 0.95\dimexpr\f@size pt, inner sep=-\dimexpr .13\kuromaruhishi@boxwidth, align=center] (char) {\vphantom{\raisebox{0.124ex}{羅}}{\raisebox{\VerticalAdjustMaruZ}{\scalebox{.7}{\hspace*{\dimexpr 0.1\kuromaruhishi@boxwidth}\textcolor{white}{\makebox[.7\kuromaruhishi@boxwidth][c]{\maybescale{\kuromaruhishi@textwidth}{.7\kuromaruhishi@boxwidth}{\maybescaleVVV{\kuromaruhishi@textheight}{\kuromaruhishi@boxwidth}{#1}}}\hspace*{\dimexpr 0.1\kuromaruhishi@boxwidth}}}}}};
    }\hss}}}\ltjghostafterjachar
  }
  \makeatother

  \newcommand{\VerticalAdjustKakkoX}{%
    \ifnum\ltjgetparameter{direction}=3
      -0ex % 縦組
    \else
      -0ex  % 横組
    \fi
  }

  \makeatletter
  \newlength{\kakko@boxwidth}
  \newlength{\kakko@textwidth}
  \newlength{\kakko@textheight}
  \DeclareRobustCommand{\kakko}[1]{%
    \settowidth{\kakko@textwidth}{#1}%
    \settoheight{\kakko@textheight}{#1}%
    \setlength{\kakko@boxwidth}{\f@size pt}%
    \multiply\kakko@boxwidth by 123 %
    \divide\kakko@boxwidth by 100 %
    \ltjghostbeforejachar\vphantom{羅}\raisebox{\VerticalAdjustKakkoX}{%
    \mbox{%
    \hbox to \kakko@boxwidth{%
    \hss
    \tikz[baseline=(char.base)]{%
        \node[inner sep=-\dimexpr 0.125\dimexpr\f@size pt, align=center, minimum size=.8\kakko@boxwidth] (char) {{\raisebox{\VerticalAdjustKakkoX}{\scalebox{1}{\hspace*{\dimexpr 0.02\kakko@boxwidth}\makebox[.5\kakko@boxwidth][c]{\scalebox{.8}[1]{（}\maybescale{\kakko@textwidth}{.5\kakko@boxwidth}{\maybescaleVVVV{\kakko@textheight}{\kakko@boxwidth}{#1}}\scalebox{.8}[1]{）}}\hspace*{\dimexpr 0.02\kakko@boxwidth}}}}};
    }\hss}}}\ltjghostafterjachar
  }
  \makeatother

  \makeatletter
  \newlength{\sumikakko@boxwidth}
  \newlength{\sumikakko@textwidth}
  \newlength{\sumikakko@textheight}
  \DeclareRobustCommand{\sumikakko}[1]{%
    \settowidth{\sumikakko@textwidth}{#1}%
    \settoheight{\sumikakko@textheight}{#1}%
    \setlength{\sumikakko@boxwidth}{\f@size pt}%
    \multiply\sumikakko@boxwidth by 123 %
    \divide\sumikakko@boxwidth by 100 %
    \ltjghostbeforejachar\vphantom{羅}\raisebox{\VerticalAdjustKakkoX}{%
    \mbox{%
    \hbox to \sumikakko@boxwidth{%
    \hss
    \tikz[baseline=(char.base)]{%
        \node[inner sep=-\dimexpr 0.125\dimexpr\f@size pt, align=center, minimum size=.8\sumikakko@boxwidth] (char) {{\raisebox{\VerticalAdjustKakkoX}{\scalebox{1}{\hspace*{\dimexpr 0.02\sumikakko@boxwidth}\makebox[.5\sumikakko@boxwidth][c]{\scalebox{.6}[1]{【}\maybescale{\sumikakko@textwidth}{.5\sumikakko@boxwidth}{\maybescaleVVVV{\sumikakko@textheight}{\sumikakko@boxwidth}{#1}}\scalebox{.6}[1]{】}}\hspace*{\dimexpr 0.02\sumikakko@boxwidth}}}}};
    }\hss}}}\ltjghostafterjachar
  }
  \makeatother

  \makeatletter
  \newlength{\kakukakko@boxwidth}
  \newlength{\kakukakko@textwidth}
  \newlength{\kakukakko@textheight}
  \DeclareRobustCommand{\kakukakko}[1]{%
    \settowidth{\kakukakko@textwidth}{#1}%
    \settoheight{\kakukakko@textheight}{#1}%
    \setlength{\kakukakko@boxwidth}{\f@size pt}%
    \multiply\kakukakko@boxwidth by 123 %
    \divide\kakukakko@boxwidth by 100 %
    \ltjghostbeforejachar\vphantom{羅}\raisebox{\VerticalAdjustKakkoX}{%
    \mbox{%
    \hbox to \kakukakko@boxwidth{%
    \hss
    \tikz[baseline=(char.base)]{%
        \node[inner sep=-\dimexpr 0.125\dimexpr\f@size pt, align=center, minimum size=.8\kakukakko@boxwidth] (char) {{\raisebox{\VerticalAdjustKakkoX}{\scalebox{1}{\hspace*{\dimexpr 0.02\kakukakko@boxwidth}\makebox[.5\kakukakko@boxwidth][c]{\scalebox{.6}[1]{［}\maybescale{\kakukakko@textwidth}{.5\kakukakko@boxwidth}{\maybescaleVVVV{\kakukakko@textheight}{\kakukakko@boxwidth}{#1}}\scalebox{.6}[1]{］}}\hspace*{\dimexpr 0.02\kakukakko@boxwidth}}}}};
    }\hss}}}\ltjghostafterjachar
  }
  \makeatother

  \makeatletter
  \newlength{\kikakko@boxwidth}
  \newlength{\kikakko@textwidth}
  \newlength{\kikakko@textheight}
  \DeclareRobustCommand{\kikakko}[1]{%
    \settowidth{\kikakko@textwidth}{#1}%
    \settoheight{\kikakko@textheight}{#1}%
    \setlength{\kikakko@boxwidth}{\f@size pt}%
    \multiply\kikakko@boxwidth by 123 %
    \divide\kikakko@boxwidth by 100 %
    \ltjghostbeforejachar\vphantom{羅}\raisebox{\VerticalAdjustKakkoX}{%
    \mbox{%
    \hbox to \kikakko@boxwidth{%
    \hss
    \tikz[baseline=(char.base)]{%
        \node[inner sep=-\dimexpr 0.125\dimexpr\f@size pt, align=center, minimum size=.8\kikakko@boxwidth] (char) {{\raisebox{\VerticalAdjustKakkoX}{\scalebox{1}{\hspace*{\dimexpr 0.02\kikakko@boxwidth}\makebox[.5\kikakko@boxwidth][c]{\scalebox{.6}[1]{〔}\maybescale{\kikakko@textwidth}{.5\kikakko@boxwidth}{\maybescaleVVVV{\kikakko@textheight}{\kikakko@boxwidth}{#1}}\scalebox{.6}[1]{〕}}\hspace*{\dimexpr 0.02\kikakko@boxwidth}}}}};
    }\hss}}}\ltjghostafterjachar
  }
  \makeatother

  \makeatletter
  \newlength{\ykakko@boxwidth}
  \newlength{\ykakko@textwidth}
  \newlength{\ykakko@textheight}
  \DeclareRobustCommand{\ykakko}[1]{%
    \settowidth{\ykakko@textwidth}{#1}%
    \settoheight{\ykakko@textheight}{#1}%
    \setlength{\ykakko@boxwidth}{\f@size pt}%
    \multiply\ykakko@boxwidth by 123 %
    \divide\ykakko@boxwidth by 100 %
    \ltjghostbeforejachar\vphantom{羅}\raisebox{\VerticalAdjustKakkoX}{%
    \mbox{%
    \hbox to \ykakko@boxwidth{%
    \hss
    \tikz[baseline=(char.base)]{%
        \node[inner sep=-\dimexpr 0.125\dimexpr\f@size pt, align=center, minimum size=.8\ykakko@boxwidth] (char) {{\raisebox{\VerticalAdjustKakkoX}{\scalebox{1}{\hspace*{\dimexpr 0.02\ykakko@boxwidth}\makebox[.5\ykakko@boxwidth][c]{\scalebox{.6}[1]{〈}\maybescale{\ykakko@textwidth}{.5\ykakko@boxwidth}{\maybescaleVVVV{\ykakko@textheight}{\ykakko@boxwidth}{#1}}\scalebox{.6}[1]{〉}}\hspace*{\dimexpr 0.02\ykakko@boxwidth}}}}};
    }\hss}}}\ltjghostafterjachar
  }
  \makeatother

  \makeatletter
  \newlength{\nykakko@boxwidth}
  \newlength{\nykakko@textwidth}
  \newlength{\nykakko@textheight}
  \DeclareRobustCommand{\nykakko}[1]{%
    \settowidth{\nykakko@textwidth}{#1}%
    \settoheight{\nykakko@textheight}{#1}%
    \setlength{\nykakko@boxwidth}{\f@size pt}%
    \multiply\nykakko@boxwidth by 123 %
    \divide\nykakko@boxwidth by 100 %
    \ltjghostbeforejachar\vphantom{羅}\raisebox{\VerticalAdjustKakkoX}{%
    \mbox{%
    \hbox to \nykakko@boxwidth{%
    \hss
    \tikz[baseline=(char.base)]{%
        \node[inner sep=-\dimexpr 0.125\dimexpr\f@size pt, align=center, minimum size=.8\nykakko@boxwidth] (char) {{\raisebox{\VerticalAdjustKakkoX}{\scalebox{1}{\hspace*{\dimexpr 0.02\nykakko@boxwidth}\makebox[.5\nykakko@boxwidth][c]{\scalebox{.6}[1]{《}\maybescale{\nykakko@textwidth}{.5\nykakko@boxwidth}{\maybescaleVVVV{\nykakko@textheight}{\nykakko@boxwidth}{#1}}\scalebox{.6}[1]{》}}\hspace*{\dimexpr 0.02\nykakko@boxwidth}}}}};
    }\hss}}}\ltjghostafterjachar
  }
  \makeatother

  \makeatletter
  \newlength{\namikakko@boxwidth}
  \newlength{\namikakko@textwidth}
  \newlength{\namikakko@textheight}
  \DeclareRobustCommand{\namikakko}[1]{%
    \settowidth{\namikakko@textwidth}{#1}%
    \settoheight{\namikakko@textheight}{#1}%
    \setlength{\namikakko@boxwidth}{\f@size pt}%
    \multiply\namikakko@boxwidth by 123 %
    \divide\namikakko@boxwidth by 100 %
    \ltjghostbeforejachar\vphantom{羅}\raisebox{\VerticalAdjustKakkoX}{%
    \mbox{%
    \hbox to \namikakko@boxwidth{%
    \hss
    \tikz[baseline=(char.base)]{%
        \node[inner sep=-\dimexpr 0.125\dimexpr\f@size pt, align=center, minimum size=.8\namikakko@boxwidth] (char) {{\raisebox{\VerticalAdjustKakkoX}{\scalebox{1}{\hspace*{\dimexpr 0.02\namikakko@boxwidth}\makebox[.5\namikakko@boxwidth][c]{\scalebox{.6}[1]{｛}\maybescale{\namikakko@textwidth}{.5\namikakko@boxwidth}{\maybescaleVVVV{\namikakko@textheight}{\namikakko@boxwidth}{#1}}\scalebox{.6}[1]{｝}}\hspace*{\dimexpr 0.02\namikakko@boxwidth}}}}};
    }\hss}}}\ltjghostafterjachar
  }
  \makeatother

  \makeatletter
  \newlength{\kagikakko@boxwidth}
  \newlength{\kagikakko@textwidth}
  \newlength{\kagikakko@textheight}
  \DeclareRobustCommand{\kagikakko}[1]{%
    \settowidth{\kagikakko@textwidth}{#1}%
    \settoheight{\kagikakko@textheight}{#1}%
    \setlength{\kagikakko@boxwidth}{\f@size pt}%
    \multiply\kagikakko@boxwidth by 123 %
    \divide\kagikakko@boxwidth by 100 %
    \ltjghostbeforejachar\vphantom{羅}\raisebox{\VerticalAdjustKakkoX}{%
    \mbox{%
    \hbox to \kagikakko@boxwidth{%
    \hss
    \tikz[baseline=(char.base)]{%
        \node[inner sep=-\dimexpr 0.125\dimexpr\f@size pt, align=center, minimum size=.8\kagikakko@boxwidth] (char) {{\raisebox{\VerticalAdjustKakkoX}{\scalebox{1}{\hspace*{\dimexpr 0.02\kagikakko@boxwidth}\makebox[.5\kagikakko@boxwidth][c]{\scalebox{.6}[1]{「}\maybescale{\kagikakko@textwidth}{.5\kagikakko@boxwidth}{\maybescaleVVVV{\kagikakko@textheight}{\kagikakko@boxwidth}{#1}}\scalebox{.6}[1]{」}}\hspace*{\dimexpr 0.02\kagikakko@boxwidth}}}}};
    }\hss}}}\ltjghostafterjachar
  }
  \makeatother

  \makeatletter
  \newlength{\nkagikakko@boxwidth}
  \newlength{\nkagikakko@textwidth}
  \newlength{\nkagikakko@textheight}
  \DeclareRobustCommand{\nkagikakko}[1]{%
    \settowidth{\nkagikakko@textwidth}{#1}%
    \settoheight{\nkagikakko@textheight}{#1}%
    \setlength{\nkagikakko@boxwidth}{\f@size pt}%
    \multiply\nkagikakko@boxwidth by 123 %
    \divide\nkagikakko@boxwidth by 100 %
    \ltjghostbeforejachar\vphantom{羅}\raisebox{\VerticalAdjustKakkoX}{%
    \mbox{%
    \hbox to \nkagikakko@boxwidth{%
    \hss
    \tikz[baseline=(char.base)]{%
        \node[inner sep=-\dimexpr 0.125\dimexpr\f@size pt, align=center, minimum size=.8\nkagikakko@boxwidth] (char) {{\raisebox{\VerticalAdjustKakkoX}{\scalebox{1}{\hspace*{\dimexpr 0.02\nkagikakko@boxwidth}\makebox[.5\nkagikakko@boxwidth][c]{\scalebox{.6}[1]{『}\maybescale{\nkagikakko@textwidth}{.5\nkagikakko@boxwidth}{\maybescaleVVVV{\nkagikakko@textheight}{\nkagikakko@boxwidth}{#1}}\scalebox{.6}[1]{』}}\hspace*{\dimexpr 0.02\nkagikakko@boxwidth}}}}};
    }\hss}}}\ltjghostafterjachar
  }
  \makeatother

  \makeatletter
  \newlength{\period@boxwidth}
  \newlength{\period@textwidth}
  \newlength{\period@textheight}
  \DeclareRobustCommand{\period}[1]{%
    \settowidth{\period@textwidth}{#1}%
    \setlength{\period@boxwidth}{\f@size pt}%
    \settoheight{\period@textheight}{#1}%
    \multiply\period@boxwidth by 123 %
    \divide\period@boxwidth by 100 %
    \ltjghostbeforejachar\vphantom{羅}\raisebox{\VerticalAdjustKakkoX}{%
    \mbox{%
    \hbox to \period@boxwidth{%
    \hss
    \tikz[baseline=(char.base)]{%
        \node[inner sep=-\dimexpr 0.125\dimexpr\f@size pt, align=center, minimum size=.8\period@boxwidth] (char) {{\raisebox{\VerticalAdjustKakkoX}{\scalebox{1}{\hspace*{\dimexpr 0.02\period@boxwidth}\makebox[.5\period@boxwidth][c]{\maybescale{\period@textwidth}{.5\period@boxwidth}{\maybescaleVVVV{\period@textheight}{\period@boxwidth}{#1}}\scalebox{1}[1]{.}}\hspace*{\dimexpr 0.02\period@boxwidth}}}}};
    }\hss}}}\ltjghostafterjachar
  }
  \makeatother

  \endinput
\end{lstlisting}
\end{document}