如何并排插入表格

如何并排插入表格

我创建了两个并排的表格,并将表格从 Excel 复制粘贴到网站 tablesgenerator.com。我删除了中间的列来划分两个表格,但我对结果并不满意,因为边界似乎没有很好地定义。

你能帮我分别定义两个表的边界吗?

代码:

% Please add the following required packages to your document preamble:
% \usepackage[table,xcdraw]{xcolor}
% If you use beamer only pass "xcolor=table" option, i.e. 

\usepackage{lipsum}
\usepackage{subfig}
\usepackage{hyperref}
\usepackage{listings}
\usepackage{float}
\usepackage{caption}
\usepackage{varioref}
\usepackage{amsmath}
\usepackage{latexsym}
\usepackage{amsfonts}
\usepackage{gensymb}    
\usepackage[table,xcdraw]{xcolor}
\usepackage{adjustbox}
\usepackage{subfig}
\usepackage{subcaption}
\usepackage{color}     %testo colorato
\usepackage{multirow}
\usepackage{multicol}
\usepackage{textcomp}
\usepackage{array, boldline, makecell, booktabs}




\documentclass[xcolor=table]{beamer}
\begin{table}[]
\begin{tabular}{ccc|c|c|}
\cline{1-2} \cline{4-5}
\rowcolor[HTML]{F54A19} 
\multicolumn{2}{|c|}{\cellcolor[HTML]{F54A19}{\color[HTML]{FFFFFF} \textbf{RDA MAIN INPUT REQUIREMENT}}} &
 \cellcolor[HTML]{FFFFFF} &
 \multicolumn{2}{c|}{\cellcolor[HTML]{F54A19}{\color[HTML]{FFFFFF} \textbf{ANTENNA REQUIREMENT}}} \\ \cline{1-2} \cline{4-5} 
\rowcolor[HTML]{FDDCD3} 
\multicolumn{1}{|c|}{\cellcolor[HTML]{FDDCD3}\textbf{Mass}} &
 \multicolumn{1}{c|}{\cellcolor[HTML]{FDDCD3}\textless{}10 Kg} &
 \cellcolor[HTML]{FFFFFF} &
 \textbf{Carrier Frequency} &
 F0 = 35.76 GHz \\ \cline{1-2} \cline{4-5} 
\rowcolor[HTML]{FFFFFF} 
\multicolumn{1}{|c|}{\cellcolor[HTML]{FFFFFF}\textbf{Power consumption}} &
 \multicolumn{1}{c|}{\cellcolor[HTML]{FFFFFF}\textless 55 W (antennas included)} &
  &
 \textbf{Antenna Beams} &
 \begin{tabular}[c]{@{}c@{}}4 (available in time \\ division multiple access)\end{tabular} \\ \cline{1-2} \cline{4-5} 
\rowcolor[HTML]{FDDCD3} 
\multicolumn{1}{|c|}{\cellcolor[HTML]{FDDCD3}\textbf{\begin{tabular}[c]{@{}c@{}}Altitude Operational \\ envelope\end{tabular}}} &
 \multicolumn{1}{c|}{\cellcolor[HTML]{FDDCD3}\begin{tabular}[c]{@{}c@{}}Hmax = 6500 m\\ Hmin = 10 m\end{tabular}} &
 \cellcolor[HTML]{FFFFFF} &
 \textbf{TX Peak Power} &
 1 W \\ \cline{1-2} \cline{4-5} 
\rowcolor[HTML]{FFFFFF} 
\multicolumn{1}{|c|}{\cellcolor[HTML]{FFFFFF}\textbf{\begin{tabular}[c]{@{}c@{}}Velocity Operational \\ envelope\end{tabular}}} &
 \multicolumn{1}{c|}{\cellcolor[HTML]{FFFFFF}V(vertical) \textless 115m/s} &
  &
 \textbf{TX BW} &
 200 MHz \\ \cline{1-2} \cline{4-5} 
\rowcolor[HTML]{FDDCD3} 
\multicolumn{1}{|c|}{\cellcolor[HTML]{FDDCD3}\textbf{\begin{tabular}[c]{@{}c@{}}Velocity measurement \\ error\end{tabular}}} &
 \multicolumn{1}{c|}{\cellcolor[HTML]{FDDCD3}VBi: 0.5\% V + 0,2m/s} &
 \cellcolor[HTML]{FFFFFF} &
 \textbf{Pulse width} &
 40 ÷ 2560 ns \\ \cline{1-2} \cline{4-5} 
\rowcolor[HTML]{FFFFFF} 
\multicolumn{1}{|c|}{\cellcolor[HTML]{FFFFFF}\textbf{\begin{tabular}[c]{@{}c@{}}Altitude measurement \\ error\end{tabular}}} &
 \multicolumn{1}{c|}{\cellcolor[HTML]{FFFFFF}RBi: 0.5\% H + 0.4 m} &
  &
 \textbf{PRI} &
 10 ÷ 240 usec \\ \cline{1-2} \cline{4-5} 
\rowcolor[HTML]{FDDCD3} 
\multicolumn{1}{|c|}{\cellcolor[HTML]{FDDCD3}\textbf{Acceleration}} &
 \multicolumn{1}{c|}{\cellcolor[HTML]{FDDCD3}\begin{tabular}[c]{@{}c@{}}ax up to 9.3 m/s2;\\ ay, az up to 2.65 m/s2\end{tabular}} &
 \cellcolor[HTML]{FFFFFF} &
 \textbf{RX signal BW} &
 50 MHz \\ \cline{1-2} \cline{4-5} 
\rowcolor[HTML]{FFFFFF} 
\multicolumn{1}{|c|}{\cellcolor[HTML]{FFFFFF}\textbf{Jerk}} &
 \multicolumn{1}{c|}{\cellcolor[HTML]{FFFFFF}\begin{tabular}[c]{@{}c@{}}jx up to 93 m/s\textasciicircum{}3\\ jy, jz up to 26.5 m/s\textasciicircum{}3\end{tabular}} &
  &
 \textbf{Refresh rate} &
 20 Hz \\ \cline{1-2} \cline{4-5} 
\rowcolor[HTML]{FDDCD3} 
\multicolumn{1}{|c|}{\cellcolor[HTML]{FDDCD3}\textbf{\begin{tabular}[c]{@{}c@{}}Measure refresh \\ rate\end{tabular}}} &
 \multicolumn{1}{c|}{\cellcolor[HTML]{FDDCD3}20 Hz} &
 \cellcolor[HTML]{FFFFFF} &
 \textbf{\begin{tabular}[c]{@{}c@{}}Antenna sidelobe \\ level\end{tabular}} &
 \textless -35 dB \\ \cline{1-2} \cline{4-5} 
\rowcolor[HTML]{FFFFFF} 
\textbf{} &
  &
  &
 \textbf{Antenna directivity} &
 \textgreater 34 dB \\ \cline{4-5} 
\end{tabular}
\end{table}

下面是我导出 PDF 文档的示例。我想在画蓝线的地方画黑线 在此处输入图片描述

答案1

我想建议大家重新思考一下:不要制定黑色规则——或者蓝色规则。你的读者会感激你的。

以下解决方案采用了tabularx允许单元格换行的环境。它还尽可能地减少了过多的\color\cellcolor\rowcolor命令,其中许多命令要么是多余的,要么是相互冲突的。请使用包\SI的宏siunitx来排版科学单位及其相关数量。

最后的建议是:不要使用全大写的标题,除非你真的想对读者大喊大叫。

在此处输入图片描述

\documentclass{article}
\usepackage[letterpaper,margin=1in]{geometry} % set page parameters suitably
\usepackage{tabularx,ragged2e}
\newcolumntype{C}{>{\Centering\arraybackslash}X}
\newcolumntype{B}{>{\bfseries}C}
\renewcommand\tabularxcolumn[1]{m{#1}}

\usepackage[table]{xcolor}
\newcommand\cA{\color{white}}
\newcommand\rcB{\rowcolor[HTML]{FDDCD3}} % pink

\usepackage{booktabs,siunitx,amsmath}
\sisetup{per-mode=symbol}

\begin{document}
\begin{table}
\setlength\extrarowheight{2pt} % for a more open "look"
\begin{tabularx}{\textwidth}{ BC >{\cellcolor{white}}c BC }

\rowcolor[HTML]{F54A19} % red
\multicolumn{2}{c}{\cA \textbf{RDA main input requirement}} 
&&
\multicolumn{2}{c}{\cA \textbf{Antenna requirement}} \\ 
  
\rcB % pink
Mass & $<\SI{10}{\kilogram}$ 
&&
Carrier Frequency & $F_0 = \SI{35.76}{\giga\hertz}$ \\  

Power consumption & $<\SI{55}{\watt}$ (antennas included) 
&&
Antenna Beams & 4 (available in time division multiple access) \\ 
 
\rcB 
Altitude Operational envelope &
\mbox{Hmax = \SI{6500}{\meter}} \mbox{Hmin = \SI{10}{\meter}} 
&&
TX Peak Power & \SI{1}{\watt} \\ 
 
Velocity Operational envelope &
$V(\text{vertical}) < \SI{115}{\meter\per\second}$ 
&&
TX BW & \SI{200}{\mega\hertz} \\ 
 
\rcB 
Velocity measurement error & VBi: 0.5\%~V + \SI{0.2}{\meter\per\second} 
&&
Pulse width & 40 ÷ \SI{2560}{\nano\second} \\ 

Altitude measurement error & RBi: 0.5\% H + \SI{0.4}{\meter} 
&&
PRI & 10 ÷ \SI{240}{\micro\second} \\  

\rcB 
Acceleration & 
\mbox{$a_x$ up to \SI{9.3}{\meter\per\second\squared}}
\mbox{$a_y$, $a_z$ up to \SI{2.65}{\meter\per\second\squared}}
&&
RX signal BW & \SI{50}{\mega\hertz} \\ 
   
Jerk &
\mbox{$j_x$ up to \SI{93}{\meter\per\second\cubed}} 
\mbox{$j_y$, $j_z$ up to \SI{26.5}{\meter\per\second\cubed}} 
&&
Refresh rate & \SI{20}{\hertz} \\ 
  
\rcB 
Measure refresh rate & \SI{20}{\hertz}
&&
Antenna sidelobe level & $<\SI{-35}{\deci\bel}$ \\ 
  
& &&
Antenna directivity & $>\SI{34}{\deci\bel}$ \\
\bottomrule
\end{tabularx}
\end{table}

\end{document}

附录:下面是我在文档中排版表格的方法beamer。主要变化是 (a) 第 1 列和第 3 列不再使用粗体,(b) 第 2 列比其他 3 列略宽,(c) 使用\scriptsize

我不得不说,这张表包含的信息太多了,无法向观众一一展示。

在此处输入图片描述

\documentclass[xcolor=table]{beamer}

\usepackage{tabularx,ragged2e}
\newcolumntype{C}[1]{>{\Centering\hsize=#1\hsize}X}
\renewcommand\tabularxcolumn[1]{m{#1}}

%\usepackage[table]{xcolor} % 'xcolor' is loaded automatically by beamer
\newcommand\cA{\color{white}}
\newcommand\rcB{\rowcolor[HTML]{FDDCD3}} % pink

\usepackage{siunitx}
\sisetup{per-mode=symbol}

\begin{document}
\begin{frame}
\scriptsize

\setlength\tabcolsep{2pt} 
\setlength\extrarowheight{2pt} % for a more open "look"
\begin{tabularx}{\textwidth}{C{0.97}C{1.09} >{\cellcolor{white}}c C{0.97}C{0.97}}

\rowcolor[HTML]{F54A19} % red
\multicolumn{2}{c}{\cA \textbf{RDA main input requirement}} 
&&
\multicolumn{2}{c}{\cA \textbf{Antenna requirement}} \\ 
  
\rcB % pink
Mass & $<\SI{10}{\kilogram}$ 
&&
Carrier frequency & $F_0 = \SI{35.76}{\giga\hertz}$ \\  

Power consumption & $<\SI{55}{\watt}$ (antennas included) 
&&
Antenna beams & 4 (available in TDMA) \\ 
 
\rcB 
Altitude operational envelope &
\mbox{Hmax = \SI{6500}{\meter}} \mbox{Hmin = \SI{10}{\meter}} 
&&
TX Peak power & \SI{1}{\watt} \\ 
 
Velocity operational envelope &
$V(\text{vertical}) <\SI{115}{\meter\per\second}$ 
&&
TX BW & \SI{200}{\mega\hertz} \\ 
 
\rcB 
Velocity measurement error &
VBi: 0.5\%~V + \SI{0.2}{\meter\per\second} 
&&
Pulse width & 40 ÷ \SI{2560}{\nano\second} \\ 

Altitude measurement error & RBi: 0.5\% H + \SI{0.4}{\meter} 
&&
PRI & 10 ÷ \SI{240}{\micro\second} \\  

\rcB 
Acceleration & 
\mbox{$a_x$ up to \SI{9.3}{\meter\per\second\squared}}
\mbox{$a_y,a_z$ up to \SI{2.65}{\meter\per\second\squared}}
&&
RX signal BW & \SI{50}{\mega\hertz} \\ 
   
Jerk &
\mbox{$j_x$ up to \SI{93}{\meter\per\second\cubed}} 
\mbox{$j_y,j_z$ up to \SI{26.5}{\meter\per\second\cubed}} 
&&
Refresh rate & \SI{20}{\hertz} \\ 
  
\rcB 
Measure refresh rate & \SI{20}{\hertz}
&&
Antenna sidelobe level & $<\SI{-35}{\deci\bel}$ \\ 
  

& &&
Antenna directivity & $>\SI{34}{\deci\bel}$ \\
\end{tabularx}
\end{frame}

\end{document}

相关内容