Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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} }
share|improve this question

migrated from stackoverflow.com Jan 31 '13 at 22:56

This question came from our site for professional and enthusiast programmers.

    
Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Jan 31 '13 at 23:11
add comment

1 Answer

It's hard to tell given no example, but placing \clearpage before your listing will stop floating figures and tables going past it.

share|improve this answer
    
That works fine. Thanks –  user792000 Feb 1 '13 at 0:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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