I am having a problem with latex environment. When I place r code using \begin{lstlisting} ... code..\end{lstlisting} other objects like tables are displayed only after the script subsections, despite it maintains the order in the content table page.
Anyone knows how can I control this issue? here is my preamble:
\documentclass[12pt,a4paper,oneside]{article}
\usepackage{setspace}
\usepackage{natbib}
\usepackage{booktabs}
\usepackage{dcolumn}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{listings,relsize}
\lstset{
basicstyle=\small,
keywordstyle=\color{red}\itshape,
commentstyle=\color{blue},
stringstyle=\ttfamily,
showstringspaces=false,
numbers=left, numberstyle=\tiny,
columns=fullflexible }
\newcommand{\ra} [1] {\renewcommand{\arraystretch} {#1} }