Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am writing my thesis in LaTeX with the document class scrreprt. My problem is that I include a graphic whose description starts at the left side of the page, which is usually nice, but in my case I have an itemize and description environment where the text already has a big gap towards the left border. I want the description of the graphic to be indented too. This options should not be set globally but only for this one picture.

\begin{description}
\item[I) ] bla
\item[II) ] bla
  \begin{itemize}
    \item bla
    \item bla
      \begin{center}
    \includegraphics[width=0.88\textwidth]{bla.pdf}
    \captionof{figure}[bla]{this text should show up further to the right}
    \label{fig:bla}
      \end{center}
\item[III) ]
\end{itemize}
\end{description}
share|improve this question
    
Compiling your code leaves the expected result: The left margin of both the graphic + the caption is intended to the current list level, and from there the contents is centered on the page. To me this sounds exactly what you want. Is this not so? Please elaborate. –  Werner Oct 24 '11 at 15:29
    
@Werner: If I compile this code snipped with the same document preamble like in my answer below, I get a wrong centering of the caption, it's not centered unter the graphic. –  Axel Sommerfeldt Oct 24 '11 at 17:30
    
@AxelSommerfeldt: That's correct. I compiled it using ScribTeX that runs TeX Live 2009. Under that distribution, merely adding the (your) caption package to the preamble centers the caption. –  Werner Oct 24 '11 at 17:36
    
@Werner: I just tried it with ScribTeX and did not get a perfectly centered caption, either. (Tried it w/ and w/o caption package.) That's strange... –  Axel Sommerfeldt Oct 25 '11 at 6:21
    
@AxelSommerfeldt: On ScribTeX with preamble \documentclass{scrreprt}\usepackage[demo]{graphicx}\begin{document}...\end{docu‌​ment} = incorrect caption alignment; with preamble \documentclass{scrreprt}\usepackage[demo]{graphicx}\usepackage{caption}\begin{d‌​ocument}...\end{document} = correct alignment. Strange for sure... –  Werner Oct 25 '11 at 6:31
add comment

2 Answers

up vote 3 down vote accepted

You could use \setcapmargin locally, such as

\includegraphics[width=0.88\textwidth]{bla.pdf}
\setcapmargin[4cm]{1cm}
\captionof{figure}[bla]{this text should show up further to the right}
  • \setcapmargin[left margin]{margin} defines a margin and optionally different left margin for captions
  • \setcapmargin*[inner margin]{margin} defines a margin and optionally different inner margin for captions, useful for two-sided layout

For the left margin you could use the indentation length command of the environment you would like to match.

These are KOMA-Script commands, you can use them because you use scrreprt. The caption package provides similar features.

share|improve this answer
    
Thanks a lot.that helped... –  martin Oct 27 '11 at 18:33
add comment

You can put the figure in a minipage to get a proper alignment of the caption, for example:

\documentclass{scrreprt}
\usepackage[demo]{graphicx}
\begin{document}
\begin{description}
\item[I) ] bla
\item[II) ] bla
  \begin{itemize}
    \item bla
    \item bla
      \par\begin{minipage}{0.88\textwidth} % better replace 0.88\textwidth with \linewidth
        \centering
        \includegraphics[width=\textwidth]{bla.pdf}
        \captionof{figure}[bla]{this text should show up further to the right}
        \label{fig:bla}
      \end{minipage}
\item[III) ]
\end{itemize}
\end{description}
\end{document}
share|improve this answer
1  
Instead of guessing the .88\textwidth, \linewidth should be used for the width of the minipage. –  egreg Oct 24 '11 at 16:50
    
I just have copied the 0.88\textwidth from the code snipped given by the questioner. But (of course) you are right, \linewidth would have been a much better choice. I added this to my answer as a comment. –  Axel Sommerfeldt Oct 24 '11 at 17:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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