Table margin problem, extra space is appear in the margin of table (see landscape table 3), also table position is wrongly appearing(I have place the second table in last but it appears as second also white space is appearing). For removing the white space i have use the this link
Please see the below code
\documentclass[5p,times]{elsarticle}
\usepackage{lipsum}
\usepackage{tabulary,longtable,afterpage}
\usepackage{booktabs}
\usepackage{longtable}
\setlength\LTcapwidth{1.5\linewidth}
\makeatletter
\AtBeginDocument{\@ifpackageloaded{rotating}{\PassOptionsToPackage{figuresright}{rotating}}{\usepackage[figuresright]{rotating}}\setlength{\rotFPtop}{0pt plus 1fil}\setlength{\rotFPbot}{0pt plus 1fil}}
\makeatother
\makeatletter
\AtBeginDocument{%
\@ifpackagewith{endfloat}{figuresonly}
{\DeclareDelayedFloatFlavor{sidewaysfigure}{figure}}%true
{\@ifpackagewith{endfloat}{tablesonly}{\DeclareDelayedFloatFlavor{sidewaystable}{table}}%true
{\@ifpackageloaded{endfloat}{\DeclareDelayedFloatFlavor{sidewaysfigure}{figure}\DeclareDelayedFloatFlavor{sidewaystable}{table}}{}}%false
}%false
}
\makeatother
\usepackage{pdflscape}
\makeatletter
\newcommand{\aftertwo}[1]{\afterpage{\if@firstcolumn #1
\else\afterpage{#1}\fi}}
\makeatother
\begin{document}
\begin{frontmatter}
\title{Title}
\author{So Nia}
\address{Department, University}
\ead{[email protected]}
\begin{abstract}
\lipsum*[2]
\end{abstract}
\end{frontmatter}
\section{Start}
\lipsum[1-20]
\aftertwo{
\onecolumn
\begin{landscape}
\begingroup
%\makeatletter\if@twocolumn\gdef\TwoColDocument{true}\onecolumn\onecolumn\fi\makeatother
\begin{longtable}{llll}
\caption{{margin problem } }
\label{table-wrap-fba274e78034f116895e336231c44998}
\def\arraystretch{1}\\\endfirsthead \hline \noalign{\vskip3pt} \noalign{\textit{Table \thetable\ continued}} \noalign{\vskip3pt} \hline \endhead \hline \noalign{\vskip3pt} \noalign{\textit{\hfill Continued on next page}} \noalign{\vskip3pt} \endfoot \endlastfoot
\hline
& & & \\
\hline
Top major diameter &
&
&
\\
Colour \$ &
Odour \$ &
Shape\$ &
Size\\
Top major diameter &
&
&
\\
&
Top major diameter &
&
\\
&
Top major diameter &
&
\\
Top major diameter &
&
&
\\
Top major diameter &
&
&
\\
&
Top major diameter &
&
\\
Standard (Yellow) &
Standard - Odour present &
Standard - funnel shaped &
Standard\\
&
&
Top major diameter &
\\
Top major diameter &
&
&
\\
Top major diameter &
&
&
\\
``BLU''\mbox{}\protect\newline Complement (Blue) &
``NIL''\mbox{}\protect\newline Odours absent \$ &
``CUP''\mbox{}\protect\newline Shallow funnel (0.5x) &
``LRG''\mbox{}\protect\newline Large (2x)\\
Top major diameter &
&
&
\\
&
&
Top major diameter &
\\
&
Top major diameter &
&
\\
&
&
Top major diameter &
\\
Top major diameter &
&
&
\\
&
Top major diameter &
&
\\
``BLK''\mbox{}\protect\newline Black &
- &
``FLT''\mbox{}\protect\newline Flat - no funnel &
``SML''\mbox{}\protect\newline Small (0.5x)\\
Top major diameter &
&
&
\\
\hline
\end{longtable}
\endgroup
%\makeatletter\@ifundefined{TwoColDocument}{}{\twocolumn}\makeatother
\end{landscape}
\twocolumn}
\lipsum[1-3]
\begin{sidewaystable*}
\caption{{Model dimensions (n=5)\protect\footnote{}} }
\label{table-wrap-dbcdcefc391c9632252d0f4af2b7564c}
\def\arraystretch{1}\ignorespaces
\centering
\begin{tabulary}{\linewidth}{LLLL}
\hline
& & & \\
\hline
Dimension &
Value (mm) &
Dimension &
Value (mm)\\
Top major diameter &
&
&
\\
Funnel depth &
32 &
Stem &
2.2\ensuremath{\times}2.2\ensuremath{\times}30\\
Top major diameter &
&
&
\\
Top major diameter &
16 &
Joint (cuboid) &
20\ensuremath{\times}13\ensuremath{\times}15\\
Top major diameter &
&
&
\\
Top major diameter &
Top major diameter &
&
\\
Top minor diameter &
12 &
Joint hole diameter &
2.5\\
Top major diameter &
&
&
\\
Top major diameter &
&
&
\\
Bottom major diameter &
8 &
Groove width &
5\\
&
&
&
\\
Bottom minor diameter &
6 &
Flower head &
37\ensuremath{\times}35\\
\hline
\end{tabulary}\par
\end{sidewaystable*}
\lipsum[1-3]
\begin{table}[!htbp]
\caption{{The table caption.} }
\label{table-wrap-080b5a6bf98cbec2ade1869d93533ff4}
\def\arraystretch{1}\ignorespaces
\centering
\begin{tabulary}{\linewidth}{LLLL}
\hline
& & & \\
\hline
thead1 &
thead2 &
thead3 &
thead4\\
jjjj &
dss &
&
\\
&
&
&
\\
\hline
\end{tabulary}\par
\end{table}
\lipsum[1-3]
\end{document}