如何使表格元素垂直居中?

如何使表格元素垂直居中?

晚安朋友。

如何使表格中的元素(图形)垂直对齐?

按照下面的代码:

\begin{landscape}
\begin{figure}[!h]
  \centering
\caption{Vistas em perspectiva das placas (a) plana e com ondulações (b) quadradas, (c) trapezoidais e (d) triangulares.}

\begin{tabular}{cc}
\includegraphics[width=0.45\linewidth]{Capitulo3/Figuras/FigExp2a.png} & \includegraphics[width=0.45\linewidth]{Capitulo3/Figuras/FigExp2b.png} \\
(a)                                                                    & (b)                                                                    \\
\includegraphics[width=0.45\linewidth]{Capitulo3/Figuras/FigExp2c.png} & \includegraphics[width=0.45\linewidth]{Capitulo3/Figuras/FigExp2d.png} \\
(c)                                                                    & (d)                                                                   
\end{tabular}

\label{fig:desenhoplacas2}
\legend{Fonte: Próprio Autor.}
\end{figure}
\end{landscape}

答案1

m您可以通过使用包提供的列类型来实现格式化目标array

在此处输入图片描述

\documentclass[demo]{article} % remove 'demo' option in real document
\usepackage[T1]{fontenc}
\usepackage[portuguese]{babel}
\usepackage{graphicx,threeparttable,pdflscape}
\usepackage{array} % for 'm' col. type and '\newcolumntype' macro
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
\begin{document}

\begin{landscape}

\begin{figure}[!h]
\centering
\begin{threeparttable}
\caption{Vistas em perspectiva das placas (a) plana e com ondulações (b)~quadradas, (c) trapezoidais e (d) triangulares.}
\label{fig:desenhoplacas2}

\begin{tabular}{@{} *{2}{M{3.5in}} @{}}
\includegraphics[width=1\linewidth]{Capitulo3/Figuras/FigExp2a} & \includegraphics[width=1\linewidth]{Capitulo3/Figuras/FigExp2b} \\
(a) & (b) \\[2ex]
\includegraphics[width=1\linewidth]{Capitulo3/Figuras/FigExp2c} & \includegraphics[width=1\linewidth]{Capitulo3/Figuras/FigExp2d} \\
(c) & (d)                                                                   
\end{tabular}

\scriptsize Fonte: Próprio Autor. % how or where is "\legend" defined?
\end{threeparttable}
\end{figure}

\end{landscape}

\end{document}

答案2

Mico 答案的一个变体,具有未定义的列宽。

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[portuguese]{babel}
\usepackage{graphicx,pdflscape}
\usepackage{array,collcell}
\newcolumntype{v}{>{\collectcell\myvcenter}c<{\endcollectcell}}
\newcommand{\myvcenter}[1]{\raisebox{\dimexpr 0.5\depth-0.5\height}{#1}}
\begin{document}

\begin{landscape}

\begin{figure}[!h]
\centering
\setlength{\belowcaptionskip}{\abovecaptionskip}% or \captionsetup{position=above} with caption package
\setlength{\abovecaptionskip}{0pt}%
\caption{Vistas em perspectiva das placas (a) plana e com ondulações (b)~quadradas, (c) trapezoidais e (d) triangulares.}
\label{fig:desenhoplacas2}

\begin{tabular}{vv}
\includegraphics[width=2cm]{example-image-a} & \includegraphics[width=1.5cm]{example-image-b} \\
(a) & (b) \\[2ex]
\includegraphics[width=1.5cm]{example-image-c} & \includegraphics[width=2cm]{example-image} \\
(c) & (d)                                                                   
\end{tabular}

\medskip
\scriptsize Fonte: Próprio Autor. % how or where is "\legend" defined?
\end{figure}

\end{landscape}

相关内容