我正在尝试使用 subfloat 为作为子图包含的表格添加标题。我使用了它,\captionof
但它弹出错误。有人能帮助我吗?
\begin{figure}
\subfloat[]{
\label{tab-travelplansymbols}
\begin{adjustbox}{scale=0.7,valign=b}
\renewcommand{\arraystretch}{1.2}
\begin{tabular}{l l l l}
\hline
\multirow{2}{*}{State}&
\multirow{2}{*}{Traveler Action}&
\multirow{2}{*}{Guard}&
\multirow{2}{*}{Description}\\
&&&\\
\hline
\faHome & Staying Home & \faBellO,\faBellSlashO & Phone ringing,silent\\
\faBed & Sleeping & \faClockO & Traffic delay\\
\faChild & Waking up & \faThumbsOUp & ID approved\\
\faCoffee & Having Coffee & \faMoonO & Normal weather\\
\faBus & Taking bus & \faFlash & Adverse weather\\
\faArrowCircleRight & Check-in & &\\
\faMapMarker & Airport & &\\
\faPlane & Flight & &\\
\faHourglass & Oversleeping & &\\
\faInternetExplorer & Online ticket purchase & &\\
\faTaxi & Taking taxi & &\\
\hline
\end{tabular}
%\captionof{table}{Travel plan description.}
\end{adjustbox}
}
\end{figure}
答案1
我看不出有什么理由使用figure
环境来排版手头的表格。table
相反,我会使用环境,这样我就可以省去subfigure
一路上的开销。
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{booktabs}
\usepackage{fontawesome}
\begin{document}
\begin{table}
\centering
\caption{Travel plan description}
\label{tab-travelplansymbols}
\smallskip
\renewcommand{\arraystretch}{1.2}
\begin{tabular}{@{} llll @{}}
\toprule
State & Traveler Action & Guard & Description \\
\midrule
\faHome & Staying Home & \faBellO,\faBellSlashO & Phone ringing,silent\\
\faBed & Sleeping & \faClockO & Traffic delay\\
\faChild & Waking up & \faThumbsOUp & ID approved\\
\faCoffee & Having Coffee & \faMoonO & Normal weather\\
\faBus & Taking bus & \faFlash & Adverse weather\\
\faArrowCircleRight & Check-in & &\\
\faMapMarker & Airport & &\\
\faPlane & Flight & &\\
\faHourglass & Oversleeping & &\\
\faInternetExplorer & Online ticket purchase & &\\
\faTaxi & Taking taxi & &\\
\bottomrule
\end{tabular}
\end{table}
\end{document}