0

enter image description here I am making a longtable in which one table contains long equations....

Q1. My first question is to how to fit those equations in limited space,,I already used the \begin{split} and \begin{align}..But they are not working

Q2. My second question is some extra space is there below and above the longtable,,pls tell me how to remove it

My code is like..

     \documentclass[conference]{IEEEtran}
  \IEEEoverridecommandlockouts
  % The preceding line is only needed to identify funding in the first 
footnote. If that is unneeded, please comment it out.
 \usepackage{cite}
  \usepackage[margin=2cm]{geometry}
 \usepackage[ export]{adjustbox}          % remove in real document
  % added
   \usepackage{makecell,           % added
        longtable}
\renewcommand\theadfont{\bfseries\small}
   \renewcommand\theadgape{}
  \usepackage{enumitem}
       \usepackage{amsmath,amssymb,amsfonts}
          \usepackage{algorithmic}
      \usepackage{graphicx}
     \usepackage{textcomp}
    \usepackage{xcolor}
   \usepackage{array,longtable}
    \usepackage{longtable,booktabs}

      % \usepackage[utf8]{inputenc}
    % \usepackage[demo]{graphicx}
    \usepackage{subfig}
   \renewcommand*{\arraystretch}{1.5}
      \usepackage{longtable}
        \def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
    T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}

    \begin{document}

\begingroup
     \small                              % for better fit text into cells
     \setlength{\LTcapwidth}{\linewidth} % that caption width is equal 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
       \centering
       %       \clearpage
         \onecolumn
        \begin{longtable}{|*{2}{p{\dimexpr0.16\linewidth-2\tabcolsep- 
       1.2\arrayrulewidth}|}
                       *{3}{p{\dimexpr0.26\linewidth-2\tabcolsep- 
        1.2\arrayrulewidth}|}}
          \caption{\textbf{Different Types of Activation Functions}}
           \label{tab:long}    \\
            \hline
        \    thead{Activation}  & \thead{Figure}        & \thead{Equation}
                    &  \thead{Advantages}    & \thead{Disadvantages}    \\
          \hline
           \endfirsthead
         \caption{Overview of papers including Image Compression Based On 
  Deep 
       Learning (cont.)}            \\
          \thead{Activation}  & \thead{Figure}        & \thead{Equation}
                    &  \thead{Advantages}    & \thead{Disadvantages}    \\
        \hline
      \endhead
        \hline
         \multicolumn{5}{r}{\footnotesize\textit{continued on the next 
 page}} 
      \endfoot
         \hline
       \endlastfoot

        textbf{Hard Elish}\cite{elish} 2018 
        & \includegraphics[valign=t]{hardelish.jpg}  
         &  $f{x}=\begin{cases}x* max(0,min(1,(\frac{x+1}{2}))) & \text{ if } 
         x\geqslant  \\ 
        (e^{x}-1) * max(0,min(1,(\frac{x+1}{2})))& \text{ if } x< 0
    \end{cases}$

        & \begin{itemize} 
        \item Hard variant of Elish 
        \item Product of Hard Sigmoid and Elu in negative part 
          \item Linear and hard sigmoid in positive part 
        \end{itemize} 
          &  good \\                     
         \end{longtable}
         \clearpage
           \twocolumn
      \endgroup

\end{document}

Longest row data

        \textbf{AbRelu}\cite{abrelu}  2018 
    & \includegraphics[valign=t]{abrelu.jpg}
     &  
   \begin{equation*}
        \begin{aligned}
       I(v)^{n+1}(\rho)=\begin{cases}
       I(v)^{n}(\rho)- \beta & \text{ if }I(v)^{n}(\rho)- \beta>0 \\ 
       0 &  otherwise 
       \end{cases}   // \beta =\alpha *A_{v}^n
    \end{aligned}
      \end{equation*}

          & \begin{itemize} 
           \item Solves the problem of dead neurons by making sure that the 
   neurons producing the values more than the average of all values in that 
      layer must not be dead 
       \item Allows the important negative signals as well as blocks the 
           irrelevant 
      positive signals based on the nature of the input volume 
      \item Data dependent and adjust the threshold based on the positive 
      and negative dominated data 
           \item Considers the average of the input volume to adjust the 
        input volume itself 
      \end{itemize} 
      &  \begin{itemize} 
      \item Exponential linear squashing function has almost same properties 
        as Swish function 
         \item Combination of Elu and Sigmoid activation function 
       \item Sigmoid part improves information flow and linear part improves 
    the problem of vanishing gradient 
   \item Considers the average of the input volume to adjust the input 
       volume itself \end{itemize} \\
         \hline
  • Please make you code compilable by adding the documentclass and the relevant packages. – leandriis Apr 30 at 18:01
  • I have edited for all packages – Dipti Mishra Apr 30 at 18:15
  • if i remember correctly, this if followup question of tex.stackexchange.com/questions/487580/…, but now with IEEEtran documentclass. you have two issues: (i) changing from two column to one column and than beck will always introduce new page. so you cant avoid blank spaces before and after this changes (ii) your equation is wider than proscribed width of column. you need to change width of column accordingly. Do you really need long table (is your table multi page long?), what is in the last column? some itemize list? – Zarko Apr 30 at 18:34
  • yes i really need this longtable, last column contains some points,,or single line,,,i have changed table from 2 column to one column and then 2 column again,,,,but this space issue i am not able to handle,,,and equation length also – Dipti Mishra Apr 30 at 18:42
  • possible solution is manually split table into two parts end enclosed it in table* float and for table environment use tabularx environment. is this an option= please, also provide content of one table row, which have longest text in its cells, special in the first and in the last. – Zarko Apr 30 at 18:50
2

as mentioned in comment, a possible solution is is manually split table into two parts end enclosed it in table* float and for table environment use tabularx environment. with help of the stfloats package place firstpart of the table on bottom of the page, and the second part on the top of the next page. with macro \ContinuedFloat assure that caption of the second part will have the same number as in the first part:

enter image description here

\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
% The preceding line is only needed to identify funding in the first footnote. If that is unneeded, please comment it out.
\usepackage{cite}
\usepackage[margin=2cm]{geometry}
\usepackage[demo,               % remove this option in a real document
            export]{adjustbox}

\usepackage{makecell,
            tabularx}           % added
\renewcommand\theadfont{\bfseries\small}
\renewcommand\theadgape{}
\usepackage{stfloats}           % added
\usepackage{caption}            % added

\usepackage{enumitem}
\usepackage{amsmath,amssymb}
\usepackage{algorithmic}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{array, booktabs, tabularx}
\newcolumntype{R}[1]{>{\raggedright\arraybackslash}X}

\usepackage{subfig}
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}

\usepackage{lipsum}  % for dummy text
\begin{document}
\lipsum[1-3]         % dummy text
    \begin{table*}[b]
  \caption{Different Types of Activation Functions}
   \label{tab:long}
\setlist[itemize]{  nosep,           % <-- itemize setup
                    leftmargin = *,
                    before     = \vspace{-.6\baselineskip},
                    after      = \vspace{-\baselineskip}
                    }
\setcellgapes{3pt}
\makegapedcells   % for additional vertical space around cells' contents
\setkeys{Gin}{width=\linewidth, height=12mm} % all images will have width of cell's width
    \setlength\tabcolsep{4pt}
    \footnotesize            % for better fit text into cells
\begin{tabularx}{\linewidth}{%
                    |*{2}{>{\raggedright}p{0.1\linewidth}|}
                          c|
                     *{2}{X|}
                            }
    \hline
    \thead{Activation}  & \thead{Figure}        & \thead{Equation}
                &  \thead{Advantages}    & \thead{Disadvantages}    \\
    \hline
\textbf{Hard Elish}\cite{elish} 2018
  & \includegraphics[valign=t]{hardelish.jpg}
  & \raisebox{-4ex}{ $       % need to be set according to included equation
    f{x} = \begin{cases}
        x\max(0,\min(1,(\frac{x+1}{2})))     &\text{ if }x\geqslant 0 \\
    (e^{x}-1)\max(0,\min(1,(\frac{x+1}{2}))) &\text{ if }x< 0
            \end{cases}         $}
 & \begin{itemize}
 \item Hard variant of Elish
 \item Product of Hard Sigmoid and Elu in negative part
  \item Linear and hard sigmoid in positive part
    \end{itemize}
      &  good \\
    \hline
\end{tabularx}
    \end{table*}
% manually split table
    \begin{table*}[t]
    \ContinuedFloat
  \caption{Different Types of Activation Functions (cont.)}
   \label{tab:long}
\setlist[itemize]{  nosep,           % <-- itemize setup
                    leftmargin = *,
                    before     = \vspace{-.6\baselineskip},
                    after      = \vspace{-\baselineskip}
                    }
\setcellgapes{3pt}
\makegapedcells   % for additional vertical space around cells' contents
\setkeys{Gin}{width=\linewidth, height=12mm} % all images will have width of cell's width
    \setlength\tabcolsep{4pt}
    \footnotesize            % for better fit text into cells
\begin{tabularx}{\linewidth}{%
                    |*{2}{>{\raggedright}p{0.1\linewidth}|}
                          c|
                     *{2}{X|}
                            }
    \hline
    \thead{Activation}  & \thead{Figure}        & \thead{Equation}
                &  \thead{Advantages}    & \thead{Disadvantages}    \\
    \hline
\textbf{Hard Elish}\cite{elish} 2018
  & \includegraphics[valign=t]{hardelish.jpg}
  & \raisebox{-4ex}{ $       % need to be set according to included equation
    f{x} = \begin{cases}
        x\max(0,\min(1,(\frac{x+1}{2})))     &\text{ if }x\geqslant 0 \\
    (e^{x}-1)\max(0,\min(1,(\frac{x+1}{2}))) &\text{ if }x< 0
            \end{cases}         $}
 & \begin{itemize}
 \item Hard variant of Elish
 \item Product of Hard Sigmoid and Elu in negative part
  \item Linear and hard sigmoid in positive part
    \end{itemize}
      &  good \\
    \hline
\end{tabularx}
  \end{table*}
\lipsum\lipsum    % dummy text
\end{document}

note: similar solution i already provide a time ago ...

  • Thanks but pls tell I am not finding any syntax to remove this extra text which you have taken yourself – Dipti Mishra May 1 at 5:09
  • @DiptiMishra, the package lipsum and commands \lipsum .... – Zarko May 1 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.