Skip to content

Instantly share code, notes, and snippets.

@tetsuok
Created June 23, 2012 22:49
Show Gist options
  • Select an option

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

Select an option

Save tetsuok/2980422 to your computer and use it in GitHub Desktop.
An example of synchronous-CFG derivation.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
% works only for XeLaTeX and tikz-qtree.
\documentclass{beamer}
\usefonttheme[onlymath]{serif}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usetikzlibrary{arrows}
\usepackage{amssymb,amsmath}
\usepackage{zxjatype}
\setjamainfont[Scale=0.8]{Hiragino Kaku Gothic Pro W3}
\setmainfont[Mapping=tex-text,Scale=MatchLowercase]{Times}
\setsansfont[Scale=MatchLowercase]{Helvetica}
\usepackage{xltxtra}
\setbeamertemplate{navigation symbols}{} %no nav symbols
\newcommand{\mybox}[1]{{\setlength{\fboxsep}{0.5pt}\fbox{\tiny #1}}}
\newcommand{\NT}[1]{\textrm{X}$_{\mybox{#1}}$}
\begin{document}
\begin{frame}
\begin{center}
\begin{tikzpicture}[scale=0.8]
\tikzstyle{rule}=[angle 60-angle 60,dotted,draw=gray]
\begin{scope}
\Tree [.\node (Xs1) {\NT{1}}; [.\node (Xs2) {\NT{2}}; \node (e1) {she}; ]
[.\node (Xs3) {\NT{3}}; \node (e2) {broke};
[.\node (Xs4) {\NT{4}}; [.\node (Xs5) {\NT{5}}; \node (e3) {the school}; ] [.\node (Xs6) {\NT{6}}; \node (e4) {windows}; ] ] ] ]
\end{scope}
%
\begin{scope}[xshift=7cm]
\Tree [.\node (Xt1) {\NT{1}}; [.\node (Xt2) {\NT{2}}; \node (ja1) {彼女は}; ]
[.\node (Xt3) {\NT{3}}; [.\node (Xt4) {\NT{4}}; [.\node (Xt5) {\NT{5}}; \node (ja2) {学校の}; ] [.\node (Xt6) {\NT{6}}; \node (ja3) {窓ガラスを}; ] ]
\node (ja4) {割った}; ] ]
\end{scope}
%
\begin{scope}
\draw[rule] (Xs1) .. controls +(north:4) and +(north:4) .. (Xt1);
\draw[rule] (Xs2) .. controls +(north:4) and +(north:4) .. (Xt2);
\draw[rule] (Xs3) .. controls +(north:5) and +(north:5) .. (Xt3);
\draw[rule] (Xs4) .. controls +(north:5) and +(north east:4) .. (Xt4);
\draw[rule] (Xs5) .. controls +(north:5) and +(north:5) .. (Xt5);
\draw[rule] (Xs6) .. controls +(north:5) and +(north:6) .. (Xt6);
\end{scope}
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment