3

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).

  • 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}. – user31729 Mar 13 '14 at 16:11
3

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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