Graphics, Figures & Tablesinsert an image with caption in a mdframed env at the right of the text

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Alucard
Posts: 2
Joined: Fri Dec 24, 2021 6:11 am

insert an image with caption in a mdframed env at the right of the text

Post by Alucard »

Hi everyone, this is my first message, i hope this is the right section. i was trying to add a small image at the right of the main text in a personalized mdframed environment with \insertboxr but i fail to add the caption under the image

Code: Select all

\usepackage[framemethod=TikZ]{mdframed}
\usepackage{lipsum}
\usepackage{caption}


\mdfdefinestyle{MyFrame}{%
frametitlealignment=\center,
frametitlerulecolor= black,
frametitlerulewidth=0.2pt
outerlinewidth=0pt,
repeatframetitle =false,
frametitlebackgroundcolor=gray!55!white,
frametitlerule=true,
topline=false,
rightline=false,
leftline=false,
bottomline=false,
roundcorner=20pt,
splittopskip=\baselineskip,
innertopmargin= 5pt\baselineskip,
innerbottommargin=\baselineskip,
innerrightmargin=20pt,
(see full text)

\begin{mdframed}[frametitle={a short history of supernovae observations from the classic age to the renaissance},style = MyFrame] \label{box: storysn1}
\input{insbox}
In Europe the event was recorded by the monks at St. Gall's Abbey in Switzerland in the \textit{"Annales Sangallenses Maiores, dicti Hepidanni"} with the words

\InsertBoxR{0}{\enspace\includegraphics[width=0.39\textwidth]{images/annales.PNG}}


\textit{"Nova stella apparuit insolitae magnitudinis, aspectu fulgurans, et oculos verberans, non sine terrore. Quae mirum in modum aliquando contractior, aliquando diffusior, et iam extinguebatur interdum. Visa est autem per tres menses in intimis finibus austri, ultra omnia signa qua videntur in coelo "}.
The remnants associated with this star has been identified in 1965 with the radio source PKS 1459-41 by Gardner and Milne.

\end{mdframed}
which gives me
Image

another latex user suggest to use

Code: Select all

\parbox{5cm}{ \raggedleft \includegraphics[width = 5cm]{images/annales.PNG}}
in place of

Code: Select all

\insertBoxR
but the result is not the same
Image


do you know how to correctly add the caption under the image in mdframed and place it to the right of the text?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Alucard
Posts: 2
Joined: Fri Dec 24, 2021 6:11 am

insert an image with caption in a mdframed env at the right of the text

Post by Alucard »

ahhh i think i have found a solution with

Code: Select all

\InsertBoxR{0}{\begin{minipage}[t]{0.4\textwidth}
    \includegraphics[width=0.9\textwidth]{images/annales.PNG}
    \captionsetup{format=hang, justification= raggedright, font=small}
    \centering 
    \captionof{figure}{pag 222 of codex 915}
  \end{minipage}}[2]
but i was wondering if there is a better solution that avoid minipage
Post Reply