2

I have a Latex document where I need to put Figures and Tables in boxes. This can be accomplished with e.g. fbox, framed or mdframed. However, I need a solution that also allows me to annotate the box itself and I'm not sure that any of those packages can do this.

For example, I need something that looks like this:

+------------------------+
| note                   |
|                        |
|         Figure         |
|        Fig. Cap        |
|                        |
|                   note |
+------------------------+

Can anyone provide help, suggestions, or solutions?

  • Welcome to TeX.SX! What kind of annotations do you have in mind? – user31729 Jun 17 '16 at 14:36
  • @ChristianHupfer Simple text as indicated in my ascii diagram. It would be fine if the text is superimposed over the figure itself or also if it is only in the border whitespace. – Austin A. Jun 17 '16 at 14:38
3

Here is an example with a very simple tcolorbox setup:

In principle, the tcolorbox can 'conquer' the figure environment and blend into, this would mean, that the caption is at the top and displayed as the the title of the box.

\documentclass{article}

\usepackage{graphicx}

\usepackage{caption}
\usepackage[most]{tcolorbox}


\newtcolorbox{annotatedbox}[1][]{%
  enhanced jigsaw,
  sharp corners,
  colback=white,
  float=htb,
  boxsep=0pt,
  #1%
}

\usepackage{blindtext}

\begin{document}
\blindtext[5]
\begin{annotatedbox}
Some text before

\begin{center}
  \includegraphics[scale=0.2]{ente}
  \captionof{figure}{A beautiful duck}
\end{center}
\hfill Some other text right
\end{annotatedbox}

\blindtext[6]

\begin{annotatedbox}[colframe={red!40!brown},boxrule=5pt]
Some text before

\begin{center}
  \includegraphics[scale=0.2]{ente}
  \captionof{figure}{Another beautiful duck}
\end{center}
\hfill Some other text right
\end{annotatedbox}


\end{document}

enter image description here

  • @AustinA.: No, screen shots have to be added (which I have done just a minute ago) – user31729 Jun 17 '16 at 14:55
  • Well! That is 100% fabulous. Vielen Dank! – Austin A. Jun 17 '16 at 14:57
  • @AustinA.: You're welcome. tcolorbox has a tremendous amount of options -- have a look on the manual for many variations – user31729 Jun 17 '16 at 14:58
1

I would say you are looking for the package overpic, but as there are already many examples of this package in TeX.SX, just a different poor's man solution: overlap two minipages.

mwe

\documentclass{article}
\usepackage{graphicx,capt-of,lipsum,xcolor}
\parskip1em\fboxsep1em
\begin{document}
\lipsum[2]

\hfil\fbox{
\rlap{\begin{minipage}[c][5cm][c]{5cm}
  \centering
  \includegraphics[width=5cm]{cow}
\end{minipage}}%
\begin{minipage}[c][5cm][c]{6.5cm}
\textcolor{orange!50!red}{head}\hfill\vfill
\hfill \textcolor{orange!50!black}{\parbox{1.4cm}{$\leftarrow$ global warming}}\vfill
\hfill \textcolor{orange!50}{tail~~~~~~~}\vfill
\hfil\vspace{-5mm}\textcolor{green}{\bfseries milk}\vfill
\textcolor{orange}{forelegs} \hfill \textcolor{red}{hind legs}
\captionof{figure}{Milky way approximation risks.}
\end{minipage}}

\lipsum[3]
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.