制作具有不同行之间连接的表格

制作具有不同行之间连接的表格

我尝试制作下表:

在此处输入图片描述

为此我做了一个简单的表格

\begin{longtable}{cccc cccc cccc cccc}
  {ho}  & {ha}  & {he}  & {hi}  & {bo}  & {ba}  & {be}  & {bi}  & {ko}  & {ka}  & {ke}  & {ki}  & {do}  & {da}  & {de}  & {di} \\
\end{longtable}

那么,同一个连音节中的辅音怎样用半圆连接起来,元音怎样用上连接符连接起来呢?

似乎没有表格解决方案,我必须使用 TikZ 来制作。无论如何,这个渲染的解决方案是什么?

颜色和字体根本不重要,这里仅用作示例来展示。

答案1

这是一个建议。连接由宏绘制

\Connect{<start>}{<end>}{<level>}{<color>}{<label>}

这是 MWE。

\documentclass[border=3.14mm,standalone]{standalone}
\usepackage{tikz-dependency}
\usetikzlibrary{intersections} 
\newcounter{depaths}
\newif\ifIntersect
\tikzset{every picture/.append style={execute at begin picture={%
\xdef\LstPaths{}% may be unnecessary
\setcounter{depaths}{0}}}}
\newcommand{\Connect}[6][]{
\stepcounter{depaths}%\typeout{new\space path\space\thedepaths}
\draw[name path=dep connect \thedepaths-tmp,color=#5,#1](\wordref{1}{#2}.70) 
-- ++ (0,0.3+0.3*#4) coordinate (aux-\thedepaths-1)  -| 
(\wordref{1}{#3}.70) coordinate[pos=0.5] (aux-\thedepaths-2);
\ifnum#3>#2
  \node[anchor=south east,font=\tiny\sffamily,inner sep=1pt] at (aux-\thedepaths-1) {#6};
\else
  \node[anchor=south east,font=\tiny\sffamily,inner sep=1pt] at (aux-\thedepaths-2) {#6};
\fi
\ifnum\thedepaths>1  
  \foreach \Y [count=\X] in \LstPaths
  {\Intersectfalse
  %\typeout{checking\space intersection\space with\space path\space \X}
  \path[name intersections={of=dep connect \thedepaths-tmp and dep
  connect \X-tmp,total=\t}] \pgfextra{%\typeout{\t:\Y}
  \ifnum\t>0
  \global\Intersecttrue
  %\typeout{paths\space\X\space and\space\thedepaths \space\space have\space common\space points}
  \fi};  
  \foreach \V [count=\W] in \Y
  {\ifcase\W % no 0
  \or % 1 boring
  \or % 2
   \ifnum\V=#2
    %\typeout{case2-2}
    \global\Intersectfalse
   \fi
   \ifnum\V=#3
    %\typeout{case2-3}
    \global\Intersectfalse
   \fi
  \or
   \ifnum\V=#3
    %\typeout{case3-3}
    \global\Intersectfalse
   \fi
   \ifnum\V=#2
    %\typeout{case3-2}
    \global\Intersectfalse
   \fi
  \or
   \ifnum\V=#4
    %\typeout{case4}
    \global\Intersectfalse
   \fi
  \fi}  
  \ifIntersect
    \foreach [count=\ZZ] \XX in \Y
      {\ifnum\ZZ=5
      \xdef\oldcolor{\XX}
      \fi}
    \node[circle,fill=white,inner sep=0pt,outer sep=0pt,minimum size=2mm] (aux-int) at (intersection-1){};
    \draw[\oldcolor] (aux-int.west) -- (aux-int.east);
   \draw[white,double=#5] (aux-int.south) to[out=30,in=-30] (aux-int.north);
   %\typeout{real\space intersection\space of\space path\space \thedepaths\space with\space path\space \X}
  \fi
  }
\fi
\ifnum\thedepaths=1
  \xdef\LstPaths{{\thedepaths,#2,#3,#4,#5}}
\else
  \xdef\LstPaths{\LstPaths,{\thedepaths,#2,#3,#4,#5}}
\fi
}
\begin{document}
\begin{dependency}
\begin{deptext}[column sep=1pt]
{ho}  \& {ha}  \& {he}  \& {hi}  \& {bo}  \& {ba}  \& {be}  \& {bi}  \& {ko}  \& {ka}  \& {ke}  \& {ki}  \& {do}  \& {da}  \& {de}  \& {di} \\
\end{deptext}
\Connect{1}{13}{1}{red}{range 3}
\Connect{5}{13}{1}{red}{}
\Connect{9}{13}{1}{red}{}
\Connect{2}{14}{2}{cyan}{range 2}
\Connect{6}{14}{2}{cyan}{}
\Connect{10}{14}{2}{cyan}{}
\Connect{3}{15}{3}{green!60!black}{range 1}
\Connect{7}{15}{3}{green!60!black}{}
\Connect{11}{15}{3}{green!60!black}{}
\Connect{4}{16}{4}{orange}{range 0}
\Connect{8}{16}{4}{orange}{}
\Connect{12}{16}{4}{orange}{}
\foreach \Z [count=\n starting from 0,evaluate=\Z as \Zmax using
{int(\Z+2)},evaluate=\Z as \Ztest using {int(\Z+1)}] in {1,5,9,13}
{\foreach \X [evaluate=\X as \Y using {int(\X+1)}] in {\Z,...,\Zmax}
{\ifnum\X=\Ztest
\draw (\wordref{1}{\X}.-110) to[out=-90,in=-90] node[midway,below,font=\small\sffamily]{\n}  (\wordref{1}{\Y}.-110)
;
\else
\draw (\wordref{1}{\X}.-110) to[out=-90,in=-90] (\wordref{1}{\Y}.-110);
\fi
}
}
\end{dependency}
\end{document}

在此处输入图片描述

相关内容