Force figure placement in text
I have a problem when a lot of figures are in question. Some figures tend to "fly around", that is, be a paragraph below, although I placed them before that paragraph. I use code:
begin{figure}[ht]
begin{center}
advanceleftskip-3cm
advancerightskip-3cm
includegraphics[keepaspectratio=true,scale=0.6]{slike/visina8}
caption{}
label{visina8}
end{center}end{figure}
to place my figures. How can I tell latex I REALLY want the figure in that specific place, no matter how much whitespace will be left?
floats positioning captions
add a comment |
I have a problem when a lot of figures are in question. Some figures tend to "fly around", that is, be a paragraph below, although I placed them before that paragraph. I use code:
begin{figure}[ht]
begin{center}
advanceleftskip-3cm
advancerightskip-3cm
includegraphics[keepaspectratio=true,scale=0.6]{slike/visina8}
caption{}
label{visina8}
end{center}end{figure}
to place my figures. How can I tell latex I REALLY want the figure in that specific place, no matter how much whitespace will be left?
floats positioning captions
Sidenote: Don't use thecenter
environment but thecentering
command for figures. See Should I use center or centering for figures and tables?
– Martin Scharrer♦
6 hours ago
add a comment |
I have a problem when a lot of figures are in question. Some figures tend to "fly around", that is, be a paragraph below, although I placed them before that paragraph. I use code:
begin{figure}[ht]
begin{center}
advanceleftskip-3cm
advancerightskip-3cm
includegraphics[keepaspectratio=true,scale=0.6]{slike/visina8}
caption{}
label{visina8}
end{center}end{figure}
to place my figures. How can I tell latex I REALLY want the figure in that specific place, no matter how much whitespace will be left?
floats positioning captions
I have a problem when a lot of figures are in question. Some figures tend to "fly around", that is, be a paragraph below, although I placed them before that paragraph. I use code:
begin{figure}[ht]
begin{center}
advanceleftskip-3cm
advancerightskip-3cm
includegraphics[keepaspectratio=true,scale=0.6]{slike/visina8}
caption{}
label{visina8}
end{center}end{figure}
to place my figures. How can I tell latex I REALLY want the figure in that specific place, no matter how much whitespace will be left?
floats positioning captions
floats positioning captions
edited 6 hours ago
Martin Scharrer♦
199k45633816
199k45633816
asked Jan 10 '11 at 10:54
MarinMarin
2,67461920
2,67461920
Sidenote: Don't use thecenter
environment but thecentering
command for figures. See Should I use center or centering for figures and tables?
– Martin Scharrer♦
6 hours ago
add a comment |
Sidenote: Don't use thecenter
environment but thecentering
command for figures. See Should I use center or centering for figures and tables?
– Martin Scharrer♦
6 hours ago
Sidenote: Don't use the
center
environment but the centering
command for figures. See Should I use center or centering for figures and tables?– Martin Scharrer♦
6 hours ago
Sidenote: Don't use the
center
environment but the centering
command for figures. See Should I use center or centering for figures and tables?– Martin Scharrer♦
6 hours ago
add a comment |
3 Answers
3
active
oldest
votes
The short answer: use the “float” package and then the [H]
option for your figure.
usepackage{float}
...
begin{figure}[H]
centering
includegraphics{slike/visina8}
caption{Write some caption here}label{visina8}
end{figure}
The longer answer: The default behaviour of figures is to float, so that LaTeX can find the best way to arrange them in your document and make it look better. If you have a look, this is how books are often typeset. So, usually the best thing to do is just to let LaTeX do its work and don't try to force the placement of figures at specific locations. This also means that you should avoid using phrases such as “in the following figure:
”, which requires the figure to be set a specific location, and use “in Figure~ref{..}
“ instead, taking advantage of LaTeX's cross-references.
If for some reason you really want some particular figure to be placed “HERE”, and not where LaTeX wants to put it, then use the [H]
option of the “float” package which basically turns the floating figure into a regular non-float.
Also note that, if you don't want to add a caption
to your figure, then you don't need to use the figure
environment at all! You can use the includegraphics
command anywhere in your document to insert an image.
12
thanks for noting this! I wasn't aware of the change.H
doesn't seem to work without any packages, but does work loadingfloat
. IsH
fromfloat
the same as!h
?
– Juan A. Navarro
Jan 10 '11 at 12:12
15
no, [!h] is changed anyway by most documentclasses to [!ht]. And the meaning of h is only: here, if possible, but not absolutely here. The ! allows LaTeX to minimze all counters and lengths which refer to floating environments.
– Herbert
Jan 10 '11 at 12:18
5
thanks, worked for me! I usually let latex place it where it wants, but sometimes i simply need it where I want.
– Marin
Jan 11 '11 at 17:16
8
For documents not intended to be printed, there is no reason to try and save paper, so large areas of whitespace aren't a problem. So it's much better to have the figure breaking the text at the most logical point, rather than floating somewhere else. These awkward conventions will go just like Latin went.
– Evgeni Sergeev
Jul 12 '13 at 13:17
18
I don't think that the usual concerns are about saving space, rather than stylistically trying to find the best place where to place a figure, table, etc.
– Juan A. Navarro
Jul 12 '13 at 19:52
|
show 5 more comments
do not use a floating environment if you do not want it float.
usepackage{caption}
...
noindent%
begin{minipage}{linewidth}% to keep image and caption on one page
makebox[linewidth]{% to center the image
includegraphics[keepaspectratio=true,scale=0.6]{slike/visina8}}
captionof{figure}{...}label{visina8}% only if needed
end{minipage}
or
begin{center}
includegraphics[...]{slike/visina8}}
captionof{figure}{...}label{visina8}% only if needed
end{center}
13
Hi @Herbert - thanks a LOT for this answer! I had never before understood thatbegin{figure}
is a floating environment - whilebegin{minipage}
is not! I had a problem with wanting to include an image on bottom of page w/ text, and not even[H]
helped; only this! I just replacedminipage
forfigure
- andcaptionof
forcaption
- and finally got what I wanted!! Thanks a lot again, cheers!
– sdaau
Jan 27 '11 at 12:26
2
Why do you use amakebox
? Doesn’t it look the same without it?
– Tobi
Dec 7 '12 at 12:28
6
@Tobi: if the image is not larger thantextwidth
yes, otherwise not!makebox
centers the image independently from its width
– Herbert
Dec 7 '12 at 12:46
3
This was so super helpful; IMHO this should be the accepted answer as it works more as expected as the currently accepted one.
– user2820379
Jul 6 '14 at 17:31
add a comment |
You can now use the adjustbox
package to turn your boxed stuff into a non-floating float replacement using the nofloat=<type>
key. Caption and label can be added by own keys, before the nofloat
. For centering the center
key can be used. To add the vertical space use the vspace
key. This solution has the benefit, that you can also use all the many other features of adjustbox
to modify the content (min/max scaling, framing, etc.)
Note that if the figure content is just a single image you can just use the same keys on adjustbox
and get a one-liner. If all you want is a tabular then there is the tabular
key for {adjustbox}
.
If you later want to change it to a real float just turn nofloat
to float
and remove the vspace
key. adjustbox
places the caption on top for table
s and on bottom for figure
s. This can be changed by using the keys captionbelow
or captionabove
instead of caption
.
See the adjustox
manual for all options.
documentclass{article}
usepackage{blindtext}% for example text here only
usepackage{adjustbox}
begin{document}
blindtext
begin{adjustbox}{center,caption={some caption},label={somelabel},nofloat=figure,vspace=bigskipamount}
% maybe other stuff
includegraphics[width=textwidth]{example-image}% example only, could also be adjustimage
% maybe other stuff
end{adjustbox}
blindtext
% For simple images, a one liner is enough
adjustimage{width=textwidth,center,caption={some caption},label={somelabel},nofloat=figure,vspace=bigskipamount}{example-image}
blindtext
begin{adjustbox}{center,caption={some caption},label={somelabel},nofloat=table,vspace=bigskipamount}
% maybe other stuff
begin{tabular}{lll}
some & tabular & is\
also & possible & with this \
end{tabular}
% maybe other stuff
end{adjustbox}
blindtext
% For just a tabular:
begin{adjustbox}{tabular=lll,center,caption={some caption},label={somelabel},nofloat=table,vspace=bigskipamount}
some & tabular & is\
also & possible & with this \
end{adjustbox}
blindtext
end{document}
Part of the result:
add a comment |
protected by Martin Scharrer♦ Mar 27 '14 at 13:41
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
The short answer: use the “float” package and then the [H]
option for your figure.
usepackage{float}
...
begin{figure}[H]
centering
includegraphics{slike/visina8}
caption{Write some caption here}label{visina8}
end{figure}
The longer answer: The default behaviour of figures is to float, so that LaTeX can find the best way to arrange them in your document and make it look better. If you have a look, this is how books are often typeset. So, usually the best thing to do is just to let LaTeX do its work and don't try to force the placement of figures at specific locations. This also means that you should avoid using phrases such as “in the following figure:
”, which requires the figure to be set a specific location, and use “in Figure~ref{..}
“ instead, taking advantage of LaTeX's cross-references.
If for some reason you really want some particular figure to be placed “HERE”, and not where LaTeX wants to put it, then use the [H]
option of the “float” package which basically turns the floating figure into a regular non-float.
Also note that, if you don't want to add a caption
to your figure, then you don't need to use the figure
environment at all! You can use the includegraphics
command anywhere in your document to insert an image.
12
thanks for noting this! I wasn't aware of the change.H
doesn't seem to work without any packages, but does work loadingfloat
. IsH
fromfloat
the same as!h
?
– Juan A. Navarro
Jan 10 '11 at 12:12
15
no, [!h] is changed anyway by most documentclasses to [!ht]. And the meaning of h is only: here, if possible, but not absolutely here. The ! allows LaTeX to minimze all counters and lengths which refer to floating environments.
– Herbert
Jan 10 '11 at 12:18
5
thanks, worked for me! I usually let latex place it where it wants, but sometimes i simply need it where I want.
– Marin
Jan 11 '11 at 17:16
8
For documents not intended to be printed, there is no reason to try and save paper, so large areas of whitespace aren't a problem. So it's much better to have the figure breaking the text at the most logical point, rather than floating somewhere else. These awkward conventions will go just like Latin went.
– Evgeni Sergeev
Jul 12 '13 at 13:17
18
I don't think that the usual concerns are about saving space, rather than stylistically trying to find the best place where to place a figure, table, etc.
– Juan A. Navarro
Jul 12 '13 at 19:52
|
show 5 more comments
The short answer: use the “float” package and then the [H]
option for your figure.
usepackage{float}
...
begin{figure}[H]
centering
includegraphics{slike/visina8}
caption{Write some caption here}label{visina8}
end{figure}
The longer answer: The default behaviour of figures is to float, so that LaTeX can find the best way to arrange them in your document and make it look better. If you have a look, this is how books are often typeset. So, usually the best thing to do is just to let LaTeX do its work and don't try to force the placement of figures at specific locations. This also means that you should avoid using phrases such as “in the following figure:
”, which requires the figure to be set a specific location, and use “in Figure~ref{..}
“ instead, taking advantage of LaTeX's cross-references.
If for some reason you really want some particular figure to be placed “HERE”, and not where LaTeX wants to put it, then use the [H]
option of the “float” package which basically turns the floating figure into a regular non-float.
Also note that, if you don't want to add a caption
to your figure, then you don't need to use the figure
environment at all! You can use the includegraphics
command anywhere in your document to insert an image.
12
thanks for noting this! I wasn't aware of the change.H
doesn't seem to work without any packages, but does work loadingfloat
. IsH
fromfloat
the same as!h
?
– Juan A. Navarro
Jan 10 '11 at 12:12
15
no, [!h] is changed anyway by most documentclasses to [!ht]. And the meaning of h is only: here, if possible, but not absolutely here. The ! allows LaTeX to minimze all counters and lengths which refer to floating environments.
– Herbert
Jan 10 '11 at 12:18
5
thanks, worked for me! I usually let latex place it where it wants, but sometimes i simply need it where I want.
– Marin
Jan 11 '11 at 17:16
8
For documents not intended to be printed, there is no reason to try and save paper, so large areas of whitespace aren't a problem. So it's much better to have the figure breaking the text at the most logical point, rather than floating somewhere else. These awkward conventions will go just like Latin went.
– Evgeni Sergeev
Jul 12 '13 at 13:17
18
I don't think that the usual concerns are about saving space, rather than stylistically trying to find the best place where to place a figure, table, etc.
– Juan A. Navarro
Jul 12 '13 at 19:52
|
show 5 more comments
The short answer: use the “float” package and then the [H]
option for your figure.
usepackage{float}
...
begin{figure}[H]
centering
includegraphics{slike/visina8}
caption{Write some caption here}label{visina8}
end{figure}
The longer answer: The default behaviour of figures is to float, so that LaTeX can find the best way to arrange them in your document and make it look better. If you have a look, this is how books are often typeset. So, usually the best thing to do is just to let LaTeX do its work and don't try to force the placement of figures at specific locations. This also means that you should avoid using phrases such as “in the following figure:
”, which requires the figure to be set a specific location, and use “in Figure~ref{..}
“ instead, taking advantage of LaTeX's cross-references.
If for some reason you really want some particular figure to be placed “HERE”, and not where LaTeX wants to put it, then use the [H]
option of the “float” package which basically turns the floating figure into a regular non-float.
Also note that, if you don't want to add a caption
to your figure, then you don't need to use the figure
environment at all! You can use the includegraphics
command anywhere in your document to insert an image.
The short answer: use the “float” package and then the [H]
option for your figure.
usepackage{float}
...
begin{figure}[H]
centering
includegraphics{slike/visina8}
caption{Write some caption here}label{visina8}
end{figure}
The longer answer: The default behaviour of figures is to float, so that LaTeX can find the best way to arrange them in your document and make it look better. If you have a look, this is how books are often typeset. So, usually the best thing to do is just to let LaTeX do its work and don't try to force the placement of figures at specific locations. This also means that you should avoid using phrases such as “in the following figure:
”, which requires the figure to be set a specific location, and use “in Figure~ref{..}
“ instead, taking advantage of LaTeX's cross-references.
If for some reason you really want some particular figure to be placed “HERE”, and not where LaTeX wants to put it, then use the [H]
option of the “float” package which basically turns the floating figure into a regular non-float.
Also note that, if you don't want to add a caption
to your figure, then you don't need to use the figure
environment at all! You can use the includegraphics
command anywhere in your document to insert an image.
edited Jan 10 '11 at 12:14
answered Jan 10 '11 at 12:01
Juan A. NavarroJuan A. Navarro
35.7k27114160
35.7k27114160
12
thanks for noting this! I wasn't aware of the change.H
doesn't seem to work without any packages, but does work loadingfloat
. IsH
fromfloat
the same as!h
?
– Juan A. Navarro
Jan 10 '11 at 12:12
15
no, [!h] is changed anyway by most documentclasses to [!ht]. And the meaning of h is only: here, if possible, but not absolutely here. The ! allows LaTeX to minimze all counters and lengths which refer to floating environments.
– Herbert
Jan 10 '11 at 12:18
5
thanks, worked for me! I usually let latex place it where it wants, but sometimes i simply need it where I want.
– Marin
Jan 11 '11 at 17:16
8
For documents not intended to be printed, there is no reason to try and save paper, so large areas of whitespace aren't a problem. So it's much better to have the figure breaking the text at the most logical point, rather than floating somewhere else. These awkward conventions will go just like Latin went.
– Evgeni Sergeev
Jul 12 '13 at 13:17
18
I don't think that the usual concerns are about saving space, rather than stylistically trying to find the best place where to place a figure, table, etc.
– Juan A. Navarro
Jul 12 '13 at 19:52
|
show 5 more comments
12
thanks for noting this! I wasn't aware of the change.H
doesn't seem to work without any packages, but does work loadingfloat
. IsH
fromfloat
the same as!h
?
– Juan A. Navarro
Jan 10 '11 at 12:12
15
no, [!h] is changed anyway by most documentclasses to [!ht]. And the meaning of h is only: here, if possible, but not absolutely here. The ! allows LaTeX to minimze all counters and lengths which refer to floating environments.
– Herbert
Jan 10 '11 at 12:18
5
thanks, worked for me! I usually let latex place it where it wants, but sometimes i simply need it where I want.
– Marin
Jan 11 '11 at 17:16
8
For documents not intended to be printed, there is no reason to try and save paper, so large areas of whitespace aren't a problem. So it's much better to have the figure breaking the text at the most logical point, rather than floating somewhere else. These awkward conventions will go just like Latin went.
– Evgeni Sergeev
Jul 12 '13 at 13:17
18
I don't think that the usual concerns are about saving space, rather than stylistically trying to find the best place where to place a figure, table, etc.
– Juan A. Navarro
Jul 12 '13 at 19:52
12
12
thanks for noting this! I wasn't aware of the change.
H
doesn't seem to work without any packages, but does work loading float
. Is H
from float
the same as !h
?– Juan A. Navarro
Jan 10 '11 at 12:12
thanks for noting this! I wasn't aware of the change.
H
doesn't seem to work without any packages, but does work loading float
. Is H
from float
the same as !h
?– Juan A. Navarro
Jan 10 '11 at 12:12
15
15
no, [!h] is changed anyway by most documentclasses to [!ht]. And the meaning of h is only: here, if possible, but not absolutely here. The ! allows LaTeX to minimze all counters and lengths which refer to floating environments.
– Herbert
Jan 10 '11 at 12:18
no, [!h] is changed anyway by most documentclasses to [!ht]. And the meaning of h is only: here, if possible, but not absolutely here. The ! allows LaTeX to minimze all counters and lengths which refer to floating environments.
– Herbert
Jan 10 '11 at 12:18
5
5
thanks, worked for me! I usually let latex place it where it wants, but sometimes i simply need it where I want.
– Marin
Jan 11 '11 at 17:16
thanks, worked for me! I usually let latex place it where it wants, but sometimes i simply need it where I want.
– Marin
Jan 11 '11 at 17:16
8
8
For documents not intended to be printed, there is no reason to try and save paper, so large areas of whitespace aren't a problem. So it's much better to have the figure breaking the text at the most logical point, rather than floating somewhere else. These awkward conventions will go just like Latin went.
– Evgeni Sergeev
Jul 12 '13 at 13:17
For documents not intended to be printed, there is no reason to try and save paper, so large areas of whitespace aren't a problem. So it's much better to have the figure breaking the text at the most logical point, rather than floating somewhere else. These awkward conventions will go just like Latin went.
– Evgeni Sergeev
Jul 12 '13 at 13:17
18
18
I don't think that the usual concerns are about saving space, rather than stylistically trying to find the best place where to place a figure, table, etc.
– Juan A. Navarro
Jul 12 '13 at 19:52
I don't think that the usual concerns are about saving space, rather than stylistically trying to find the best place where to place a figure, table, etc.
– Juan A. Navarro
Jul 12 '13 at 19:52
|
show 5 more comments
do not use a floating environment if you do not want it float.
usepackage{caption}
...
noindent%
begin{minipage}{linewidth}% to keep image and caption on one page
makebox[linewidth]{% to center the image
includegraphics[keepaspectratio=true,scale=0.6]{slike/visina8}}
captionof{figure}{...}label{visina8}% only if needed
end{minipage}
or
begin{center}
includegraphics[...]{slike/visina8}}
captionof{figure}{...}label{visina8}% only if needed
end{center}
13
Hi @Herbert - thanks a LOT for this answer! I had never before understood thatbegin{figure}
is a floating environment - whilebegin{minipage}
is not! I had a problem with wanting to include an image on bottom of page w/ text, and not even[H]
helped; only this! I just replacedminipage
forfigure
- andcaptionof
forcaption
- and finally got what I wanted!! Thanks a lot again, cheers!
– sdaau
Jan 27 '11 at 12:26
2
Why do you use amakebox
? Doesn’t it look the same without it?
– Tobi
Dec 7 '12 at 12:28
6
@Tobi: if the image is not larger thantextwidth
yes, otherwise not!makebox
centers the image independently from its width
– Herbert
Dec 7 '12 at 12:46
3
This was so super helpful; IMHO this should be the accepted answer as it works more as expected as the currently accepted one.
– user2820379
Jul 6 '14 at 17:31
add a comment |
do not use a floating environment if you do not want it float.
usepackage{caption}
...
noindent%
begin{minipage}{linewidth}% to keep image and caption on one page
makebox[linewidth]{% to center the image
includegraphics[keepaspectratio=true,scale=0.6]{slike/visina8}}
captionof{figure}{...}label{visina8}% only if needed
end{minipage}
or
begin{center}
includegraphics[...]{slike/visina8}}
captionof{figure}{...}label{visina8}% only if needed
end{center}
13
Hi @Herbert - thanks a LOT for this answer! I had never before understood thatbegin{figure}
is a floating environment - whilebegin{minipage}
is not! I had a problem with wanting to include an image on bottom of page w/ text, and not even[H]
helped; only this! I just replacedminipage
forfigure
- andcaptionof
forcaption
- and finally got what I wanted!! Thanks a lot again, cheers!
– sdaau
Jan 27 '11 at 12:26
2
Why do you use amakebox
? Doesn’t it look the same without it?
– Tobi
Dec 7 '12 at 12:28
6
@Tobi: if the image is not larger thantextwidth
yes, otherwise not!makebox
centers the image independently from its width
– Herbert
Dec 7 '12 at 12:46
3
This was so super helpful; IMHO this should be the accepted answer as it works more as expected as the currently accepted one.
– user2820379
Jul 6 '14 at 17:31
add a comment |
do not use a floating environment if you do not want it float.
usepackage{caption}
...
noindent%
begin{minipage}{linewidth}% to keep image and caption on one page
makebox[linewidth]{% to center the image
includegraphics[keepaspectratio=true,scale=0.6]{slike/visina8}}
captionof{figure}{...}label{visina8}% only if needed
end{minipage}
or
begin{center}
includegraphics[...]{slike/visina8}}
captionof{figure}{...}label{visina8}% only if needed
end{center}
do not use a floating environment if you do not want it float.
usepackage{caption}
...
noindent%
begin{minipage}{linewidth}% to keep image and caption on one page
makebox[linewidth]{% to center the image
includegraphics[keepaspectratio=true,scale=0.6]{slike/visina8}}
captionof{figure}{...}label{visina8}% only if needed
end{minipage}
or
begin{center}
includegraphics[...]{slike/visina8}}
captionof{figure}{...}label{visina8}% only if needed
end{center}
edited Jan 20 '16 at 12:30
answered Jan 10 '11 at 11:57
HerbertHerbert
270k24408717
270k24408717
13
Hi @Herbert - thanks a LOT for this answer! I had never before understood thatbegin{figure}
is a floating environment - whilebegin{minipage}
is not! I had a problem with wanting to include an image on bottom of page w/ text, and not even[H]
helped; only this! I just replacedminipage
forfigure
- andcaptionof
forcaption
- and finally got what I wanted!! Thanks a lot again, cheers!
– sdaau
Jan 27 '11 at 12:26
2
Why do you use amakebox
? Doesn’t it look the same without it?
– Tobi
Dec 7 '12 at 12:28
6
@Tobi: if the image is not larger thantextwidth
yes, otherwise not!makebox
centers the image independently from its width
– Herbert
Dec 7 '12 at 12:46
3
This was so super helpful; IMHO this should be the accepted answer as it works more as expected as the currently accepted one.
– user2820379
Jul 6 '14 at 17:31
add a comment |
13
Hi @Herbert - thanks a LOT for this answer! I had never before understood thatbegin{figure}
is a floating environment - whilebegin{minipage}
is not! I had a problem with wanting to include an image on bottom of page w/ text, and not even[H]
helped; only this! I just replacedminipage
forfigure
- andcaptionof
forcaption
- and finally got what I wanted!! Thanks a lot again, cheers!
– sdaau
Jan 27 '11 at 12:26
2
Why do you use amakebox
? Doesn’t it look the same without it?
– Tobi
Dec 7 '12 at 12:28
6
@Tobi: if the image is not larger thantextwidth
yes, otherwise not!makebox
centers the image independently from its width
– Herbert
Dec 7 '12 at 12:46
3
This was so super helpful; IMHO this should be the accepted answer as it works more as expected as the currently accepted one.
– user2820379
Jul 6 '14 at 17:31
13
13
Hi @Herbert - thanks a LOT for this answer! I had never before understood that
begin{figure}
is a floating environment - while begin{minipage}
is not! I had a problem with wanting to include an image on bottom of page w/ text, and not even [H]
helped; only this! I just replaced minipage
for figure
- and captionof
for caption
- and finally got what I wanted!! Thanks a lot again, cheers!– sdaau
Jan 27 '11 at 12:26
Hi @Herbert - thanks a LOT for this answer! I had never before understood that
begin{figure}
is a floating environment - while begin{minipage}
is not! I had a problem with wanting to include an image on bottom of page w/ text, and not even [H]
helped; only this! I just replaced minipage
for figure
- and captionof
for caption
- and finally got what I wanted!! Thanks a lot again, cheers!– sdaau
Jan 27 '11 at 12:26
2
2
Why do you use a
makebox
? Doesn’t it look the same without it?– Tobi
Dec 7 '12 at 12:28
Why do you use a
makebox
? Doesn’t it look the same without it?– Tobi
Dec 7 '12 at 12:28
6
6
@Tobi: if the image is not larger than
textwidth
yes, otherwise not! makebox
centers the image independently from its width– Herbert
Dec 7 '12 at 12:46
@Tobi: if the image is not larger than
textwidth
yes, otherwise not! makebox
centers the image independently from its width– Herbert
Dec 7 '12 at 12:46
3
3
This was so super helpful; IMHO this should be the accepted answer as it works more as expected as the currently accepted one.
– user2820379
Jul 6 '14 at 17:31
This was so super helpful; IMHO this should be the accepted answer as it works more as expected as the currently accepted one.
– user2820379
Jul 6 '14 at 17:31
add a comment |
You can now use the adjustbox
package to turn your boxed stuff into a non-floating float replacement using the nofloat=<type>
key. Caption and label can be added by own keys, before the nofloat
. For centering the center
key can be used. To add the vertical space use the vspace
key. This solution has the benefit, that you can also use all the many other features of adjustbox
to modify the content (min/max scaling, framing, etc.)
Note that if the figure content is just a single image you can just use the same keys on adjustbox
and get a one-liner. If all you want is a tabular then there is the tabular
key for {adjustbox}
.
If you later want to change it to a real float just turn nofloat
to float
and remove the vspace
key. adjustbox
places the caption on top for table
s and on bottom for figure
s. This can be changed by using the keys captionbelow
or captionabove
instead of caption
.
See the adjustox
manual for all options.
documentclass{article}
usepackage{blindtext}% for example text here only
usepackage{adjustbox}
begin{document}
blindtext
begin{adjustbox}{center,caption={some caption},label={somelabel},nofloat=figure,vspace=bigskipamount}
% maybe other stuff
includegraphics[width=textwidth]{example-image}% example only, could also be adjustimage
% maybe other stuff
end{adjustbox}
blindtext
% For simple images, a one liner is enough
adjustimage{width=textwidth,center,caption={some caption},label={somelabel},nofloat=figure,vspace=bigskipamount}{example-image}
blindtext
begin{adjustbox}{center,caption={some caption},label={somelabel},nofloat=table,vspace=bigskipamount}
% maybe other stuff
begin{tabular}{lll}
some & tabular & is\
also & possible & with this \
end{tabular}
% maybe other stuff
end{adjustbox}
blindtext
% For just a tabular:
begin{adjustbox}{tabular=lll,center,caption={some caption},label={somelabel},nofloat=table,vspace=bigskipamount}
some & tabular & is\
also & possible & with this \
end{adjustbox}
blindtext
end{document}
Part of the result:
add a comment |
You can now use the adjustbox
package to turn your boxed stuff into a non-floating float replacement using the nofloat=<type>
key. Caption and label can be added by own keys, before the nofloat
. For centering the center
key can be used. To add the vertical space use the vspace
key. This solution has the benefit, that you can also use all the many other features of adjustbox
to modify the content (min/max scaling, framing, etc.)
Note that if the figure content is just a single image you can just use the same keys on adjustbox
and get a one-liner. If all you want is a tabular then there is the tabular
key for {adjustbox}
.
If you later want to change it to a real float just turn nofloat
to float
and remove the vspace
key. adjustbox
places the caption on top for table
s and on bottom for figure
s. This can be changed by using the keys captionbelow
or captionabove
instead of caption
.
See the adjustox
manual for all options.
documentclass{article}
usepackage{blindtext}% for example text here only
usepackage{adjustbox}
begin{document}
blindtext
begin{adjustbox}{center,caption={some caption},label={somelabel},nofloat=figure,vspace=bigskipamount}
% maybe other stuff
includegraphics[width=textwidth]{example-image}% example only, could also be adjustimage
% maybe other stuff
end{adjustbox}
blindtext
% For simple images, a one liner is enough
adjustimage{width=textwidth,center,caption={some caption},label={somelabel},nofloat=figure,vspace=bigskipamount}{example-image}
blindtext
begin{adjustbox}{center,caption={some caption},label={somelabel},nofloat=table,vspace=bigskipamount}
% maybe other stuff
begin{tabular}{lll}
some & tabular & is\
also & possible & with this \
end{tabular}
% maybe other stuff
end{adjustbox}
blindtext
% For just a tabular:
begin{adjustbox}{tabular=lll,center,caption={some caption},label={somelabel},nofloat=table,vspace=bigskipamount}
some & tabular & is\
also & possible & with this \
end{adjustbox}
blindtext
end{document}
Part of the result:
add a comment |
You can now use the adjustbox
package to turn your boxed stuff into a non-floating float replacement using the nofloat=<type>
key. Caption and label can be added by own keys, before the nofloat
. For centering the center
key can be used. To add the vertical space use the vspace
key. This solution has the benefit, that you can also use all the many other features of adjustbox
to modify the content (min/max scaling, framing, etc.)
Note that if the figure content is just a single image you can just use the same keys on adjustbox
and get a one-liner. If all you want is a tabular then there is the tabular
key for {adjustbox}
.
If you later want to change it to a real float just turn nofloat
to float
and remove the vspace
key. adjustbox
places the caption on top for table
s and on bottom for figure
s. This can be changed by using the keys captionbelow
or captionabove
instead of caption
.
See the adjustox
manual for all options.
documentclass{article}
usepackage{blindtext}% for example text here only
usepackage{adjustbox}
begin{document}
blindtext
begin{adjustbox}{center,caption={some caption},label={somelabel},nofloat=figure,vspace=bigskipamount}
% maybe other stuff
includegraphics[width=textwidth]{example-image}% example only, could also be adjustimage
% maybe other stuff
end{adjustbox}
blindtext
% For simple images, a one liner is enough
adjustimage{width=textwidth,center,caption={some caption},label={somelabel},nofloat=figure,vspace=bigskipamount}{example-image}
blindtext
begin{adjustbox}{center,caption={some caption},label={somelabel},nofloat=table,vspace=bigskipamount}
% maybe other stuff
begin{tabular}{lll}
some & tabular & is\
also & possible & with this \
end{tabular}
% maybe other stuff
end{adjustbox}
blindtext
% For just a tabular:
begin{adjustbox}{tabular=lll,center,caption={some caption},label={somelabel},nofloat=table,vspace=bigskipamount}
some & tabular & is\
also & possible & with this \
end{adjustbox}
blindtext
end{document}
Part of the result:
You can now use the adjustbox
package to turn your boxed stuff into a non-floating float replacement using the nofloat=<type>
key. Caption and label can be added by own keys, before the nofloat
. For centering the center
key can be used. To add the vertical space use the vspace
key. This solution has the benefit, that you can also use all the many other features of adjustbox
to modify the content (min/max scaling, framing, etc.)
Note that if the figure content is just a single image you can just use the same keys on adjustbox
and get a one-liner. If all you want is a tabular then there is the tabular
key for {adjustbox}
.
If you later want to change it to a real float just turn nofloat
to float
and remove the vspace
key. adjustbox
places the caption on top for table
s and on bottom for figure
s. This can be changed by using the keys captionbelow
or captionabove
instead of caption
.
See the adjustox
manual for all options.
documentclass{article}
usepackage{blindtext}% for example text here only
usepackage{adjustbox}
begin{document}
blindtext
begin{adjustbox}{center,caption={some caption},label={somelabel},nofloat=figure,vspace=bigskipamount}
% maybe other stuff
includegraphics[width=textwidth]{example-image}% example only, could also be adjustimage
% maybe other stuff
end{adjustbox}
blindtext
% For simple images, a one liner is enough
adjustimage{width=textwidth,center,caption={some caption},label={somelabel},nofloat=figure,vspace=bigskipamount}{example-image}
blindtext
begin{adjustbox}{center,caption={some caption},label={somelabel},nofloat=table,vspace=bigskipamount}
% maybe other stuff
begin{tabular}{lll}
some & tabular & is\
also & possible & with this \
end{tabular}
% maybe other stuff
end{adjustbox}
blindtext
% For just a tabular:
begin{adjustbox}{tabular=lll,center,caption={some caption},label={somelabel},nofloat=table,vspace=bigskipamount}
some & tabular & is\
also & possible & with this \
end{adjustbox}
blindtext
end{document}
Part of the result:
answered 6 hours ago
Martin Scharrer♦Martin Scharrer
199k45633816
199k45633816
add a comment |
add a comment |
protected by Martin Scharrer♦ Mar 27 '14 at 13:41
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
Sidenote: Don't use the
center
environment but thecentering
command for figures. See Should I use center or centering for figures and tables?– Martin Scharrer♦
6 hours ago