
Como centralizo verticalmente o texto nas tabelas, como "Autor 1 (Ano)" e como adiciono entradas entre palavras nas tabelas para que o texto fique um abaixo do outro, como acontece com as palavras Guerra, Revolução e Desordens civis?
\begin{table}[H]
\caption{Three levels of political risks}
\label{tab:rcpol}
\footnotesize
\begin{tabularx}{\linewidth}{@{} c *{3}{>{\centering\arraybackslash}X} @{}}
\toprule
\textbf{References} & \textbf{Macro risks} & \textbf{Meso risks} & \textbf{Micro risks} \\
\midrule
Author 1 (Year)
& Corruption
& Government intervention
& Expropriation;
Nationalisation of assets
\\ \midrule
Author 2 (Year)
& War; Revolution; Civil disorders
& \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth
\centering\arraybackslash}X}{%
Inconsistent government policies }
\\
\bottomrule
\end{tabularx}
\end{table}
Responder1
Dentro de uma X
coluna de tipo você pode usar \linebreak
para inserir quebras de linha. Dentro de uma célula normal, você pode usar uma \begin{tabular}{@{} <col> @{}}<content>\end{tabular}
construção para inserir quebras de linha (ou usar \makecell
do makecell
pacote, que faz o mesmo).
Se você quiser usar a definição de \\
como seria dentro de um \centering
ambiente, você também pode usar >{\centering\let\mynewline\\\arraybackslash}X
em seu preâmbulo e em sua tabela \mynewline
em vez de \linebreak
.
Quanto ao alinhamento vertical das X
células de tipo: Você pode alterar a definição para \tabularxcolumn
usar m
em vez de p
colunas de tipo para conteúdo centralizado verticalmente.
\documentclass[]{article}
\usepackage{tabularx}
\usepackage{booktabs}
% change the column type of tabularx to use `m` instead of `p` for the vertical
% centering:
\renewcommand\tabularxcolumn[1]{m{#1}}
\begin{document}
\begin{table}
\caption{Three levels of political risks}
\label{tab:rcpol}
\footnotesize
\begin{tabularx}{\linewidth}{@{} c *{3}{>{\centering\arraybackslash}X} @{}}
\toprule
\textbf{References} & \textbf{Macro risks} & \textbf{Meso risks} & \textbf{Micro risks} \\
\midrule
Author 1 (Year)
& Corruption
& Government intervention
& Expropriation;
Nationalisation of assets
\\ \midrule
Author 2 (Year)
& War; Revolution; Civil disorders
& \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth
\centering\arraybackslash}X}{%
Inconsistent government policies }
\\
author & En-\linebreak forcing\linebreak line\linebreak breaks
\\
\begin{tabular}[]{@{}c@{}}
line\\breaks\\in\\a\\normal\\cell
\end{tabular}
& other cell & other cell
\\
\bottomrule
\end{tabularx}
\end{table}
\end{document}