我尝试使用这个,但我的表格没有出现:
\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
看来你喜欢像这样并行放置图像和表格:
因为这是multicols
错误的环境,因为它不允许包含浮点数。所以我就退出了,写了类似这样的内容:
\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}
答案2
有几种方法可以做到这一点。这是比较方便的方法之一。至少,如果表格不需要调整列宽就可以适合,那么这种方法就比较方便。
\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}