1

In my document, the widths of captions depend on the widths of the figures:

  • For large images captions are large enough

enter image description here

\begin{SCfigure}[][p!]
\begin{tikzpicture}[x=20mm,y=20mm]
\begin{axis}[
            std_empty,
            width = 70mm,
        %   height = 60mm,
            xmin = -2,
            xmax = 2.2,
            ymax=1.1,
                ]
\addplot[   const plot mark mid,
            ]
coordinates 
{   (-2,0)
    (-1.5,0.2)
    (-1,0.6)
    (-0.5,0.7)
    (0,0.95)
    (0.5,0.8)
    (1,0.4)
    (1.5,0.3)
    (2,0)
};
\addplot[   sharp plot,
            ]
coordinates 
{   (-2,0)
    (-1.5,0.2)
    (-1,0.6)
    (-0.5,0.7)
    (0,0.95)
    (0.5,0.8)
    (1,0.4)
    (1.5,0.3)
    (2,0)
};
\end{axis}
\end{tikzpicture}
\caption{Poligono di frequenza}
\end{SCfigure}
  • but for small ones there is a very little space for captions.

enter image description here

\begin{SCfigure}[][hp!]
\begin{tikzpicture}

\chemfig{
    -[:20]
        (-[:80]?-[:35,0.75]OH)
    -[:-20]
    -[:60,0.75]
    -[:160]
    ?-[:-160]
    =[:-120,0.75]
    }

\end{tikzpicture}
    \caption{il norbornen-7-olo presenta un centro stereogenico non chirale}
\end{SCfigure}

Why does this happen?

edit: As asked, a MWE

\documentclass[a5paper,]{book}

\usepackage[rightcaption,]{sidecap} 
\usepackage{tikz}
\usepackage{chemfig}

\begin{document}

\begin{SCfigure}[][hp!]
\begin{tikzpicture}

\chemfig{
    -[:20]
        (-[:80]?-[:35,0.75]OH)
    -[:-20]
    -[:60,0.75]
    -[:160]
    ?-[:-160]
    =[:-120,0.75]
    }

\end{tikzpicture}
    \caption{il norbornen-7-olo presenta un centro stereogenico non chirale}
\end{SCfigure}

\end{document}
gman
  • 1,807
Viridjan
  • 153

1 Answers1

2

You can control the space between figure and caption with \sidecaptionsep ...

\documentclass[a4paper]{article}

\usepackage{pgfplots}
\usepackage{sidecap}
\renewcommand\sidecaptionsep{2cm}
\usepackage[text={6in,9in},centering]{geometry}

\begin{document}

\begin{SCfigure}[][hp!]
\begin{tikzpicture}
\begin{axis}[axis lines=left,
        width = 70mm,
    %   height = 60mm,
        xmin = -2,
        xmax = 2.2,
        ymax=1.1,xtick=\empty,ytick=\empty
            ]
\addplot[const plot mark mid] coordinates { (-2,0) (-1.5,0.2) (-1,0.6) (-0.5,0.7) (0,0.95) (0.5,0.8) (1,0.4) (1.5,0.3) (2,0) };
\addplot[sharp plot] coordinates { (-2,0) (-1.5,0.2) (-1,0.6) (-0.5,0.7) (0,0.95) (0.5,0.8) (1,0.4) (1.5,0.3) (2,0) };
\end{axis}
\end{tikzpicture}
\caption{il norbornen-7-olo presenta un centro stereogenico non chirale}
\end{SCfigure}

\end{document}

enter image description here

juanuni
  • 1,987
  • ok, now i have more space between the image and the caption, but the problems persist: there is a dependence between the width of the figure and the width of the caption – Viridjan May 18 '15 at 16:28
  • You can control the space with tabular options ... – juanuni May 18 '15 at 16:38
  • I don't understand, i'm not using tabular environment here – Viridjan May 18 '15 at 17:31
  • Sorry, I confuse the links ... This say in sidecap package documentation for the first option of SCfigure environment: " caption width relative to the width of the figure or table. A large value (e.g., 50) reserves the maximum width that is possible. Default is 1.0" ... in your code the first option appears empty ... – juanuni May 18 '15 at 22:32
  • I've tried it, but it stretch the caption too much: I have the opposite effect and it's still ugly. I think I'll start to use flatrow – Viridjan May 19 '15 at 00:40