Discussion:
caption: adjusting margin and width with \captionsetup{}
(too old to reply)
John Bullock
2006-01-21 18:08:21 UTC
Permalink
Hello,

I am using the caption package. I would like to adjust both the left
margin and the width of individual captions. But \captionsetup{}, intended
for adjustments for individual captions, permits only adjustment of the margin
parameter or the width parameter -- not both.

Consider a brief example:

\usepackage[margin=1in]{caption}
[...]
\begin{figure}[t]
\includegraphics{elephant}
\captionsetup{width=3in}
\caption{CaptionText}
\end{figure}

This does what you might expect. But I want to do more: I want to indent the
caption by three inches, not one inch. Is there any way to do that on the
fly, without changing the \usepackage options or creating a separate caption
format?

Thank you,
--John
Ralf Stubner
2006-01-21 18:38:42 UTC
Permalink
Post by John Bullock
But \captionsetup{}, intended
for adjustments for individual captions, permits only adjustment of
the margin parameter or the width parameter -- not both.
Why? According to the manual \captionsetup{width=3in,margin=3in} should
work.

cheerio
ralf
John Bullock
2006-01-21 19:03:16 UTC
Permalink
Post by Ralf Stubner
According to the manual \captionsetup
{width=3in,margin=3in} should work.
Which manual? I'm looking at the 2005/10/23 version of the caption package.
Section 3.4, Page 8. E.g., "you can specify -either- an extra margin -or- a
fixed width" (emphasis in original).

The problem is that setting "margin=x" assigns x to both the left and right
margins. Which implies a width setting independent of any that a user enters
in \captionsetup{}.

Another way of putting my problem is: how may I independently assign the left
and right margins for a caption?

Thank you,
--John
Post by Ralf Stubner
Post by John Bullock
But \captionsetup{}, intended
for adjustments for individual captions, permits only adjustment of
the margin parameter or the width parameter -- not both.
Why? According to the manual \captionsetup{width=3in,margin=3in} should
work.
cheerio
ralf
Ralf Stubner
2006-01-21 20:54:19 UTC
Permalink
Post by John Bullock
The problem is that setting "margin=x" assigns x to both the left and right
margins. Which implies a width setting independent of any that a user enters
in \captionsetup{}.
Now I understand your problem. This is not directly related to
\captionsetup{} but a general property of caption.sty that captions are
centered.
Post by John Bullock
Another way of putting my problem is: how may I independently assign the left
and right margins for a caption?
You could try something like

\DeclareCaptionFormat{test}{\hspace{1in}\parbox{2in}{#1#2#3\par}}
[...]
\captionsetup{format=test}

but that's not really nice.

cheerio
ralf
Axel Sommerfeldt
2006-01-22 08:25:58 UTC
Permalink
Post by John Bullock
The problem is that setting "margin=x" assigns x to both the left and
right margins. Which implies a width setting independent of any that
a user enters in \captionsetup{}.
Yes, but since more and more users request for a more flexible possibility
for setting margin & width I'll build a solution for that in the next
months (or weeks).
Post by John Bullock
Another way of putting my problem is: how may I independently assign
the left and right margins for a caption?
\captionsetup{margin={<left>,<right>}}

for example

\captionsetup{margin={1in,2in}}

This is implemented since caption 3.0i which should be avail in the very
next days. (I uploaded it to CTAN yesterday.) This feature isn't documented
yet because this does not take care of twoside layouts yet.

HTH,
Axel
John Bullock
2006-01-22 09:21:51 UTC
Permalink
Fantastic news -- thank you!

--John
Post by Axel Sommerfeldt
Post by John Bullock
The problem is that setting "margin=x" assigns x to both the left and
right margins. Which implies a width setting independent of any that
a user enters in \captionsetup{}.
Yes, but since more and more users request for a more flexible possibility
for setting margin & width I'll build a solution for that in the next
months (or weeks).
Post by John Bullock
Another way of putting my problem is: how may I independently assign
the left and right margins for a caption?
\captionsetup{margin={<left>,<right>}}
for example
\captionsetup{margin={1in,2in}}
This is implemented since caption 3.0i which should be avail in the very
next days. (I uploaded it to CTAN yesterday.) This feature isn't documented
yet because this does not take care of twoside layouts yet.
HTH,
Axel
Axel Sommerfeldt
2006-01-26 09:26:21 UTC
Permalink
Post by John Bullock
Post by Axel Sommerfeldt
Post by John Bullock
The problem is that setting "margin=x" assigns x to both the left
and right margins. Which implies a width setting independent of any
that a user enters in \captionsetup{}.
Yes, but since more and more users request for a more flexible
possibility for setting margin & width I'll build a solution for that
in the next months (or weeks).
Post by John Bullock
Another way of putting my problem is: how may I independently assign
the left and right margins for a caption?
\captionsetup{margin={<left>,<right>}}
for example
\captionsetup{margin={1in,2in}}
This is implemented since caption 3.0i which should be avail in the
very next days. (I uploaded it to CTAN yesterday.) This feature isn't
documented yet because this does not take care of twoside layouts
yet.
Fantastic news -- thank you!
The version 3.0i of the caption package is avail at CTAN since Sunday. At
http://www.sommerfee.de you'll find a test version 3.0j now where you can
set a margin *and* a width, if you like to, for example:

\captionsetup{margin=0in,width=4in}

Since setting both, margin and width, can only be done within a single
\captionsetup call this should be compatible to the old stuff. So for
example

\captionsetup{margin=0pt} \captionsetup{width=4in}

should behave exactly as before, means: The 2nd \captionsetup overrides
the margin set by the 1st \captionsetup call.

I hope this works well, otherwise please send me an e-mail to caption(at)
sommerfee.de.

Axel

Loading...