how to change color of frames around graphics using framed package

Christopher Ryan cryan at binghamton.edu
Tue Mar 21 18:16:49 CET 2023


Trying to put frames/boxes, of varying color, around my graphics and their
associated captions. Using MikTeX on Win 10, and experimenting with the
framed package.

The code below puts a black box around the graphic, despite my efforts, in
the preamble, to make that frame red. Uncommenting the
\definecolor{framecolor} line within the framed environment itself doesn't
help.

\documentclass[11pt]{article}

\usepackage{graphicx}
\usepackage[margin=0.75in]{geometry}
\usepackage{framed}
\usepackage{xcolor}
\definecolor{framecolor}{named}{red}
\definecolor{shadecolor}{named}{blue}

\begin{document}

\begin{figure}\centering
  \begin{framed}
   % \definecolor{framecolor}{named}{red}
    \includegraphics{emsdailyscatterplotsmoother}
    \end{framed}
\end{figure}

\end{document}

In contrast, the code below does indeed set the background color of a
shaded region blue, as I'd expect.

\documentclass[11pt]{article}

\usepackage{graphicx}
\usepackage[margin=0.75in]{geometry}
\usepackage{framed}
\usepackage{xcolor}
\definecolor{framecolor}{named}{red}
\definecolor{shadecolor}{named}{blue}

\begin{document}

\begin{figure}\centering
  \begin{shaded}
    \includegraphics{emsdailyscatterplotsmoother}
    \end{shaded}
\end{figure}

\end{document}


I have not found any instructions in the framed package documentation about
how to change or set color of the frame. Grateful for any advice.

-Chris Ryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/texhax/attachments/20230321/aa084218/attachment.html>


More information about the texhax mailing list.