更新

更新

我一直在想办法制作名为“Kunkunshi”的冲绳乐谱(见下图)。

天堂之花

基本上,我想制作一个日语字符网格。一列中应该有十二个方格,方格之间的间隙约为方格宽度的 66%。字符应该位于方格的中央,或者以较小的字体位于两个方格的中间。理想情况下,歌词可以写在网格中字符的旁边,如图所示。

我能找到的最接近的帮助是关于日语手写模板的这个问题

答案1

下面将提供一些入门知识。有一个循环用于绘制网格,以及一个基本的 API 用于将字母放在某些单元格、行或“歌词”位置。如果需要,请在评论中寻求澄清。

\documentclass [border=2mm]{standalone} 
\usepackage{tikz}

\begin{document}

\def\atcenter#1#2#3{ 
  % Puts #3 at cell (#1,#2)
  \path (#1,#2) +(.3,.5) node {#3};
}

\def\atline#1#2#3{
  % Puts #3 at the line between cells (#1, #2-0.5) and (#1, #2+0.5)
  \path (#1,#2) +(.3,.5) node[fill=white, font=\tiny, inner xsep=1mm, inner ysep=0] {#3};
}

\def\lyrics#1#2#3{
  % Puts #3 at the right side of the column #1, at fractional y-coordinate #2
  \path (#1,.5) +(.6,#2) node[font=\tiny,anchor=west, inner sep=0.5mm] {#3};
}

\begin{tikzpicture}[x=10mm,y=-6mm]

    % Draw the grid
    \draw[thick] (1,1) rectangle (11,13);
    \foreach \column in {1,...,10} {
      \foreach \row in {1,...,12} {
         \draw (\column,\row) rectangle +(0.6,1);
         }
    }

    % Some example letters in cells
    \foreach \letter [count=\i  from 1] in {A,B,C,D,E,F,G,H,I,J,K,L} {
      \atcenter{10}{\i}{\letter};
    }

    % Some example letters at lines
    \atline{10}{2.5}{a};
    \atline{10}{3.5}{b};

    % Another column with letter
    \foreach \letter [count=\i  from 1] in {M,N,O,P,Q,R} {
      \atcenter{9}{\i}{\letter};
    }

    % Example "lyrics". Note the expression used as #2
    \foreach \letter [count=\i from 1] in {f,o,o,b,a,r} {
      \lyrics{9}{3+\i*0.4}{\letter}
    }
\end{tikzpicture}
\end{document}

上述代码产生:

结果

更新

只是为了好玩,用日语字符尝试了一下,看看它是否有效。它成功了!(需要 xelatex 和 AozoraMinchoRegular.ttf 字体,自由的)。

免责声明我一句日语都不懂:-)

代码:

\documentclass [border=2mm]{standalone}
\usepackage{xeCJK}
\setCJKmainfont{AozoraMinchoRegular.ttf}
\usepackage{tikz}

\begin{document}

\def\atcenter#1#2#3{ 
  % Puts #3 at cell (#1,#2)
  \path (#1,#2) +(.3,.5) node {#3};
}

\def\atline#1#2#3{
  % Puts #3 at the line between cells (#1, #2-0.5) and (#1, #2+0.5)
  \path (#1,#2) +(.3,.5) node[fill=white, font=\tiny, inner xsep=1mm, inner ysep=0] {#3};
}

\def\lyrics#1#2#3{
  % Puts #3 at the right side of the column #1, at fractional y-coordinate #2
  \path (#1,.5) +(.6,#2) node[font=\tiny,anchor=west, inner sep=0.5mm] {#3};
}

\begin{tikzpicture}[x=10mm,y=-6mm]

    % Draw the grid
    \draw[thick] (1,1) rectangle (11,13);
    \foreach \column in {1,...,10} {
      \foreach \row in {1,...,12} {
         \draw (\column,\row) rectangle +(0.6,1);
         }
    }

    % Some example letters in cells
    \foreach \letter [count=\i  from 1] in {中,中,工,上,四,合,四,五,中,中,工,上}
    {
      \atcenter{10}{\i}{\letter};
    }

    % Some example letters at lines
    \atline{10}{2.5}{五};
    \atline{10}{3.5}{中};

    % Another column with letter
    \foreach \letter [count=\i  from 1] in {四,合,四,五,中,中,工,上}
    {
      \atcenter{9}{\i}{\letter};
    }

    % Example "lyrics". Note the expression used as #2
    \foreach \letter [count=\i from 1] in {日,本,語,で} {
      \lyrics{9}{3+\i*0.5}{\letter}
    }
\end{tikzpicture}
\end{document}

结果:

日文成绩

相关内容