表格文本对齐问题

表格文本对齐问题

希望有人能帮助我修复这个表格,以确保文本右对齐并且更易读。 在此处输入图片描述

\documentclass[]{interact}

\usepackage{tabularx}

\usepackage{epstopdf}% To incorporate .eps illustrations using PDFLaTeX, etc.
\usepackage[caption=false]{subfig}% Support for small, `sub' figures and tables
%\usepackage[nolists,tablesfirst]{endfloat}% To `separate' figures and tables from text if required
%\usepackage[doublespacing]{setspace}% To produce a `double spaced' document if required
%\setlength\parindent{24pt}% To increase paragraph indentation when line spacing is doubled

\usepackage[longnamesfirst,sort]{natbib}% Citation support using natbib.sty
\bibpunct[, ]{(}{)}{;}{a}{,}{,}% Citation support using natbib.sty
\renewcommand\bibfont{\fontsize{10}{12}\selectfont}% To set the list of references in 10 point font using natbib.sty

\usepackage{booktabs,makecell,tabularx,ragged2e}
\renewcommand{\tabularxcolumn}[1]{m{#1}}
\newcolumntype{L}{>{\RaggedRight}X} % suppress full justification


%\usepackage[natbibapa,nodoi]{apacite}% Citation support using apacite.sty. Commands using natbib.sty MUST be deactivated first!
%\setlength\bibhang{12pt}% To set the indentation in the list of references using apacite.sty. Commands using natbib.sty MUST be deactivated first!
%\renewcommand\bibliographytypesize{\fontsize{10}{12}\selectfont}% To set the list of references in 10 point font using apacite.sty. Commands using natbib.sty MUST be deactivated first!

\theoremstyle{plain}% Theorem-like structures provided by amsthm.sty
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{proposition}[theorem]{Proposition}

\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}

\theoremstyle{remark}
\newtheorem{remark}{Remark}
\newtheorem{notation}{Notation}


\begin{document}

\begin{table}
\tbl{Attitude Towards Using}
{\begin{tabular}{lcccccc} \toprule
& \multicolumn{2}{l}{} \\ \cmidrule{2-7}
 & Strongly Disagree & \shortstack{Somewhat\\ Disagree} & \shortstack{Neither agree\\ nor disagree} & \shortstack{Somewhat\\ Agree} & Strongly Agree & \multirow{Total Percentage} \\ \midrule
\shortstack{My business is willing to\\commit resources to use\\industry 4.0 technologies.} & 2 & 10 & 19 & 13 & 5 & 0\% \\
\shortstack{I have team members who\\are willing to upgrade their skills to \\use industry 4.0 technologies.}  & 2 & 4 & 13 & 19 & 11 & 0\%\\
\shortstack{My business would not\\be competitive in the market over the \\ next five years if we do not\\adopt Industry 4.0 technologies.}   & 2 & 9 & 16 & 14 & 8 & 0\% \\
\end{tabular}}
\label{PEU}
\end{table}
\end{document}

答案1

我建议您使用一个tabularx环境,将其目标宽度设置为\textwidth,并使用X第一列的列类型,并通过强制在单元格内容上换行来缩短标题单元格。

在此处输入图片描述

\documentclass{article}
\usepackage[english]{babel}
\usepackage[a4paper,margin=2.5cm]{geometry} % set page parameters as needed
\usepackage{booktabs,makecell,tabularx,ragged2e}
\renewcommand{\tabularxcolumn}[1]{m{#1}}
\newcolumntype{L}{>{\RaggedRight}X} % suppress full justification

\begin{document}

\begin{table}
\setlength\tabcolsep{3pt} % default: 6pt
\caption{\dots} \label{PEU}

\smallskip
\begin{tabularx}{\textwidth}{@{} L ccccc r @{}} 
\toprule
Statements & \multicolumn{6}{c@{}}{Attitude toward using, in percent} \\ 
\cmidrule{2-7}
 & \makecell{Strongly\\disagree} 
 & \makecell{Somewhat\\disagree} 
 & \makecell{Neither agree\\nor disagree} 
 & \makecell{Somewhat\\agree} 
 & \makecell{Strongly\\agree} 
 & \makecell{Total\\} \\ 
\midrule
My business is willing to commit resources to use industry 4.0 technologies. 
  & 2 & 10 & 19 & 13 &  5 & 49 \\
\addlinespace
I have team members who are willing to upgrade their skills to use industry 4.0 technologies.  
  & 2 &  4 & 13 & 19 & 11 & 49 \\
\addlinespace
My business would not be competitive in the market over the next five years if we do not adopt Industry 4.0 technologies.   
  & 2 &  9 & 16 & 14 &  8 & 49 \\
\bottomrule
\end{tabularx}

\end{table}

\end{document}

相关内容