单词之间的长水平线

单词之间的长水平线

我想制作一个包含多列的表格,其中两列是长水平线,如图所示。有人能帮我吗? 在此处输入图片描述

答案1

如果线条可以留在其列内,则有一个选项:

在此处输入图片描述

\documentclass{article}

\usepackage{booktabs,mathtools,xhfill}

\newcommand{\ch}[2]{\ensuremath{\mathrm{#1}_{\mathrm{#2}}}}
\newcommand{\fromto}[3]{#1 & \xrfill[.5ex]{.4pt} & #2 & \xrfill[.5ex]{.4pt} & #3}

\begin{document}

\begin{table}
  \centering
  \caption{A table}
  \begin{tabular}{ c @{\,} c @{\,} c @{\,} c @{\,} c }
    \toprule
    \ch{D}{3d} & 
      $\xleftrightarrow[\substack{\text{distortion} \\ \text{(along \ch{C}{3})}}]{\text{trigonal}}$ &
      \ch{O}{h} &
      $\xleftrightarrow[\substack{\text{distortion} \\ \text{(along \ch{C}{4})}}]{\text{tetragonal}}$ &
      \ch{D}{4h} \\
    \addlinespace
    \fromto{\ch{A}{1g}}{\ch{A}{1g}}{\ch{A}{1g}} \\
    \fromto{\ch{A}{2g}}{\ch{A}{2g}}{\ch{B}{1g}} \\
    \fromto{\ch{E}{g}} {\ch{E}{g}} {$\ch{A}{1g} + \ch{B}{1g}$} \\
    \fromto{$\ch{A}{2g} + \ch{E}{g}$}{\ch{T}{1g}}{$\ch{A}{2g} + \ch{E}{g}$} \\
    \fromto{$\ch{A}{1g} + \ch{E}{g}$}{\ch{T}{2g}}{$\ch{B}{2g} + \ch{E}{g}$} \\
    \addlinespace
    \fromto{\ch{A}{1u}}{\ch{A}{1u}}{\ch{A}{1u}} \\
    \fromto{\ch{A}{2u}}{\ch{A}{2u}}{\ch{B}{1u}} \\
    \fromto{\ch{E}{u}} {\ch{E}{u}} {$\ch{A}{1u} + \ch{B}{1u}$} \\
    \fromto{$\ch{A}{2u} + \ch{E}{u}$}{\ch{T}{1u}}{$\ch{A}{2u} + \ch{E}{u}$} \\
    \fromto{$\ch{A}{1u} + \ch{E}{u}$}{\ch{T}{2u}}{$\ch{B}{2u} + \ch{E}{u}$} \\
    \bottomrule
  \end{tabular}
\end{table}

\end{document}

答案2

您可以使用 TiZ 节点矩阵。请注意,只有屏幕截图的回答问题有点不方便。我不擅长打字,所以我只复制了一行,你需要自己更改文本。

\documentclass{article}
\usepackage{booktabs}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{table}[htb]
\caption{A table.}
\centering\vspace*{0.2em}
\begin{tabular}{c}
\toprule
\begin{tikzpicture}[font=\sffamily]
\matrix[matrix of math nodes,nodes={anchor=center},
 column sep={width("hexagonal")+2em},
 execute at end matrix={
 \foreach \YY in {2,...,\the\pgfmatrixcurrentrow}
 {\foreach \XX in {2,...,\the\pgfmatrixcurrentcolumn}
 {\draw (\tikzmatrixname-\YY-\the\numexpr\XX-1) --
 (\tikzmatrixname-\YY-\XX);} }}] (mat){
 \mathsf{D}_{3d} & \mathsf{O}_{h} & \mathsf{D}_{4h} \\[2.5em]
 \mathsf{A}_{1g} & \mathsf{A}_{1g} & \mathsf{A}_{1g}\\
 \mathsf{A}_{1g} & \mathsf{A}_{2g} & \mathsf{B}_{1g}+E_{1g}\\
 \mathsf{A}_{1g}+E_{1g} & \mathsf{A}_{2g} & \mathsf{A}_{1g}+E_{1g}\\
 \mathsf{A}_{2g}+E_{1g} & \mathsf{A}_{2g} & \mathsf{B}_{1g}\\
 \mathsf{A}_{1g} & \mathsf{A}_{2g} & \mathsf{B}_{1g}\\[1.5em]
 \mathsf{A}_{1g} & \mathsf{A}_{1g} & \mathsf{A}_{1g}\\
 \mathsf{A}_{1g} & \mathsf{A}_{2g} & \mathsf{B}_{1g}+E_{1g}\\
 \mathsf{A}_{1g}+E_{1g} & \mathsf{A}_{2g} & \mathsf{A}_{1g}+E_{1g}\\
 \mathsf{A}_{2g}+E_{1g} & \mathsf{A}_{2g} & \mathsf{B}_{1g}\\
 \mathsf{A}_{1g} & \mathsf{A}_{2g} & \mathsf{B}_{1g}\\
 };
 \draw[latex-latex] (mat-1-1) -- node[above]{trigonal}
  node[below,align=center]{distortion\\[1ex] (along $\mathsf{C}_3$)} (mat-1-2);
 \draw[latex-latex] (mat-1-2) -- node[above]{tetragonal}
  node[below,align=center]{distortion\\[1ex] (along $\mathsf{C}_4$)} (mat-1-3);
\end{tikzpicture}\\
\bottomrule
\end{tabular}
\end{table}
\end{document}

在此处输入图片描述

编辑:使条目的大小不同,以显示线条确实通向这些条目,而不是停止在一个共同的水平点。

相关内容