1

I tried to use this, but my table doesn't appears:

\begin{multicols}{2}
\includegraphics[scale=.3]{imagens/image.png}

\columnbreak

\begin{table}[!h] \begin{tabular}{|c|c|} \hline Faixa de consumo $(m^3)$ & Valor (R$)\ \hline Até 10 & 15,10\ & (valor fixo)\ \hline De 11 a 20 & Acrescentar\ & 2,35 por $m^3$\ \hline De 21 a 50 & Acrescentar\ & 5,50 por $m^3$\ \hline Acima de 50 & Acrescentar \ & 6,10 por $m^3$\ \hline \end{tabular} \end{table} \end{multicols}

  • 1
    I would recommend looking through https://tex.stackexchange.com/q/39017/107497. {table} means that it can float to where TeX thinks is best, which isn't what you're looking for. – Teepeemm Jun 15 '21 at 01:55

2 Answers2

1

It seems that you like to have image and table in parallel like this:

enter image description here

For this is multicols wrong environment since it not allow to contain floats. SO just dropped out and write something like this:

\documentclass{article}
\usepackage[export]{adjustbox}  % it load graphicx too

\begin{document} \begin{table}[ht] \centering \includegraphics[width=.3\linewidth, valign=c]{example-image-duck}%{imagens/image.png} % \hfil % \begin{tabular}{|c|c|} \hline Faixa de consumo $(m^3)$ & Valor (R$)\ \hline Até 10 & 15,10\ & (valor fixo)\ \hline De 11 a 20 & Acrescentar\ & 2,35 por $m^3$\ \hline De 21 a 50 & Acrescentar\ & 5,50 por $m^3$\ \hline Acima de 50 & Acrescentar \ & 6,10 por $m^3$\ \hline \end{tabular} \end{table} \end{document}

Zarko
  • 296,517
1

There are several ways to do this. This is one of the more convenient approached. At least, it would have been if the tabular had fit without adjusting the column widths.

\documentclass{article}
\usepackage{graphicx}
\usepackage{paracol}
\usepackage{showframe}% MWE only

\globalcounter{figure} \globalcounter{table}

\newsavebox{\tempbox}

\begin{document} \savebox{\tempbox}{\begin{tabular}{|c|c|} \hline Faixa de consumo $(m^3)$ & Valor (R$)\ \hline Até 10 & 15,10\ & (valor fixo)\ \hline De 11 a 20 & Acrescentar\ & 2,35 por $m^3$\ \hline De 21 a 50 & Acrescentar\ & 5,50 por $m^3$\ \hline Acima de 50 & Acrescentar \ & 6,10 por $m^3$\ \hline \end{tabular}}% measure width of tabular \setcolumnwidth{\dimexpr \textwidth-\columnsep-\wd\tempbox}% right column use remaining space \begin{paracol}{2}

\begin{figure} \includegraphics[width=\linewidth]{example-image} \caption{Example figure} \end{figure}

\switchcolumn

\begin{table} \caption{Example table} \centering% not actually needed \usebox\tempbox \end{table}

\end{paracol} \end{document}

John Kormylo
  • 79,712
  • 3
  • 50
  • 120