乳胶中的特定表格

问题描述 投票:0回答:1

我想要这样的表:

enter image description here

但是我的代码不是那么好看

\begin{center}
\begin{tabular}{ c c c c }
    & & \textbf{Sferyczne} & \textbf{Kartezjańskie} \\ 
    $l=0$ & $y^{0}_{0}(\theta,\phi)=$ & $\sqrt{\frac{1}{4\pi}}$ & $\sqrt{\frac{1}{4\pi}}$ \\  
    $l=1$ & \begin{dcases} $y^{-1}_{1}(\theta,\phi)=$ \\ $y^{0}_{1}(\theta,\phi)=$ \\ $y^{1}_{1}(\theta,\phi)=$ \end{dcases} & \begin{tabular}{c} $\sqrt{\frac{3}{4\pi}}\cos\phi\sin\theta$ \\ g \\ g \end{tabular} & \begin{tabular}{c} $\sqrt{\frac{3}{4\pi}}x$ \end{tabular} \\
    cell10 & cell11 & cell12   
\end{tabular}
\end{center}

它看起来如何:

enter image description here

请帮助我在第一张照片上获得相同的表格。

latex tabular tex
1个回答
1
投票

这是实现您想要的输出的一种方法:

enter image description here

\documentclass{article}

\usepackage{xparse,eqparbox,amsmath}

% https://tex.stackexchange.com/a/34412/5764
\makeatletter
\NewDocumentCommand{\eqmathbox}{o O{c} m}{%
  \IfValueTF{#1}
    {\def\eqmathbox@##1##2{\eqmakebox[#1][#2]{$##1##2$}}}
    {\def\eqmathbox@##1##2{\eqmakebox{$##1##2$}}}
  \mathpalette\eqmathbox@{#3}
}
\makeatother

\newcommand{\ts}{\quad}

\begin{document}

\[
  \renewcommand{\arraystretch}{2.5}
  \begin{array}{ r r }
          & \eqmakebox[c1]{} \ts 
              \eqmakebox[c2][c]{\textbf{Spherical}} \ts 
              \eqmakebox[c3][c]{\textbf{Cartesian}} \\
    l = 0 & \eqmathbox[c1][r]{y_0^0(\theta, \phi) =} \ts 
              \eqmathbox[c2][l]{\sqrt{\dfrac{1}{4 \pi}}} \ts 
              \eqmathbox[c3][l]{\sqrt{\dfrac{1}{4 \pi}},} \\
    l = 1 & \left\{\begin{array}{ @{} r @{} }
            \eqmathbox[c1][r]{y_1^{-1}(\theta, \phi) =} \ts 
              \eqmathbox[c2][l]{\sqrt{\dfrac{3}{4 \pi}} \sin \phi \sin \theta} \ts 
              \eqmathbox[c3][l]{\sqrt{\dfrac{3}{4 \pi}} x,} \\
            \eqmathbox[c1][r]{y_1^0(\theta, \phi) =} \ts 
              \eqmathbox[c2][l]{\sqrt{\dfrac{3}{4 \pi}} \cos \theta} \ts 
              \eqmathbox[c3][l]{\sqrt{\dfrac{3}{4 \pi}} z,} \\
            \eqmathbox[c1][r]{y_1^1(\theta, \phi) =} \ts 
              \eqmathbox[c2][l]{\sqrt{\dfrac{3}{4 \pi}} \cos \phi \sin \theta} \ts 
              \eqmathbox[c3][l]{\sqrt{\dfrac{3}{4 \pi}} y,}
          \end{array}\right.\kern-\nulldelimiterspace \\
    l = 2 & \left\{\begin{array}{ @{} r @{} }
            \eqmathbox[c1][r]{y_2^{-2}(\theta, \phi) =} \ts 
              \eqmathbox[c2][l]{\sqrt{\dfrac{15}{4 \pi}} \sin \phi \cos \phi \sin^2 \theta} \ts 
              \eqmathbox[c3][l]{\sqrt{\dfrac{15}{4 \pi}} x y,} \\
            \eqmathbox[c1][r]{y_2^{-1}(\theta, \phi) =} \ts 
              \eqmathbox[c2][l]{\sqrt{\dfrac{15}{4 \pi}} \sin \phi \sin \theta \cos \theta} \ts 
              \eqmathbox[c3][l]{\sqrt{\dfrac{15}{4 \pi}} y z,} \\
            \eqmathbox[c1][r]{y_2^0(\theta, \phi) =} \ts 
              \eqmathbox[c2][l]{\sqrt{\dfrac{5}{16 \pi}} (3 \cos^2 \theta - 1)} \ts 
              \eqmathbox[c3][l]{\sqrt{\dfrac{5}{16 \pi}} (3 z^2 - 1),} \\
            \eqmathbox[c1][r]{y_2^1(\theta, \phi) =} \ts 
              \eqmathbox[c2][l]{\sqrt{\dfrac{15}{4 \pi}} \cos \phi \sin \theta \cos \theta} \ts 
              \eqmathbox[c3][l]{\sqrt{\dfrac{15}{8 \pi}} x z,} \\
            \eqmathbox[c1][r]{y_2^2(\theta, \phi) =} \ts 
              \eqmathbox[c2][l]{\sqrt{\dfrac{15}{16 \pi}} (\cos^2 \phi - \sin^2 \phi) \sin^2 \theta} \ts 
              \eqmathbox[c3][l]{\sqrt{\dfrac{15}{32 \pi}} (x^2 - y^2).}
          \end{array}\right.\kern-\nulldelimiterspace \\
          & \eqmakebox[c1]{} \ts 
              \eqmakebox[c2][c]{\textbf{Spherical}} \ts 
              \eqmakebox[c3][c]{\textbf{Cartesian}}
  \end{array}
\]

\end{document}

该方法使用框来伪造柱状对齐。外部array只包含两个right对齐列,第一个用于l = ?构造,第二个用于其余的。第二列中的每个元素都设置在一个框内(使用\eqmakebox\eqmathbox),标签为:\eq..box[<tag>][<align>]{<stuff>}。每个具有相同<tag>的盒子将具有相同的最大宽度,您可以指定单独的盒子<align>ment。

您可以更改\arraystretch中的数字以增加整个结构的垂直高度。此外,插入\ts代表tabular separation,默认为1em(或\quad)的空间。您可以将其更改为(比方说)\hspace{2cm}以在列之间插入更大的水平间隙。

© www.soinside.com 2019 - 2024. All rights reserved.