LaTeX 中图和表如何并排?

图和图并排可用minipage,那么图和表如何并排呢?
关注者
73
被浏览
223,941

4 个回答

\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\begin{document}
\begin{figure}
\begin{minipage}[b]{.5\linewidth}
\centering
\includegraphics[width=3cm]{example-image-1x1.pdf}
\caption{Image}
\end{minipage}%
\begin{minipage}[b]{.5\linewidth}
\centering
\begin{tabular}{|c|c|}
\hline
aa & bb \\ \hline
cc & dd \\ \hline
\end{tabular}
\captionof{table}{Table}
\end{minipage}
\end{figure}
\end{document}

借用

@刘海洋

的例子。floatrow 可以让图和表居中对齐,在这里是大材小用了。

\documentclass{article}
\usepackage{graphicx}
\usepackage{floatrow}
\floatsetup{heightadjust=all, floatrowsep=columnsep}
\newfloatcommand{figurebox}{figure}[\nocapbeside][\dimexpr(\textwidth-\columnsep)/2\relax]
\newfloatcommand{tablebox}{table}[\nocapbeside][\dimexpr(\textwidth-\columnsep)/2\relax]
\begin{document}
\begin{figure}[htbp]
\begin{floatrow}[2]
\figurebox{\caption{Image}}{%
  \includegraphics[width=3cm]{example-image-1x1.pdf}}%
\tablebox{\caption{Table}}{%
  \begin{tabular}{|c|c|}
    \hline
    aa & bb \\ \hline
    cc & dd \\ \hline
  \end{tabular}}
\end{floatrow}
\end{figure}
\end{document}

倒是不难,但是,跟我学:

LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX
LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX
LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX
LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX
LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX
LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX
LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX
LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX
LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX
LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX LaTeX

\documentclass{article}
\usepackage{graphicx}
\usepackage{float}
\newfloat{figtab}{htb}{fgtb}
\makeatletter
  \newcommand\figcaption{\def\@captype{figure}\caption}
  \newcommand\tabcaption{\def\@captype{table}\caption}
\makeatother
\begin{document}
\begin{figtab}
  \begin{minipage}[b]{0.45\linewidth}
    \centering
    \includegraphics[width = \linewidth]{example-image}
    \figcaption{Example Image}
  \end{minipage}\quad
  \begin{minipage}[b]{0.45\linewidth}
    \centering
    \tabcaption{Example Tabular}
    \begin{tabular}{cc}
      Hello & world
    \end{tabular}
  \end{minipage}
\end{figtab}
\end{document}

很多时候,或是为了便于理解,或是为了加强对比,需要一行两列并排显示图片或者表格,可以使用 minipage 进行实现

  • 图片+公式
\begin{figure}[H]
\begin{minipage}{0.48\linewidth}
 \centerline{\includegraphics[width=4.0cm]{yaw.png}}
\end{minipage}
\hfill
\begin{minipage}{.48\linewidth}
\begin{displaymath} %\label{zrot}
{R(z,\psi)} = \left[ {\begin{array}{*{20}{c}}
{\cos \psi }&{\sin \psi }&0\\
{ - \sin \psi }&{\cos \psi }&0\\
0&0&1
\end{array}} \right]
\end{displaymath}
\end{minipage}
\caption{偏航角转动示意图}
\label{zrotate}
\end{figure}


  • 表格并列
\begin{table}[H]
\begin{minipage}{0.48\linewidth}
\centering
\caption{ 偏航角$\psi$的真值表 }
\begin{tabular}{c|c|c} 
\hline  
$r_{22}$ & $r_{12}$ & $\psi$ \\
\hline  
\multirow{1}{1.5cm}{$\to 0 $} & \multirow{1}{1.5cm}{$+$} & \multirow{1}{2cm}{90\deg} \\
\hline  
$\to 0$ & $-$  & $ -$90\deg \\
 \hline 
$-$ & $+$  & $ \psi_m + 180$\deg \\
 \hline 
$-$ & $-$  & $ \psi_m - 180$\deg \\
 \hline 
\end{tabular} 
\end{minipage}\begin{minipage}{0.48\linewidth}  
\centering
\caption{ 横滚角$\phi$的真值表 }
\begin{tabular}{c|c|c} 
\hline  
$\phi_m$ & $r_{33}$ & $\phi$ \\
\hline  
\multirow{1}{1.5cm}{$+$} &\multirow{2}{1.5cm}{ $+$ } & \multirow{2}{2cm}{ $\phi_m$} \\
 \cline{1-1} 
$-$ &    &   \\
 \hline 
$+$ & $-$  & $ \phi_m - 180$\deg \\
 \hline 
$-$ & $-$  & $ \phi_m + 180$\deg \\
 \hline