我无法垂直对齐第一列。您能建议其他方法让此表格看起来更美观吗?我将不胜感激。
\documentclass[journal]{IEEEtran}
\usepackage{ifpdf}
\usepackage{cite}
\ifCLASSINFOpdf
\usepackage[pdftex]{graphicx}
\else
\fi
\usepackage{amsmath}
\usepackage[siunitx]{circuitikz}
\usepackage{tabularx,booktabs}
\renewcommand{\tabularxcolumn}[1]{m{#1}}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\usepackage{algorithmic}
\usepackage{array}
\ifCLASSOPTIONcompsoc
\usepackage[caption=false,font=normalsize,labelfont=sf,textfont=sf]{subfig}
\else
\usepackage[caption=false,font=footnotesize]{subfig}
\usepackage{fixltx2e}
\usepackage{xcolor}
\usepackage{stfloats}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{rotating}
\usepackage{multirow}
\usepackage{blindtext}
\begin{document}
\begin{table*}[t]
\renewcommand{\arraystretch}{1.25}
\centering % default value: 6pt
\caption{Comparison of Algorithm Results}\label{tab_com}
\begin{tabularx}{0.8\linewidth}{
@{\hspace{0em}} >{\hsize=0.3\hsize}L
@{\hspace{-7em}} >{\hsize=0.3\hsize}L
@{\hspace{-5em}} >{\hsize=0.3\hsize}L
@{\hspace{1em}} >{\hsize=0.3\hsize}L
@{\hspace{0em}} >{\hsize=0.5\hsize}L }
\toprule
%% disable left-hand padding in first cell via "@{}" particle
\centering\arraybackslash\hspace{-2em}\textbf{} & \textbf{Capacitor} & \textbf{Trimming} & \textbf{Servo}\\
\midrule
\vspace{0em}\hspace{1em} \textbf{Strength} & \parbox[t]{0.2\textwidth}{%
\begin{itemize}[leftmargin=1em,itemsep=0.5pt,parsep=0pt]\raggedright%
\item Simplicity
\item Cost-effectiveness
\end{itemize}} &\parbox[t]{0.25\textwidth}{%
\begin{itemize}[leftmargin=1em,itemsep=0.5pt,parsep=0pt]\raggedright%
\item Ease of implementation
\item Time-efficient
\end{itemize}}&\parbox[t]{0.25\textwidth}{%
\begin{itemize}[leftmargin=1em,itemsep=0.5pt,parsep=0pt]\raggedright%
\item An offset of low DC is possible
\item The DC offset is actively removed
\item Adjustable low-frequency roll-off
\end{itemize}} \\
\vspace{0em}\hspace{1em} \textbf{Weakness} & \parbox[t]{0.2\textwidth}{%
\begin{itemize}[leftmargin=1em,itemsep=0.5pt,parsep=0pt]\raggedright%
\item Time-consuming \item big and bulky
\end{itemize}} & \parbox[t]{0.25\textwidth}{%
\begin{itemize}[leftmargin=1em,itemsep=0.5pt,parsep=0pt]\raggedright%
\item During operation Adjustments
\item Accumulated DCs Offsett
\end{itemize}} & \parbox[t]{0.25\textwidth}{%
\begin{itemize}[leftmargin=1em,itemsep=0.5pt,parsep=0pt]\raggedright%
\item A supply rail system is needed
\item Power requirements
\item Must be carefully designed
\end{itemize}}\\
\bottomrule
\end{tabularx}
\end{table*}
\end{document}
答案1
像这样?
\documentclass[journal]{IEEEtran}
\usepackage{ragged2e}
\usepackage{array, booktabs,tabularx}
\newcolumntype{L}[1]{>{\RaggedRight%
\hsize=#1\hsize% % <---
\linewidth=\hsize}X} % <---
\usepackage{xcolor}
\usepackage{enumitem}
\usepackage{lipsum}
\begin{document}
\lipsum[66]
\begin{table*}[ht]
\renewcommand{\arraystretch}{1.25}
\centering
\caption{Comparison of Algorithm Results}
\label{tab_com}
\setlist[itemize]{nosep,
leftmargin = *,
label = $\bullet$ ,
after=\end{minipage}, % <---
before=\begin{minipage}[t]{\linewidth} % <---
}
\begin{tabularx}{0.8\linewidth}{>{\bfseries}l
L{0.8}
L{1}
L{1.2}
}
\toprule
& \textbf{Capacitor} & \textbf{Trimming} & \textbf{Servo}\\
\midrule
Strength & \begin{itemize}
\item Simplicity
\item Cost-effectiveness
\end{itemize}
& \begin{itemize}
\item Ease of implementation
\item Time-efficient
\end{itemize}
& \begin{itemize}
\item An offset of low DC is possible
\item The DC offset is actively removed
\item Adjustable low-frequency roll-off
\end{itemize} \\
Weakness & \begin{itemize}
\item Time-consuming
\item big and bulky
\end{itemize}
& \begin{itemize}
\item During operation Adjustments
\item Accumulated DCs Offsett
\end{itemize}
& \begin{itemize}
\item A supply rail system is needed
\item Power requirements
\item Must be carefully designed
\end{itemize} \\
\bottomrule
\end{tabularx}
\end{table*}
\end{document}
编辑:
- 您的表格代码没有必要那么复杂。由于所有列的宽度都相等,因此您可以省略所有宽度设置。
- 内部列的使用
\parbox
不一致且没有必要 - 如果您希望在内容为列表的情况下使用不同的列宽(
itemize
),则需要按如下方式重新定义它们的宽度:{\hsize=#1\hsize\linewidth=\hsize}
或者为了更方便地编写列规范,如上面的 MWE 中所示 - 从文档序言中删除所有重复项
附录 您的表格可以放在一列中。为此,我建议
- 减小尺寸
\tabcolsep
(从默认的 6pt 减小到例如 4pt) - 减小字体大小至
\small
@{}
通过在列规范的开始和结束处插入来删除表中的第一个和最后一个空格- 第一列替换为行
\documentclass[journal]{IEEEtran}
\usepackage{ragged2e}
\usepackage{array, booktabs,tabularx}
\newcolumntype{L}[1]{>{\RaggedRight%
\hsize=#1\hsize% % <---
\linewidth=\hsize}X} % <---
\usepackage{xcolor}
\usepackage{enumitem}
\usepackage{lipsum}
\begin{document}
\lipsum[66]
\begin{table}[ht]
\small
\renewcommand{\arraystretch}{1.1}
\centering
\caption{Comparison of Algorithm Results}
\label{tab_com}
\setlist[itemize]{nosep,
leftmargin = *,
label = $\bullet$ ,
after=\end{minipage}, % <---
before=\begin{minipage}[t]{\linewidth} % <---
}
\setlength\tabcolsep{3pt}
\begin{tabularx}{\linewidth}{@{} L{0.9}
L{1}
L{1.1}
@{} }
\toprule
\textbf{Capacitor} & \textbf{Trimming} & \textbf{Servo}\\
\midrule
\multicolumn{3}{c}{\textbf{Strength:}} \\
\begin{itemize}
\item Simplicity
\item Cost-effectiveness
\end{itemize}
& \begin{itemize}
\item Ease of implementation
\item Time-efficient
\end{itemize}
& \begin{itemize}
\item An offset of low DC is possible
\item The DC offset is actively removed
\item Adjustable low-frequency roll-off
\end{itemize} \\
\midrule
\multicolumn{3}{c}{\textbf{Weakness:}} \\
\begin{itemize}
\item Time-consuming
\item big and bulky
\end{itemize}
& \begin{itemize}
\item During operation Adjustments
\item Accumulated DCs Offsett
\end{itemize}
& \begin{itemize}
\item A supply rail system is needed
\item Power requirements
\item Must be carefully designed
\end{itemize} \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}