10

I'm trying to figure out a way of creating a Japanese character practice sheet. The type that I'm looking to create looks a little like the Genkou Youshi that this question was looking to cover. Except that a Japanese character is inserted into the topmost 4-5 boxes of a row, where the instances of the character after the first are printed in a progressively lighter shade until they have faded away completely.

Here's an example of what I'm looking to create:

enter image description here

Is this possible to do? If so, where should I start? I'm a bit of a beginner to TeX, but am willing to learn.

I'm currently using:

  • TexMaker 3.5
  • TexLive 2011
  • Windows 7 (But I can move over the Debian if needed)
  • This answer from the previously mentioned question.
  • The Japanese character set contains a LOT of Chinese characters, too. – Jamie Taylor May 20 '13 at 11:13
9

Here you go. My code is a mild extension of this answer by Paul Gaborit.

Code

\documentclass{article}
\usepackage{tikz}
\pagestyle{empty}
\newcommand\genkoyoshi[4]{%
  \def\rowopacities{#1}%
  \def\colnames{#2}%
  \def\size{#3}%
  \def\sep{#4}%
  \begin{tikzpicture}[yscale=-1]
    \pgfmathsetmacro{\inc}{\size+\sep}
    \newcounter{col}
    \newcounter{row}
    \foreach \colname in \colnames{
      \addtocounter{col}{1}
      \setcounter{row}{0}
      \foreach \rowopacity in \rowopacities{
        \addtocounter{row}{1}
        \draw ({(\thecol-1)*\inc pt},{\therow*\size})
        rectangle ++ (\size,\size);
        \node[text=black!\rowopacity] at ({(\thecol-1)*\inc+\size*0.5 pt},{\therow*\size+\size*0.5}) {\colname};
      }
    }
  \end{tikzpicture}%
}
\begin{document}
\genkoyoshi{100,66,33,0,0,0,0,0,0,0}{a,b,c,d,e,f,g,h,i,j,k}{8mm}{2mm}
\end{document}

Comments on the code

  • The list 100,66,33,0,0,0,0,0,0,0 gives the opacity of each row -- 0 is transparent, and 100 is completely black. The length of that list gives the number of rows, hence the 0 fillers at the end.

  • The list a,b,c,d,e,f,g,h,i,j,k gives the character you want in each column.

  • The 8mm is the height and width of each cell, and the 2mm is the size of the gap between columns

  • The notation black!40 gives a colour that is 40% black and 60% white.

  • Each letter is centred horizontally and vertically in its cell, which is why the g looks a bit high and the d looks a bit low. If you don't like this, change {\colname} on line 20 to {\strut\colname}.

Result

enter image description here

  • Wow! This is exactly what I'm looking for, thanks. Wish me luck in deciphering/understanding the code – Jamie Taylor May 20 '13 at 11:16
  • 1
    Good luck! (I added a few explanatory comments.) – John Wickerson May 20 '13 at 12:39
4

I found a suitable basis in How to color the font of a single row in a table?

\documentclass{article}
\usepackage{tabu}
\usepackage{xcolor}

\begin{document}
\begin{tabu}{ |l|l| l| l| l| } \hline
\rowfont{\color{gray!90}}    0   & 1 & 2 & 3 & 4 \\  \hline
\rowfont{\color{gray!80}}        1   & A & B & C & D \\ \hline
\rowfont{\color{gray!70}}        2   & A & B & C & D \\ \hline
\rowfont{\color{gray!60}}        3   & A & B & C & D \\ \hline
\rowfont{\color{gray!50}}        4   & A & B & C & D \\ \hline
\rowfont{\color{gray!40}}        5   & A & B & C & D \\ \hline
\rowfont{\color{gray!30}}        6   & A & B & C & D \\ \hline
\rowfont{\color{gray!20}}        7   & A & B & C & D \\ \hline
\rowfont{\color{gray!10}}        8   & A & B & C & D \\ \hline
\end{tabu}
\end{document}

tabu

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.