3

The following code gives the following result:

\documentclass{article}
\usepackage{longtable,amsmath}
\begin{document}
\begin{longtable}{|p{0.05\textwidth}|p{0.47\textwidth}|p{0.47\textwidth}|}
    \hline
    &\multicolumn{1}{|c|}{$\Delta v=0$}&\multicolumn{1}{c|}{$-\Delta v=\lambda v$}\\
    \hline
    2D & \begin{multline*}C+D\ln r \\
    +\left(A_nr^n+ \frac{B_n}{r^n}\right)(C_n\cos n\theta+D_n\cos n\theta) \end{multline*} & \begin{multline*} (A_nJ_n(\sqrt\lambda r)+B_nN_n(\sqrt\lambda r)) \\
    \times(C_n\cos n\theta+D_n\sin n\theta)\end{multline*} \\
    \hline
    3D & \begin{multline*} \left(A_lr^l+\frac{B_l}{r^{l+1}}\right)P^m_l(\cos\theta) e^{im\phi}\end{multline*} & \begin{multline*}\small \frac{A_lJ_{l+1/2}(\sqrt\lambda r)+B_lN_{l+1/2}(\sqrt\lambda r)}{\sqrt r} \\
    \times P^l_m(\cos\theta)e^{im\phi} \end{multline*}
    \hline
    \end{longtable}
\end{document}

enter image description here

How can I make this table prettier? Especially, (1) How can I eliminate the "double vertical line" on the left of the $\Delta v=0$? (2) How can I make "2D" and "3D" in the center of the table?

1
  • Your MWE does not match the output you show. Do you use a different documentclass in your real document or do you change the margins with geometry?
    – leandriis
    Commented Jun 18, 2019 at 18:39

2 Answers 2

6

To remove the double vertical line in the header row, use {c|} instead of {|c|} and to vertically center the dontents in the first row, replace the p by m type columns:

\documentclass{article}
\usepackage{geometry}
\usepackage{longtable,amsmath}
\usepackage{array}
\begin{document}

\begin{longtable}{|l|m{0.47\textwidth}|m{0.47\textwidth}|}
    \hline
    &\multicolumn{1}{c|}{$\Delta v=0$}&\multicolumn{1}{c|}{$-\Delta v=\lambda v$}\\
    \hline
    2D & \begin{multline*}C+D\ln r \\
    +\left(A_nr^n+ \frac{B_n}{r^n}\right)(C_n\cos n\theta+D_n\cos n\theta) \end{multline*} & \begin{multline*} (A_nJ_n(\sqrt\lambda r)+B_nN_n(\sqrt\lambda r)) \\
    \times(C_n\cos n\theta+D_n\sin n\theta)\end{multline*} \\
    \hline
    3D & \begin{multline*} \left(A_lr^l+\frac{B_l}{r^{l+1}}\right)P^m_l(\cos\theta) e^{im\phi}\end{multline*} & \begin{multline*}\small \frac{A_lJ_{l+1/2}(\sqrt\lambda r)+B_lN_{l+1/2}(\sqrt\lambda r)}{\sqrt r} \\
    \times P^l_m(\cos\theta)e^{im\phi} \end{multline*} \\
    \hline
    \end{longtable}
\end{document}

enter image description here

0

There is an article that nicely discusses how to make attractive tables using LaTeX, “Tables in LATEX2e: Packages and Methods.” Drawing on the advice given in that article, I would recommend removing all of your vertical rules and using the commands \toprule, \midrule, and \bottomrule (from the booktabs package) to distinguish the top and bottom rules.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .