我想要一个更紧凑的版本(减少项目之间的行距),表格单元格内的项目,所以我使用了[nosep]
for items。它减少了空间,但仍然显示的内容与我需要的相差甚远。还有其他方法可以更紧凑吗?
模板内的代码:
\begin{table}[H]
\centering
\caption*{(i) Based on the type of battery RFID tags can be of three types:}
\small
\begin{tabular}{ |c|p{2cm}|p{10cm}|}
\hline
\textbf{Ser} & \textbf{Item} & \Centering \textbf{Detail}
\\ \hline
1. & Active & \begin{itemize}[nosep]
\item Has its own transmitter and power source (Battery)
\item Transmits signal from the microchip circuit through the power obtained from the internal battery
\item High signal range
\item Larger in size
\item Expensive than passive
\item The batteries must be replaced
periodically
\end{itemize} \\ \hline
2. & Passive & \begin{itemize}[nosep]
\item Operate without a separate external power source
\item Obtains operating power from the reader
\item Low signal range
\item Cheaper than active tags
\item Smaller in size
\end{itemize} \\ \hline
3. & Semi passive/ Battery Assisted Passive (BAP) & \begin{itemize}[nosep]
\item Has a small battery and is activated when in the presence of an RFID reader
\item Communication method is same as the passive tag
\end{itemize} \\ \hline
\end{tabular}
\end{table}
模板输出:
更新-1:
当我将代码从模板移到新的简单 documentclass 文章中时,我发现它压缩得很好。该问题的可能原因是什么?
刮刮卡代码:
\documentclass{article}
\usepackage{enumerate}
\usepackage[table]{xcolor}
\usepackage{cite, changepage, calc, enumitem, linegoal, datetime}
\begin{document}
\begin{table}[H]
\centering
\caption*{(i) Based on the type of battery RFID tags can be of three types:}
\small
\begin{tabular}{ |c|p{2cm}|p{10cm}|}
\hline
\textbf{Ser} & \textbf{Item} & \textbf{Detail}
\\ \hline
1. & Active & \begin{itemize}
\item Has its own transmitter and power source (Battery)
\item Transmits signal from the microchip circuit through the power obtained from the internal battery
\item High signal range
\item Larger in size
\item Expensive than passive
\item The batteries must be replaced
periodically
\end{itemize} \\ \hline
2. & Passive & \begin{itemize}[nosep]
\item Operate without a separate external power source
\item Obtains operating power from the reader
\item Low signal range
\item Cheaper than active tags
\item Smaller in size
\end{itemize} \\ \hline
3. & Semi passive/ Battery Assisted Passive (BAP) & \begin{itemize}[nosep]
\item Has a small battery and is activated when in the presence of an RFID reader
\item Communication method is same as the passive tag
\end{itemize} \\ \hline
\end{tabular}
\end{table}
\end{document}
输出结果为:
答案1
我建议你
采用一种
tabularx
环境,将第三列(类型X
)设置为自动扩展至最大可能的宽度,同时允许自动换行;使用包的机制
enumitem
来创建一个自定义的 itemize 类型列表环境,称为myitemize
——随意想一个更时髦的名字!——它使用选项nosep
并将自身嵌入其中minipage
,所有这些都是在“幕后”透明地完成的。(因为它使用了低级宏
\hsize
,所以myitemize
环境应该只在列中使用X
。当然,一如既往,如果你清楚自己在做什么在其他情况下,你也可能成功使用myitemize
。然而,不保证X
在环境中的 -type 列外工作tabularx
。)
\documentclass{article}
\usepackage{tabularx,ragged2e}
%% Ragged-right rather than full justification in narrow columns:
\newcolumntype{P}[1]{>{\RaggedRight\arraybackslash}p{#1}}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
% Create a bespoke itemize-type list environment
\usepackage{enumitem}
\newlist{myitemize}{itemize}{1}
\setlist[myitemize]{label=\textbullet, nosep, left=0pt,
before={\begin{minipage}[t]{\hsize}},
after ={\end{minipage}} }
\usepackage{caption} % for "\caption*" macro
\captionsetup{skip=0.333\baselineskip,
justification=RaggedRight,
singlelinecheck=false}
% Calculate width of second column:
\newlength\mylen
\settowidth\mylen{Battery Assisted}
\begin{document}
\begin{table}
\setlength\extrarowheight{2pt} % for a less "cramped look
\caption*{(i) Based on the type of battery, RFID tags can be of three types:}
%\small % not needed
\begin{tabularx}{\textwidth}{| c | P{\mylen} | L |}
\hline
Ser & Item & Detail \\
\hline
1. & Active &
\begin{myitemize}
\item Has its own transmitter and power source (Battery)
\item Transmits signal from the microchip circuit through the power obtained from the internal battery
\item High signal range
\item Larger in size
\item Expensive than passive
\item The batteries must be replaced periodically
\end{myitemize} \\
\hline
2. & Passive
& \begin{myitemize}
\item Operate without a separate external power source
\item Obtains operating power from the reader
\item Low signal range
\item Cheaper than active tags
\item Smaller in size
\end{myitemize} \\
\hline
3. & Semi passive\slash Battery Assisted Passive (BAP)
& \begin{myitemize}
\item Has a small battery and is activated when in the presence of an RFID reader
\item Communication method is same as the passive tag
\end{myitemize} \\
\hline
\end{tabularx}
\end{table}
\end{document}