I was trying to set a caption on an image that was placed within an mdframed box at the right side of the document. the structure is like

\begin{mdframed}[frametitle={my title},style = MyFrame] \label{box: storysn1}

i tried using \caption inside \insertBoxR but it raise errors. does anyone know how to correctly set the caption in cases like this one? thanks

example of what i want to achieve ( ijust want a caption under the image) enter image description here

what i get with /parbox

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

enter image description here

  • I would put the \includegraphicx in a \parbox and use \captionof{figure}{Some caption} after a blank line (requires the caption package).
    – Bernard
    Dec 22, 2021 at 16:28
  • @Bernard hi bernard, i tried using '\parbox' as you said but the text goes over the image. is there something else i need to set? i have not used latex for a long time
    – Alucard
    Dec 22, 2021 at 16:50
  • Did you set the width of the \parbox?
    – Bernard
    Dec 22, 2021 at 17:41
  • @bernard ah yes,now the text doesn't cover the image. but how do i push the image at the right of the text? it seems i cannot user '\insertBoxR' anymore
    – Alucard
    Dec 22, 2021 at 17:47
  • I tested and had no special problem. Could you post what you tried exactly? The only difficulty I've ever seen is that TeX doesn't always calculate the correct number of shorter lines, but it can be circumvented with the optional argument of \InsertBoxR to specify the number of supplementary shorter lines that are required.
    – Bernard
    Dec 22, 2021 at 17:53


You must log in to answer this question.

Browse other questions tagged .