How do I put a frame around multiple figures?

Viewed 3259

My code gives me two images on top of eachother on one page.

\documentclass{article}
\usepackage{graphicx}
\graphicspath{ {./images/} }

\begin{document}

\begin{figure}[H]
\includegraphics{cow1}
\caption{foo}
\label{fig:cow1}
\end{figure}

\begin{figure}[H]
\includegraphics{cow2}
\caption{bar}
\label{fig:cow2}
\end{figure}

\end{document}

I will get this: enter image description here

I want this: enter image description here How do I get a frame around the figures?

1 Answers
\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}

\graphicspath{ {./images/} }

\begin{document}

\fbox{
\parbox[c]{\textwidth}{
\centering
\includegraphics{example-image-duck}
\captionof{figure}{foo}
\label{fig:cow1}

\includegraphics{example-image-duck}
\captionof{figure}{bar}
\label{fig:cow2}
}}

\end{document}
Related