[Tex/LaTex] How to set the horizontal separation only in a framebox

boxesframed

I'm using the command \fcolorbox to add a framebox around an image.
I want to set the horizontal separation only.
With \fboxsep I set the separation all around.

\documentclass[oneside]{article}

\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{xcolor}

\definecolor{light-gray}{gray}{0.75}
\setlength{\fboxsep}{2pt}

\begin{document}
  \begin{minipage}{0.5\linewidth}
    \fcolorbox{light-gray}{white}{\includegraphics[trim=0mm 2mm 0mm 2mm, clip=true, scale=1]{../figures/fig.pdf}}
  \end{minipage}
\end{document}

Best Answer

\documentclass{article}
\usepackage{graphicx}
\usepackage{xcolor}
\newcommand\FBox[3][1ex]{{% default space is 1ex
    \color{light-gray}\frame{\hspace{#1}\includegraphics[#2]{#3}\hspace{#1}}}}
\definecolor{light-gray}{gray}{0.75}

\begin{document}
\frame{\includegraphics[width=4cm]{tiger}}% without space

\FBox[2em]{width=4cm}{tiger}% horizontal space is 2em

\FBox{width=4cm}{tiger}% now the default of 1ex     
\end{document} 

enter image description here

If you are using the beamer class then modify the command to:

\let\myFrame\frame
\documentclass{beamer}
\newcommand\FBox[3][1ex]{{% default space is 1ex
        \color{light-gray}\myFrame{\hspace{#1}\includegraphics[#2]{#3}\hspace{#1}}}}
\definecolor{light-gray}{gray}{0.75}
...