我正在构建一个表格,其中每行包含一个图像,但是当我插入图像时,图像下方会出现很多空白,这使得行不必要地高。
该代码的最小工作示例如下:
\documentclass[twoside,11pt]{article}
\usepackage{geometry}
\geometry{verbose,tmargin=2cm,bmargin=2cm,lmargin=1.9cm,rmargin=3.8cm}
\renewcommand{\baselinestretch}{1.5}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{floatrow}
\floatsetup[table]{capposition=top}
\usepackage{graphics}
\begin{document}
{\fontfamily{cmss}\selectfont
\begin{table}[H]
\begin{tabular}{|p{2.7cm}|p{6.2cm}|p{1.7cm}|p{3.5cm}|}
\hline
\textbf{Process} & \textbf{Separation Conceot} &\textbf{Materials Passed} & \textbf{Typically Rejects} \\ \hline
Microfiltration & \includegraphics[width=1\linewidth]{Images/FloridaGDP.png}& Water and dissolved species & Large particles and micro-organisms \\ \hline
Ultrafiltation & \includegraphics[width=0.2\linewidth]{Images/Mobifilt.png} & Water and Salts & Bacteria and macro-molecules such as proteins \\ \hline
Nanofiltration & \includegraphics[width=0.2\linewidth]{Images/Mobifilt.png} & Water & Dissolved contaminants \\ \hline
Reverse Osmosis & \includegraphics[width=0.2\linewidth]{Images/Mobifilt.png} & Water & Particles and low molar mass species such as ions \\ \hline
\end{tabular}
\caption{Some caption}
\end{table}
\end{document}
答案1
在图形前添加一个 vspace 来改变对齐方式:
\documentclass[twoside,11pt]{article}
\usepackage{geometry}
\geometry{verbose,tmargin=2cm,bmargin=2cm,lmargin=1.9cm,rmargin=3.8cm}
\renewcommand{\baselinestretch}{1.5}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{floatrow}
\floatsetup[table]{capposition=top}
\begin{document}
\begin{table}[H]
\begin{tabular}{|p{2.7cm}|p{6.2cm}|p{1.7cm}|p{3.5cm}|}
\hline
\textbf{Process} & \textbf{Separation Conceot} &\textbf{Materials Passed} & \textbf{Typically Rejects} \\ \hline
Microfiltration & \vspace{-0.7\ht\strutbox}\includegraphics[width=1\linewidth]{example-image}& Water and dissolved species & Large particles and micro-organisms \\ \hline
\end{tabular}
\caption{Some caption}
\end{table}
\end{document}
答案2
使用该adjustbox
包,您可以指示图形顶部对齐:
\documentclass[twoside,11pt]{article}
\usepackage{geometry}
\geometry{verbose,tmargin=2cm,bmargin=2cm,lmargin=1.9cm,rmargin=3.8cm}
\renewcommand{\baselinestretch}{1.5}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{floatrow}
\floatsetup[table]{capposition=top}
\usepackage{graphics}
\usepackage[export]{adjustbox}
\begin{document}
{\fontfamily{cmss}\selectfont
\begin{table}[htbp]
\begin{tabular}{|p{2.7cm}|p{6.2cm}|p{1.7cm}|p{3.5cm}|}
\hline
\textbf{Process} & \textbf{Separation Conceot} &\textbf{Materials Passed} & \textbf{Typically Rejects} \\ \hline
Microfiltration & \includegraphics[width=1\linewidth,valign=t]{example-image-duck}& Water and dissolved species & Large particles and micro-organisms \\ \hline
Ultrafiltation & \includegraphics[width=0.2\linewidth,valign=t]{example-image-duck} & Water and Salts & Bacteria and macro-molecules such as proteins \\ \hline
Nanofiltration & \includegraphics[width=0.2\linewidth,valign=t]{example-image-duck} & Water & Dissolved contaminants \\ \hline
Reverse Osmosis & \includegraphics[width=0.2\linewidth,valign=t]{example-image-duck} & Water & Particles and low molar mass species such as ions \\ \hline
\end{tabular}
\caption{Some caption}
\end{table}
\end{document}