\begin{table}[h]
\center
\begin{tabular}{|l|l|l|l|l|l|l|l|}
\hline
\multirow{3}{*}{Parameters} &
\multicolumn{4}{c}{Controllers} \\\cmidrule{2-5}
&dsPIC33FJ64MC204 & dsPIC33EV64GM104 & S32K & XMC1402 \\
& (Microchip) & (Microchip) & (NXP) & (Infineon) \\
\hline
Architecture & 16 bit & 16bit & 32bit & 32 bit \\
\hline
Temperature Range & -40{\,\celsius } to +125{\,\celsius} & -40{\,\celsius} to +150{\,\celsius} & -40{\,\celsius} to +125{\,\celsius}& -40{\,\celsius}to +125{\,\celsius}\\
\hline
Voltage range & 3.0V to 3.6V & 4.5V to 5.5V & 2.7V to 5.5V & 2.0V to 5.5V\\
\hline
CPU speed &40MHz & 40MHz & upto 112MHz & 48MHz\\
\hline
\multirow{2}{*}{}CPU performance&-40{\,\celsius} to +125{\,\celsius} & -40{\,\celsius} to +150{\,\celsius} & & \\
for high temperature &= 40MIPS &= 40MIPS & &\\
\hline
\multirow{3}{*}{I/O pins} & 35pins out of 44pins & 35pins out of 44pins & & 34pins out of 48pins \\
& & 53pins out of 64 pins & & 48pins out of 64pins\\
\hline
\multirow{2}{*}{Comparators}&upto 2 analog&upto 4 analog & & upto 4 analog\\
&comparators&comparators& & compatators\\
\hline
PWM resolution & 25ns&7.14ns & & \\
\hline
\multirow{4}{*}{}communication &2 UART &2 UART & communication &4 interface \\
Interfaces&modules supports &modules supports & protocol & channels usable\\
& LIN 2.0& LIN 2.0&emmulation for & as UART \\
& protocol& protocol&more LIN&and LIN\\
\hline
Typical MIPS/MHz &1MIPS/MHz& &1.25DMIPS/MHz&0.84DMIPS/MHz \\
\hline
\multirow{3}{*}{} Price for & & & & \\
QFN-44 & &100= 2.55\euro& &5k=1.46\euro\\
QFN-64 & 100= 3.86\euro & 100=3.51\euro & &5k=1.92\euro\\
\hline
\end{tabular}
\caption{Controller Comparison Table-1}
\end{table}
答案1
请不要booktabs
与\hline
s 和竖线组合使用。这不应该组合。您可以\cline
在此处使用 代替\cmidrule
,或者采用纯booktabs
方法,如下所示:
% arara: pdflatex
\documentclass{article}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{eurosym}
\DeclareSIUnit{\bit}{bit}
\DeclareSIUnit{\EUR}{\text{\euro}}
\begin{document}
\begin{table}[h]
\centering
\begin{tabular}{*{5}{l}}
\toprule
\multirow{3}{*}{Parameters} & \multicolumn{4}{c}{Controllers} \\
\cmidrule{2-5}
& dsPIC33FJ64MC204 & dsPIC33EV64GM104 & S32K & XMC1402 \\
& (Microchip) & (Microchip) & (NXP) & (Infineon) \\
\midrule
Architecture in \si{\bit} & $16$ & $16$ & $32$ & $32$ \\
Temperature Range in \si{\celsius} & \numrange{-40}{125} & \numrange{-40}{150} & \numrange{-40}{125} & \numrange{-40}{125} \\
Voltage range in \si{\volt} & \numrange{3.0}{3.6} & \numrange{4.5}{5.5} & \numrange{2.7}{5.5} & \numrange{2.0}{5.5} \\
CPU speed in \si{\mega\hertz} &$40$ & $40$ & upto $112$ & $48$\\
CPU performance in \si{\celsius} & \numrange{-40}{125} & \numrange{-40}{150} & & \\
for high temperature & $= \SI{40}{MIPS}$ & $= \SI{40}{MIPS}$ & &\\
\multirow{3}{*}{I/O pins} & 35 pins out of 44 pins & 35 pins out of 44 pins & & 34 pins out of 48 pins \\
& & 53 pins out of 64 pins & & 48 pins out of 64 pins\\
\multirow{2}{*}{Comparators}&upto 2 analog&upto 4 analog & & upto 4 analog\\
& comparators & comparators & & compatators\\
PWM resolution in \si{\nano\second} & $25$ & $7.14$ & & \\
communication &2 UART &2 UART & communication &4 interface \\
Interfaces&modules supports &modules supports & protocol & channels usable\\
& LIN 2.0& LIN 2.0&emmulation for & as UART \\
& protocol& protocol&more LIN&and LIN\\
Typical in \si{MIPS\per\mega\hertz} & $1$ & $1.25$ & $0.84$ \\
Price for & & & & \\
QFN-44 & & $100 = \SI{2.55}{\EUR}$ & & $5\text{k} = \SI{1.46}{\EUR}$ \\
QFN-64 & $100 = \SI{3.86}{\EUR}$ & $100 = \SI{3.51}{\EUR}$ & & $5\text{k} = \SI{1.92}{\EUR}$ \\
\bottomrule
\end{tabular}
\caption{Controller Comparison}
\end{table}
\end{document}
这只是一个起点。表格太宽,不适合,但我不知道您的文档类别和常规设置,所以我不想在这上面花更多时间。到目前为止,表格还不是很清楚,因为您在某些地方使用多行,而在其他地方则没有。尽量保持一致。
答案2
作为 LaRiFaRi 答案的变体/补充......
在准备答案时,我假设页面为 A4 大小,文本边距为 25 毫米。由于表格使用 10 pt 大小的标准字体,比页面宽度宽,因此我在表格中使用较小的\footnoteseize
字体,并\tabcolsep
从默认字体减小6pt
到5pt
。使用同名包中的宏,\makecell
我实现了更清晰、更合乎逻辑的(当然,在我看来)表格设置结构。
梅威瑟:
\documentclass{article}
\usepackage{booktabs, makecell, multirow}
\usepackage[margin=25mm]{geometry}
\usepackage[range-phrase={\ to\ }]{siunitx}
\usepackage{eurosym}
\DeclareSIUnit{\bit}{bit}
\DeclareSIUnit{\EUR}{\text{\euro}}
\usepackage{lipsum}% for dummy text
\begin{document}
\lipsum[2]
\begin{table}[htb]
\centering
\footnotesize
\renewcommand\arraystretch{1.2}
\setlength\tabcolsep{5pt}
\begin{tabular}{*{5}{l}}
\toprule
\multirow{3}{*}{Parameters} & \multicolumn{4}{c}{Controllers} \\
\cmidrule{2-5}
& \makecell[l]{dsPIC33FJ64MC204\\ (Microchip)}
& \makecell[l]{dsPIC33EV64GM104\\ (Microchip)}
& \makecell[l]{S32K\\ (NXP)}
& \makecell[l]{XMC1402\\ (Infineon)} \\
\midrule
Architecture in \si{\bit}
& 16 & 16 & 32 & 32 \\
Temperature Range in \si{\celsius}
& \numrange{-40}{125}
& \numrange{-40}{150}
& \numrange{-40}{125}
& \numrange{-40}{125} \\
Voltage range in \si{\volt}
& \numrange{3.0}{3.6}
& \numrange{4.5}{5.5}
& \numrange{2.7}{5.5}
& \numrange{2.0}{5.5} \\
CPU speed in \si{\mega\hertz}
& 40 & 40 & upto 112 & 48 \\
\makecell[lt]{CPU performance in \si{\celsius}\\ for high temperature}
& $\numrange{-40}{125}= \SI{40}{MIPS}$
& $\numrange{-40}{150} = \SI{40}{MIPS}$ & & \\
\addlinespace
I/O pins
& 35 pins out of 44 pins
& \makecell[lt]{35 pins out of 44 pins\\ 53 pins out of 64 pins}
& & \makecell[lt]{35pins out of 48 pins\\
48 pins out of 64 pins} \\
Comparators
& \makecell[lt]{up to 2 analog\\ comparators}
& \makecell[lt]{up to 4 analog\\ comparators}
& & \makecell[lt]{upto 4 analog\\ comparators} \\
PWM resolution in \si{\nano\second}
& 25 & 7.14& & \\
\makecell[lt]{Communication\\ Interfaces}
& \makecell[lt]{2 UART modules\\ supports LIN 2.0\\ protocol}
& \makecell[lt]{2 UART modules\\ supports LIN 2.0\\ protocol}
& \makecell[lt]{communication\\ protocol emulation\\ for more LIN}
& \makecell[lt]{4 interface chanels\\
usable as UART\\ and LIN}\\
\addlinespace
Typical \si{MIPS\per\mega\hertz}
& 1 & 1.25 & 0.84 & \\
Price for QFN-44
& & $100 = \SI{2.55}{\EUR}$
& & $5\text{k} = \SI{1.46}{\EUR}$ \\
\phantom{Price for} QFN-64
& $100 = \SI{3.86}{\EUR}$
& $100 = \SI{3.51}{\EUR}$
& & $5\text{k} = \SI{1.92}{\EUR}$ \\
\bottomrule
\end{tabular}
\caption{Controller Comparison}
\label{tab:microproc}
\end{table}
\end{document}
如果文档中使用了较大的字体,并且表格中的文本必须与主文本使用相同的字体,则考虑将表格方向更改为横向似乎是明智的。为此,似乎可以使用方便的包rotating
并替换table in above MWE with its
sidewaystable` 环境。