3

I have a document using floats and endfloat and causing a headache – I wish to have my figures and tables in place and remove relevant code from endfloat.

Which lines of code shall I remove from the following MWE?

documentclass[3p,authoryear,preprint,12pt,onecolumn]{elsarticle}
\long\def\twocolumn[#1]{#1}
\makeatletter\@twocolumnfalse \makeatother
\usepackage[nomarkers, nolists,tablesonly]{endfloat}

%\usepackage{tabulary,graphicx}

\usepackage{booktabs} %\usepackage{lscape} %\usepackage{longtable} \usepackage[normalem]{ulem} \useunder{\uline}{\ul}{} \usepackage{subfigure}

\usepackage{tabulary,xcolor} \usepackage{amsfonts,amsmath,amssymb} \usepackage[T1]{fontenc} \makeatletter \let\save@ps@pprintTitle\ps@pprintTitle \def\ps@pprintTitle{\save@ps@pprintTitle\gdef@oddfoot{\footnotesize\itshape \null\hfill\today}} \def\hlinewd#1{% \noalign{\ifnum0=`}\fi\hrule @height #1 \futurelet\reserved@a@xhline} \def\tbltoprule{\hlinewd{.8pt}\[-12pt]} \def\tblbottomrule{\hlinewd{.8pt}} \def\tblmidrule{\noalign{\vspace{6pt}}\hline\noalign{\vspace{2pt}}} \AtBeginDocument{\ifNAT@numbers \biboptions{sort&compress}\fi} \makeatother

\usepackage{ifluatex} \ifluatex \usepackage{fontspec} \defaultfontfeatures{Ligatures=TeX} \usepackage[]{unicode-math} \unimathsetup{math-style=TeX} \else \usepackage[utf8]{inputenc} \fi \ifluatex\else\usepackage{stmaryrd}\fi

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Following additional macros are required to function some % functions which are not available in the class used. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage{url,multirow,morefloats,floatflt,cancel,tfrupee} \makeatletter \AtBeginDocument{@ifpackageloaded{textcomp}{}{\usepackage{textcomp}}} \makeatother \usepackage{colortbl} \usepackage{xcolor} \usepackage{pifont} \usepackage[nointegrals]{wasysym} \urlstyle{rm} \makeatletter

%%%For Table column width calculation. \def\mcWidth#1{\csname TY@F#1\endcsname+\tabcolsep}

%%Hacking center and right align for table \def\cAlignHack{\rightskip@flushglue\leftskip@flushglue\parindent\z@\parfillskip\z@skip} \def\rAlignHack{\rightskip\z@skip\leftskip@flushglue \parindent\z@\parfillskip\z@skip}

\if@twocolumn\usepackage{dblfloatfix}\fi \AtBeginDocument{ \expandafter\ifx\csname eqalign\endcsname\relax \def\eqalign#1{\null\vcenter{\def\{\cr}\openup\jot\m@th \ialign{\strut$\displaystyle{##}$\hfil&$\displaystyle{{}##}$\hfil \crcr#1\crcr}},} \fi }

\let\lt=< \let\gt=> \def\processVert{\ifmmode|\else\textbar\fi} \let\processvert\processVert

@ifundefined{subparagraph}{ \def\subparagraph{@startsection{paragraph}{5}{2\parindent}{0ex plus 0.1ex minus 0.1ex}% {0ex}{\normalfont\small\itshape}}% }{}

% These are now gobbled, so won't appear in the PDF. \newcommand\role[1]{\unskip} \newcommand\aucollab[1]{\unskip}

@ifundefined{tsGraphicsScaleX}{\gdef\tsGraphicsScaleX{1}}{} @ifundefined{tsGraphicsScaleY}{\gdef\tsGraphicsScaleY{.9}}{} % To automatically resize figures to fit inside the text area \def\checkGraphicsWidth{\ifdim\Gin@nat@width>\linewidth \tsGraphicsScaleX\linewidth\else\Gin@nat@width\fi}

\def\checkGraphicsHeight{\ifdim\Gin@nat@height>.9\textheight \tsGraphicsScaleY\textheight\else\Gin@nat@height\fi}

\def\fixFloatSize#1{}%@ifundefined{processdelayedfloats}{\setbox0=\hbox{\includegraphics{#1}}\ifnum\wd0<\columnwidth\relax\renewenvironment{figure*}{\begin{figure}}{\end{figure}}\fi}{}} \let\ts@includegraphics\includegraphics

\def\inlinegraphic[#1]#2{{\edef@tempa{#1}\edef\baseline@shift{\ifx@tempa@empty0\else#1\fi}\edef\tempZ{\the\numexpr(\numexpr(\baseline@shift*\f@size/100))}\protect\raisebox{\tempZ pt}{\ts@includegraphics{#2}}}}

%\renewcommand{\includegraphics}[1]{\ts@includegraphics[width=\checkGraphicsWidth]{#1}} \AtBeginDocument{\def\includegraphics{@ifnextchar[{\ts@includegraphics}{\ts@includegraphics[width=\checkGraphicsWidth,height=\checkGraphicsHeight,keepaspectratio]}}}

\def\URL#1#2{@ifundefined{href}{#2}{\href{#1}{#2}}}

%%For url break \def\UrlOrds{\do*\do-\do~\do'\do&quot;\do-}% \g@addto@macro{\UrlBreaks}{\UrlOrds} \makeatother \def\floatpagefraction{0.8} \def\dblfloatpagefraction{0.8} \def\style#1#2{#2} \def\xxxguillemotleft{\fontencoding{T1}\selectfont\guillemotleft} \def\xxxguillemotright{\fontencoding{T1}\selectfont\guillemotright} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \emergencystretch 15pt \def\floatpagefraction{0.8}

Marijn
  • 37,699

1 Answers1

0

Use these two packages

  1. \usepackage{float};
  2. \usepackage{flafter}.

and also use [H] option with the figures and the tables.

\begin{figure}[H]
  \includegraphics[width=\linewidth]{images/Figure1.jpg}
  \caption{No-way}
  \label{fig1}
\end{figure}
Sebastiano
  • 54,118