1

I insert a figure in my latex. But I want to make the background of the figure to be blue. How could I achieve that?

\begin{figure} [t]%[htbp]%[f]

\centering
\includegraphics[width= 0.65\linewidth]{./figs/BFSall.pdf} 
\caption{\color{blue}(a) BFSa-kNN; (b) BFSb-kNN.}
\label{implementationBFSKNN}
\end{figure}
leandriis
  • 62,593
BigTree
  • 73

1 Answers1

1

The mdframed package can add a coloured background if the bg of the pdf is transparent

\documentclass{article}
\usepackage{xcolor,mdframed}
\usepackage{graphicx}

\begin{document}

\begin{figure}[htbp]
\begin{mdframed}[backgroundcolor=blue!50,linecolor=blue!50]
\includegraphics[width=\linewidth]{example-image-a4-landscape.pdf}
\caption{text}
\end{mdframed}
\end{figure}


\begin{figure}[htbp]
\begin{mdframed}[backgroundcolor=blue!50,linecolor=blue!50]
\includegraphics[width=\linewidth]{example-image-a4-landscape.pdf}
\end{mdframed}
\caption{text}
\end{figure}

\end{document}
fevor
  • 243