我尝试使用 fbox 来框定我的图形,但结果却放大了图形并破坏了格式。如何让 fbox 不放大图形?例如\fbox(enlarge=False){\includegrahics...}
,如何让 2 个 fbox 具有不同的颜色?
编辑:我发现使用\frame{\includegraphics...}
不会放大图形。但是我如何更改框架颜色?
\documentclass{article}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{float}
\usepackage{subfig}
\usepackage{tikz}% loads graphicx
\begin{document}
\makeatletter
\newcommand{\definetrim}[2]{%
\define@key{Gin}{#1}[]{\setkeys{Gin}{trim=#2,clip}}%
}
\makeatother
\definetrim{kit_mocap}{0 0 0 0} % {left bottom right top}
\def\barheight{0.015}
\def\imagewidth{0.12\textwidth}
\def\imagehspace{\hspace{-0.2em}}
\def\imagevspace{\vspace{-0.3cm}}
\setlength{\fboxrule}{1pt}
\setlength{\fboxsep}{0pt}
\begin{figure*}[ht]
\centering
\subfloat{
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=\imagewidth,kit_mocap,clip]{example-image-a}};
\end{tikzpicture}}\imagehspace
\subfloat{
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=\imagewidth,kit_mocap,clip]{example-image-a}};
\end{tikzpicture}}\imagehspace
\subfloat{
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=\imagewidth,kit_mocap,clip]{example-image-a}};
\end{tikzpicture}}\imagehspace
\subfloat{
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=\imagewidth,kit_mocap,clip]{example-image-a}};
\end{tikzpicture}}\imagehspace
\subfloat{
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=\imagewidth,kit_mocap,clip]{example-image-a}};
\end{tikzpicture}}\imagehspace
\subfloat{
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=\imagewidth,kit_mocap,clip]{example-image-a}};
\end{tikzpicture}}\imagehspace
\subfloat{
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=\imagewidth,kit_mocap,clip]{example-image-a}};
\end{tikzpicture}}\imagehspace
\subfloat{
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=\imagewidth,kit_mocap,clip]{example-image-a}};
\end{tikzpicture}}\imagevspace
\subfloat{
\begin{tikzpicture}[remember picture]
\node[inner sep=0] (image1) at (0,0) {\includegraphics[width=\imagewidth,kit_mocap,clip]{example-image-a}};
\end{tikzpicture}}\imagehspace
\subfloat{
\begin{tikzpicture}[remember picture]
\node[anchor=south west,inner sep=0] (image2) at (0,0) {\includegraphics[width=\imagewidth,kit_mocap,clip]{example-image-a}};
\end{tikzpicture}}\imagehspace
\subfloat{
\begin{tikzpicture}[remember picture]
\node[inner sep=0] (image3) at (0,0) {\includegraphics[width=\imagewidth,kit_mocap,clip]{example-image-a}};
\end{tikzpicture}}\imagehspace
\subfloat{
\begin{tikzpicture}[remember picture]
\node[anchor=south west,inner sep=0] (image4) at (0,0) {\includegraphics[width=\imagewidth,kit_mocap,clip]{example-image-a}};
\end{tikzpicture}}\imagehspace
\subfloat{
\begin{tikzpicture}[remember picture]
\node[anchor=south west,inner sep=0] (image5) at (0,0) {\includegraphics[width=\imagewidth,kit_mocap,clip]{example-image-a}};
\end{tikzpicture}}\imagehspace
\subfloat{
\begin{tikzpicture}[remember picture]
\node[anchor=south west,inner sep=0] (image6) at (0,0) {\includegraphics[width=\imagewidth,kit_mocap,clip]{example-image-a}};
\end{tikzpicture}}\imagehspace
\subfloat{
\begin{tikzpicture}[remember picture]
\node[anchor=south west,inner sep=0] (image7) at (0,0) {\includegraphics[width=\imagewidth,kit_mocap,clip]{example-image-a}};
\end{tikzpicture}}\imagehspace
\subfloat{
\begin{tikzpicture}[remember picture]
\node[anchor=south west,inner sep=0] (image8) at (0,0) {\includegraphics[width=\imagewidth,kit_mocap,clip]{example-image-a}};
\end{tikzpicture}}\imagevspace
\subfloat{
\begin{tikzpicture}[remember picture]
\node[inner sep=0] (image1) at (0,0) {\fbox{\includegraphics[width=\imagewidth,clip]{example-image-a}}};
\end{tikzpicture}}\imagehspace
\subfloat{
\begin{tikzpicture}[remember picture]
\node[anchor=south west,inner sep=0] (image2) at (0,0) {\fbox{\includegraphics[width=\imagewidth,clip]{example-image-a}}};
\end{tikzpicture}}\imagehspace
\subfloat{
\begin{tikzpicture}[remember picture]
\node[inner sep=0] (image3) at (0,0) {\includegraphics[width=\imagewidth,clip]{example-image-a}};
\end{tikzpicture}}\imagehspace
\subfloat{
\begin{tikzpicture}[remember picture]
\node[anchor=south west,inner sep=0] (image4) at (0,0) {\includegraphics[width=\imagewidth,clip]{example-image-a}};
\end{tikzpicture}}\imagehspace
\subfloat{
\begin{tikzpicture}[remember picture]
\node[anchor=south west,inner sep=0] (image5) at (0,0) {\includegraphics[width=\imagewidth,clip]{example-image-a}};
\end{tikzpicture}}\imagehspace
\subfloat{
\begin{tikzpicture}[remember picture]
\node[anchor=south west,inner sep=0] (image6) at (0,0) {\includegraphics[width=\imagewidth,clip]{example-image-a}};
\end{tikzpicture}}\imagehspace
\subfloat{
\begin{tikzpicture}[remember picture]
\node[anchor=south west,inner sep=0] (image7) at (0,0) {\includegraphics[width=\imagewidth,clip]{example-image-a}};
\end{tikzpicture}}\imagehspace
\subfloat{
\begin{tikzpicture}[remember picture]
\node[anchor=south west,inner sep=0] (image8) at (0,0) {\includegraphics[width=\imagewidth,clip]{example-image-a}};
\end{tikzpicture}}
\end{figure*}
\end{document}
答案1
使用预定义的图像宽度(\imagewidth
在您的示例中是通过),您可以在内部设置盒装图像\makebox[\imagewidth]{\fbox{...}}
:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\setlength{\fboxrule}{1pt}%
\setlength{\fboxsep}{0pt}%
\def\imagewidth{0.12\textwidth}%
\centering
\includegraphics[width=\imagewidth]{example-image-a}
\makebox[\imagewidth]{\fbox{\includegraphics[width=\imagewidth]{example-image-a}}}
\includegraphics[width=\imagewidth]{example-image-a}
\includegraphics[width=\imagewidth]{example-image-a}
\includegraphics[width=\imagewidth]{example-image-a}
\includegraphics[width=\imagewidth]{example-image-a}
\addvspace{.2\baselineskip}
\includegraphics[width=\imagewidth]{example-image-a}
\includegraphics[width=\imagewidth]{example-image-a}
\makebox[\imagewidth]{\fbox{\includegraphics[width=\imagewidth]{example-image-a}}}
\includegraphics[width=\imagewidth]{example-image-a}
\includegraphics[width=\imagewidth]{example-image-a}
\includegraphics[width=\imagewidth]{example-image-a}
\addvspace{.2\baselineskip}
\includegraphics[width=\imagewidth]{example-image-a}
\includegraphics[width=\imagewidth]{example-image-a}
\includegraphics[width=\imagewidth]{example-image-a}
\includegraphics[width=\imagewidth]{example-image-a}
\makebox[\imagewidth]{\fbox{\includegraphics[width=\imagewidth]{example-image-a}}}
\addvspace{.2\baselineskip}
\includegraphics[width=\imagewidth]{example-image-a}
\makebox[\imagewidth]{\fbox{\includegraphics[width=\imagewidth]{example-image-a}}}
\includegraphics[width=\imagewidth]{example-image-a}
\end{figure}
\end{document}
如果它影响垂直对齐,您也可以合并\smash
。