3

I wanted to create a Genkō yōshi template, for typing Japanese characters. It is just rows of squares with gaps in between.

This is what I want to do (20x20): enter image description here

I have taken a look at other forms but they are all vertical instead of horizontal: Japanese practise paper (Genkou Youshi)

I am using Ubuntu 18.04, Texmaker 5.0.2.

1 Answer 1

5

Perhaps something like this:

enter image description here

To do this I have used tikz to define a command \Genkoyoashi that accepts optional arguments to change the appearance. The images above were generated by:

   \Genkoyoshi
   \Genkoyoshi[color=red, columns=10, size=1.2, rows=10]

In general, the optional arguments are key-value pairs to set:

  • color: the colour of the template (default: MidnightBlue - requires svgnames)
  • columns: the number of columns (default: 20)
  • rows: the number of rows (default: 20)
  • size: sets the size/scale of the boxes (default: 0.7)

Here is the full code:

\documentclass[svgnames]{article}
\usepackage{tikz}
\parindent0pt
\tikzset{
  /genkoyoshi/.cd,
    color/.initial=MidnightBlue,
    columns/.initial=20,
    rows/.initial=20,
    size/.initial=0.7
}
\newcommand\GeNkOyOsHi[1]{\pgfkeysvalueof{/genkoyoshi/#1}}
\newcommand\Genkoyoshi[1][]{%
  \begin{center}
    \tikzset{/genkoyoshi/.cd, #1}
    \begin{tikzpicture}[scale=\GeNkOyOsHi{size}]
      \foreach \lin in {1,...,\GeNkOyOsHi{rows}} {
          \draw[\GeNkOyOsHi{color}] (0,-\lin)--++(0.7*\GeNkOyOsHi{columns},0);
          \draw[\GeNkOyOsHi{color}] (0,-\lin-0.7)--++(0.7*\GeNkOyOsHi{columns},0);
          \foreach \bx in {0,...,\GeNkOyOsHi{columns}} {
              \draw[\GeNkOyOsHi{color}] (\bx*0.7, -\lin)--++(0,-0.7);
          }
      }
      \draw[\GeNkOyOsHi{color},thick] ([yshift=3mm]current bounding box.north west)
                      rectangle ([yshift=-3mm]current bounding box.south east);
    \end{tikzpicture}
  \end{center}
}
\begin{document}

   \Genkoyoshi
   \Genkoyoshi[color=red, columns=10, size=1.2, rows=10]

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .