Hello Li-Feng!

I'm Ccing the cjk mailing list so that my work might help others
also.  And please write to this list for further communication!

> Thank you for your code for CJK.  Now, I found a problem about CJK
> in Chinese when my daughter come to primary school to learn Chinese.
> I found that the primary school Chinese techer lack a way to
> typesetting Chinese characters and pinyin by China primary school
> habit.
> 
> I attached one gif file to give description about how to typesetting
> Chinese character & PinYin synchronnic.
> 
> The blue color lines and dot lines are used to give primary students
> information about the relation between character and pinyin and tone
> system.
> 
> I want to try to write package file to typesetting the format used
> by Chinese primary school teachers. but I found I have not ability
> now. so I hope you can spend some time to write it for Chinese
> primary students.
> 
> The picture which I give you, it is called "Tian" character format
> (田字格) . I hope I can use "tian" as command when I use LaTeX to
> typesetting it.

Using tikz, it's rather easy to do what you want.  The attached
example shows how to set up such a command which I've calld \tianbox.
You should adapt the code to your needs, checking the tikz manual for
details.


    Werner
% tianbox.sty
%
% This file provides a single command, \tianbox, which puts a CJK glyph
% together with its transcription into a box as needed by some primary
% schoolbooks in China.

\def\fileversion{0.1}
\def\filedate{2011/12/27}

\ProvidesPackage{tianbox}[\filedate\space\fileversion]


\RequirePackage{tikz}


% Parameters to control the appearance of the box.

\tikzset{every picture/.style={scale=0.5,
                               baseline=0pt}}
\tikzset{tianbox/.style={color=blue,
                         line width=2pt}}
\tikzset{tianaux/.style={color=blue!50,
                         line width=0.5pt}}
\tikzset{CJK/.style={font=\fontsize{80pt}{100pt}%
                          \selectfont}}
\tikzset{transcription/.style={font=\fontsize{20pt}{20pt}%
                                    \selectfont}}

% #1   A CJK character, printed in large size.
% #2   Its transcription, printed above

\def\tianbox#1#2{%
  \tikzpicture
    % to get regular dot patterns (in case dotted lines are selected),
    % we always start the lines from the center
    \draw[tianaux] (0,0) -- (3,3);
    \draw[tianaux] (0,0) -- (3,-3);
    \draw[tianaux] (0,0) -- (3,0);
    \draw[tianaux] (0,0) -- (0,3);
    \draw[tianaux] (0,0) -- (-3,-3);
    \draw[tianaux] (0,0) -- (-3,3);
    \draw[tianaux] (0,0) -- (-3,0);
    \draw[tianaux] (0,0) -- (0,-3);

    \draw[tianaux] (-3,4) -- (3,4);
    \draw[tianaux] (-3,5) -- (3,5);

    \draw[tianbox] (-3,-3) rectangle (3,6);
    \draw[tianbox] (-3,3) -- (3,3);

    \draw[CJK] (0,0) node {#1};
    \draw[transcription] (0,4) node[anchor=base] {#2};
  \endtikzpicture
}

\endinput
\documentclass{article}

\usepackage{CJKutf8}
\usepackage{pinyin}
\usepackage{tianbox}


% The following line shows how to override the default values.
\tikzset{tianbox/.style={color=red,
                         line width=2pt}}


\begin{document}

\begin{CJK}{UTF8}{gbsn}

test\tianbox{本}{\ben3}test

\end{CJK}

\end{document}

Attachment: tiantest.pdf
Description: Adobe PDF document

_______________________________________________
Cjk maillist  -  Cjk@ffii.org
https://lists.ffii.org/mailman/listinfo/cjk

Reply via email to