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 would like to have these two tables as items of this list. Currently they are appearing outside the list, on the top of the page.

\documentclass[12pt, oneside]{article}

\usepackage[brazil]{babel}
\usepackage[latin1,utf8]{inputenc}
\usepackage{enumerate}

\begin{document}

%%%%%%%%% problem

  \begin{itemize}
    \item item1
    \item item2
    \begin{table}
    \parbox{.45\linewidth}{
    \centering
        \begin{tabular}{l|ll}
        + & 0 & 1 \\ \hline
        0 & 0 & 1 \\
        1 & 1 & 0 \\
        \end{tabular}
    \caption{adicao}
    }
    \hfill
    \parbox{.45\linewidth}{
    \centering
        \begin{tabular}{l|ll}
        . & 0 & 1 \\ \hline
        0 & 0 & 1 \\
        1 & 0 & 1 \\
        \end{tabular}
    \caption{mult}
    }
    \end{table}

  \end{itemize}
\end{document}

I have been searching about how to do it, however, until now I've only found how to do the opposite (how to insert lists in tables).

share|improve this question
1  
Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Christian Hupfer Mar 13 at 16:11

1 Answer 1

up vote 3 down vote accepted

The problem is that the table environment is a float, and float placement is handled in a very particular way by LaTeX. You can use the package float, which gives a float placement option, H, that essentially causes the float to no longer be treated as a float.

(Shameless self promotion: see my answer to Is there any way to shift two \includegraphics images? Having trouble with \begin{figure} for a discussion about the different possible parameters for float placement in LaTeX.)

\documentclass{article}

\usepackage[brazil]{babel}
\usepackage[latin1,utf8]{inputenc}
\usepackage{enumerate}

\usepackage{float}

\begin{document}

\begin{itemize}

    \item item 1

    \item item 2

        \begin{table}[H]
        \parbox{.45\linewidth}{
        \centering
        \begin{tabular}{l|ll}
        + & 0 & 1 \\ \hline
        0 & 0 & 1 \\
        1 & 1 & 0 \\
        \end{tabular}
        \caption{Adição}
        }
        \hfill
        \parbox{.45\linewidth}{
        \centering
        \begin{tabular}{l|ll}
        . & 0 & 1 \\ \hline
        0 & 0 & 1 \\
        1 & 0 & 1 \\
        \end{tabular}
        \caption{Multiplicação}
        }

        \end{table}

    \item item 3

\end{itemize}

\end{document}

enter image description here

share|improve this answer

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.