Skip to content

Instantly share code, notes, and snippets.

@tetsuok
Created June 23, 2012 18:24
Show Gist options
  • Select an option

  • Save tetsuok/2979324 to your computer and use it in GitHub Desktop.

Select an option

Save tetsuok/2979324 to your computer and use it in GitHub Desktop.
Draw word alignment matrix.
% Note: works only for XeLaTeX.
\documentclass[border=1mm]{standalone}
\usepackage{tikz}
\usepackage{zxjatype}
\setjamainfont[Scale=0.8]{Hiragino Kaku Gothic Pro W3}
\setmainfont[Mapping=tex-text,Scale=MatchLowercase]{Helvetica} % \sffamily
\setsansfont[Scale=MatchLowercase]{Helvetica} % \sffamily のフォント
\usepackage{xltxtra}
\begin{document}
\begin{tikzpicture}[scale=0.7]
\tikzstyle{vertex}=[rectangle,rounded corners, fill=red!80!white,draw=red!70!black,
minimum size=0.6cm,line width=1]
\draw[step=1cm,draw=gray] (0,0) grid (5,7);
\foreach \y/\f in {0/彼女, 1/は, 2/学校, 3/の, 4/窓ガラス, 5/を, 6/割った} {
\node[left] at (-.2,6.5-\y) {{\raggedleft \f }};
}
\foreach \x/\e in {0/she, 1/broke, 2/the, 3/school, 4/windows} {
\node[rotate=60,right] at (\x+.4,7.2) {{\raggedright \e}};
}
% draw word alignment
\foreach \x/\y in {0/0, 1/6, 3/2, 4/4} {
\node[vertex] at (\x+.5, 6.5-\y) {};
}
\end{tikzpicture}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
@veer66
Copy link

veer66 commented Jun 16, 2014

Thank you. This is great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment