我想制作一个长表(3到4页),共5列,包含其名称、图形、公式、优点和缺点
但是当我使用 longtable 包和其他来自网络的帮助材料时,我无法获得所需的表,尽管发生了各种错误
这是简码
\documentclass{article}
\usepackage{longtable}
% \usepackage[left=0.2cm, right=1cm, top=2cm]{geometry}
\title{A longtable example}
\begin{document}
\begin{center}
\begin{longtable}{|p{2.5cm}|p{3cm}|p{2cm}|p{2cm}|p{2cm}|}
\caption{Overview of papers including Image Compression Based On Deep
Learning Techniques} \label{tab:long} \\
\hline
\hline \multicolumn{1}{c}{\textbf{Activation }} &\multicolumn{1}{c}
{\textbf{Figure}} & \multicolumn{1}{c}{\textbf{Equation}} & \multicolumn{1}
{c}{\textbf{Advantage}} & \multicolumn{1}{c}{\textbf{Advantage}}
%& \multicolumn{1}{c|}{\textbf{Third column}} \\ \hline
\endfirsthead
\multicolumn{5}{c}%
{{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
\hline \multicolumn{1}{c}{\textbf{Equation}} & \multicolumn{1}{c}
{\textbf{Advantage}} & \multicolumn{1}{c}{\textbf{Advantage}}
% \hline
% & \multicolumn{1}{c|}{\textbf{Third column}} \\ \hline
% \endhead
% \hline \multicolumn{3}{|r|}{{Continued on next page}} \\ \hline
% \endfoot
\hline
\endlastfoot
\hline
% \multicolumn{2}{c}{\textbf{CNN Based Architectures}} \\
% \hline
\textbf{Sigmoid}\cite{sigmoid} 1995 & \includegraphics[width=20mm]
{sigmoid1.jpg}
& $\sigma(x)=\frac{1}{1+e^{-x}}$ & Squashes numbers in the range [0,1]
& \begin{itemize} \item Causes saturation by killing the gradients \item
Not zero centered which makes it impracticable to use \item Exponential function is a bit expensive function making it infeasible to use in practice \end{itemize} \\
end{longtable}
\end{center}
\end{document}
请帮我如何制作包含方程式和其他描述的长表
答案1
请尝试以下操作:
\documentclass{article}
\usepackage[margin=2cm]{geometry}
\usepackage[demo, % in real document remove option "demo"
export]{adjustbox} % added
\usepackage{makecell, % added
longtable}
\renewcommand\theadfont{\bfseries\small} % added
\renewcommand\theadgape{} % added
\usepackage{enumitem}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\begingroup
\small % for better fit text into cells
\setlength{\LTcapwidth}{\linewidth} % that caption width is equal to table width
\setlist[itemize]{ nosep, % itemize setup
leftmargin = *,
before = \vspace{-\baselineskip},
after = \vspace{-\baselineskip}
}
\setcellgapes{3pt}
\makegapedcells % for additional vertica space around cells' contents
\setlength\tabcolsep{4pt}
\setkeys{Gin}{width=\linewidth} % all images will have width equal to cell's widths
\begin{longtable}{|*{3}{p{\dimexpr0.16\linewidth-2\tabcolsep-1.2\arrayrulewidth}|}
*{2}{p{\dimexpr0.26\linewidth-2\tabcolsep-1.2\arrayrulewidth}|}}
\caption{Overview of papers including Image Compression Based On Deep Learning Techniques}
\label{tab:long} \\
\hline
\thead{Activation} & \thead{Figure} & \thead{Equation}
& \thead{Advantage} & \thead{Disadvantage} \\
\hline
\endfirsthead
\caption{Overview of papers including Image Compression Based On Deep Learning (cont.)} \\
\thead{Activation} & \thead{Figure} & \thead{Equation}
& \thead{Advantage} & \thead{Disadvantage} \\
\hline
\endhead
\hline
\multicolumn{5}{r}{\footnotesize\textit{continued on the next page}}
\endfoot
\hline
\endlastfoot
\textbf{Sigmoid}\cite{sigmoid} 1995
& \includegraphics[valign=t]{sigmoid1.jpg}
& $\sigma(x)=\frac{1}{1+e^{-x}}$
& Squashes numbers in the range [0,1]
& \begin{itemize}
\item Causes saturation by killing the gradients
\item Not zero centered which makes it impracticable to use
\item Exponential function is a bit expensive function making it infeasible to use in practice
\end{itemize} \\
\end{longtable}
\endgroup
\end{document}
(红线表示文本边框)