如何删除一个表的最后一行。我的代码如下。
%\documentclass[review]{elsarticle}
\documentclass{article}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage[skip=0.5\baselineskip,skip=0.5\abovecaptionskip]{caption}
%\usepackage[hyphens]{url}
\usepackage{hyperref}
\usepackage{verbatim}
\hyphenation{presents}
\setlength{\textfloatsep}{3pt}
\date{February 2022}
%%% journal %%%
\begin{document}
\begin{table}
\centering
\caption{Test)}
\begin{tabular}
{|m{2.3cm}<{\centering}|m{10cm}<{\centering}|}
\hline
Process Operation Type & PLC action \\
\hline
Robot (Automation) & \begin{enumerate}
\item From 1939, the SS assumed responsibility for “solving” the so-called Jewish Question; after 1941, its leadership planned, coordinated and directed the so-called Final Solution of the Jewish Question. This “solution” was the annihilation of the European Jews, which we now refer to as the Holocaust.
\item
In 1925, Adolf Hitler, the Führer of the National Socialist German Worker's Party (Nationalsozialistische Deutsche Arbeiterpartei-NSDAP), or Nazi party, established the SS. Subordinated to the chief of staff of the SA (Sturmabteilungen; Assault Detachments), the SS had the following duties: protecting Hitler and other Nazi l
\end{enumerate} \\
\hline
\end{tabular}
\label{label:mapping_rule_examples}
\end{table}
\end{document}
这是我得到的表格。我想删除最后一个空行,如红色标记。有人能帮我吗?
答案1
使用 tabularray (stretch=-1) 和 enumitem (nosep)。
%\documentclass[review]{elsarticle}
\documentclass{article}
%https://tex.stackexchange.com/questions/659691/how-to-remove-the-last-line-of-one-table
\usepackage{tabularray}
\usepackage{enumitem}
\begin{document}
\begin{tblr}{
hlines,vlines,
colspec={
Q[m,c,wd=2.3cm]
Q[m,c,wd=10cm]
},
stretch=-1%<--- remove extra space above and below lists with nosep option
% doc p.51 tabularray
}
Process Operation Type & PLC action \\
Robot (Automation) & \begin{enumerate}[left=0pt,nosep]
\item From 1939, the SS assumed responsibility for “solving” the so-called Jewish Question; after 1941, its leadership planned, coordinated and directed the so-called Final Solution of the Jewish Question. This “solution” was the annihilation of the European Jews, which we now refer to as the Holocaust.
\item In 1925, Adolf Hitler, the Führer of the National Socialist German Worker's Party (Nationalsozialistische Deutsche Arbeiterpartei-NSDAP), or Nazi party, established the SS. Subordinated to the chief of staff of the SA (Sturmabteilungen; Assault Detachments), the SS had the following duties: protecting Hitler and other Nazi l
\end{enumerate}%
\end{tblr}
\end{document}
答案2
如果您加载enumeitem
,则可以自定义列表。以下代码适用nosep
于附加键before=...
和after=...
。前者使列表紧凑,后者是在列表前后添加代码,在示例中运行\vspace{}
以更改列表前后的间距(请参阅文档了解更多信息)
\documentclass{article}
% \usepackage{graphicx}
\usepackage{tabularx}
\usepackage[skip=0.5\baselineskip,skip=0.5\abovecaptionskip]{caption}
% \usepackage[hyphens]{url}
% \usepackage{hyperref}
\usepackage{enumitem} % For customising lists
\usepackage{ragged2e} % For \Centering and \RaggedRight
% \usepackage{verbatim}
\usepackage{mathtools} % Adds xmathstrut
% \hyphenation{presents}
\setlength{\textfloatsep}{3pt}
\date{February 2022}
%%% journal %%%
\begin{document}
\begin{table}[tbh]
\setlist[enumerate]{ % Settings for the inner enumerate
nosep,
leftmargin=1.5em,
labelwidth=1em,
before=\vspace{0.25\baselineskip},
after=\vspace{-0.75\baselineskip},
}
\renewcommand{\tabularxcolumn}[1]{>{\RaggedRight}m{#1}}
\newcolumntype{C}[1]{>{\Centering}m{#1}} % p{#1} for the middletop alignment
\centering
\caption{Test}
\begin{tabularx}{\linewidth}{|>{\Centering}m{2.3cm}|X|}
\hline
\multicolumn{1}{|C{2.3cm}|}{\rule{0pt}{2.5ex}Process\newline Operation\newline Type\rule[-1.2ex]{0pt}{1.2ex}}
& \multicolumn{1}{>{\Centering}X|}{PLC action} \\
\hline
Robot (Automation) & \begin{enumerate}
\item
Italy (Italian: Italia [iˈtaːlja] (listen)), officially the Italian Republic or the Republic of Italy[12][13] (Italian: Repubblica Italiana [reˈpubblika itaˈljaːna]),[14][15] is a country that consists of a peninsula delimited by the Alps and several islands surrounding it;[note 1] its territory largely coincides with the homonymous geographical region.[16] Italy is located in the middle of the Mediterranean Sea, in Southern Europe;[17][18][19]
\item
Italy (Italian: Italia [iˈtaːlja] (listen)), officially the Italian Republic or the Republic of Italy[12][13] (Italian: Repubblica Italiana [reˈpubblika itaˈljaːna]),[14][15] is a country that consists of a peninsula delimited by the Alps and several islands surrounding it;[note 1] its territory largely coincides with the homonymous geographical region.[16] Italy is located in the middle of the Mediterranean Sea, in Southern Europe;[17][18][19]
\end{enumerate} \\
\hline
Human (Manual) & \begin{enumerate}
\item
it is also considered part of Western Europe.[20][note 2] A unitary parliamentary republic with Rome as its capital and largest city, the country covers a total area of 301,230 km2 (116,310 sq mi) and shares land borders with France, Switzerland, Austria, Slovenia and the enclaved microstates of Vatican City and San Marino. Italy has a territorial exclave in Switzerland, Campione. With over 60 million inhabitants,[21] Italy is the third-most populous member state of the European Union.
\end{enumerate} \\
\hline
\end{tabularx}
\label{label:mapping_rule_examples}
\end{table}
\end{document}
答案3
这有点不合常理,但您可以在第 31 行\vspace{-0.3cm}
之前添加\end{enumerate}
以删除该空格。您还可以调整使用的确切值,以使间距恰好达到您想要的值。