![如何使表格内容垂直居中?](https://linux22.com/image/232781/%E5%A6%82%E4%BD%95%E4%BD%BF%E8%A1%A8%E6%A0%BC%E5%86%85%E5%AE%B9%E5%9E%82%E7%9B%B4%E5%B1%85%E4%B8%AD%EF%BC%9F.png)
我有这张表:
\usepackage{array}
\newcolumntype{x}[1]{>{\centering\arraybackslash\hspace{0pt}}p{#1}}
\begin{table}[ht]\footnotesize
\centering
\begin{tabular*}{0.95\textwidth }{@{\extracolsep{\fill}}|llllllllllllllll|x{0.15\textwidth}|}
\hline
\multicolumn{16}{|c|}{Small text} & Long text \\ \hline
1 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 16 & 19 & 20 & 21 & 22 & 23 & 0.9636149 \\ \hline
\end{tabular*}
\caption{Caption}
\label{tab:Example}
\end{table}
如何使“小文本”居中?
答案1
将列类型的定义更改p
为:m
x
\newcolumntype{x}[1]{>{\centering\arraybackslash\hspace{0pt}}m{#1}}
完整示例:
\documentclass{article}
\usepackage{array}
\newcolumntype{x}[1]{>{\centering\arraybackslash\hspace{0pt}}m{#1}}
\begin{document}
\begin{table}[ht]\footnotesize
\centering
\begin{tabular*}{0.95\textwidth }{@{\extracolsep{\fill}}|llllllllllllllll|x{0.15\textwidth}|}
\hline
\multicolumn{16}{|c|}{Small text} & Long long long long long text \\ \hline
1 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 16 & 19 & 20 & 21 & 22 & 23 & 0.9636149 \\ \hline
\end{tabular*}
\caption{Caption}
\label{tab:Example}
\end{table}
\end{document}
答案2
\documentclass{article}
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\usepackage{array}% http://ctan.org/pkg/array
\usepackage{amsmath}
\begin{document}
\begin{table}[h!]
\centering
\begin{tabular}{ | c | m{5cm} | m{5cm} | }
\hline
11111111 & 2222222 & 33333333 \\ \hline
\begin{minipage}{.3\textwidth}
\includegraphics[width=\linewidth]{example-image-a.png}
\end{minipage}
&
\begin{equation*}
\dfrac{12!-x^2}{9x^3-99}
\end{equation*}
&
\begin{itemize}
\item item111
\item item2222222
\item text text text
\item Double-click here to open the full log. \ldots
\end{itemize}
\\ \hline
\end{tabular}
\caption{Your caption}
\label{Your label}
\end{table}
\end{document}