Vertical align (top) graphic and top of text-line
Clash Royale CLAN TAG#URR8PPP
up vote
4
down vote
favorite
I want to align the top of an image, and the top of a line of text. Below is a MWE with the current setup (using a placeholder "graphic" but the effect seems the same) and the desired behavior.
documentclassarticle
usepackagegraphicx
begindocument
beginminipage[t]0.5textwidth
%includegraphics[height=0.4in]theimage.png
rule0.95textwidth0.5in
endminipage%
beginminipage[t]0.5textwidth
sometext to fill the line
endminipage
enddocument
MWE behavior:
Desired behavior:
vertical-alignment minipage
add a comment |Â
up vote
4
down vote
favorite
I want to align the top of an image, and the top of a line of text. Below is a MWE with the current setup (using a placeholder "graphic" but the effect seems the same) and the desired behavior.
documentclassarticle
usepackagegraphicx
begindocument
beginminipage[t]0.5textwidth
%includegraphics[height=0.4in]theimage.png
rule0.95textwidth0.5in
endminipage%
beginminipage[t]0.5textwidth
sometext to fill the line
endminipage
enddocument
MWE behavior:
Desired behavior:
vertical-alignment minipage
Welcome to TeX.SE! Please have a look at this post.
â marmot
Aug 22 at 4:00
Isn't this what you want? tex.stackexchange.com/questions/29143/â¦
â Oleg Lobachev
Aug 22 at 12:45
thanks to both of you, I was having trouble locating these resources by searches. Should have searched harder I guess.
â amoodie
Aug 22 at 13:56
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
I want to align the top of an image, and the top of a line of text. Below is a MWE with the current setup (using a placeholder "graphic" but the effect seems the same) and the desired behavior.
documentclassarticle
usepackagegraphicx
begindocument
beginminipage[t]0.5textwidth
%includegraphics[height=0.4in]theimage.png
rule0.95textwidth0.5in
endminipage%
beginminipage[t]0.5textwidth
sometext to fill the line
endminipage
enddocument
MWE behavior:
Desired behavior:
vertical-alignment minipage
I want to align the top of an image, and the top of a line of text. Below is a MWE with the current setup (using a placeholder "graphic" but the effect seems the same) and the desired behavior.
documentclassarticle
usepackagegraphicx
begindocument
beginminipage[t]0.5textwidth
%includegraphics[height=0.4in]theimage.png
rule0.95textwidth0.5in
endminipage%
beginminipage[t]0.5textwidth
sometext to fill the line
endminipage
enddocument
MWE behavior:
Desired behavior:
vertical-alignment minipage
asked Aug 22 at 3:54
amoodie
233
233
Welcome to TeX.SE! Please have a look at this post.
â marmot
Aug 22 at 4:00
Isn't this what you want? tex.stackexchange.com/questions/29143/â¦
â Oleg Lobachev
Aug 22 at 12:45
thanks to both of you, I was having trouble locating these resources by searches. Should have searched harder I guess.
â amoodie
Aug 22 at 13:56
add a comment |Â
Welcome to TeX.SE! Please have a look at this post.
â marmot
Aug 22 at 4:00
Isn't this what you want? tex.stackexchange.com/questions/29143/â¦
â Oleg Lobachev
Aug 22 at 12:45
thanks to both of you, I was having trouble locating these resources by searches. Should have searched harder I guess.
â amoodie
Aug 22 at 13:56
Welcome to TeX.SE! Please have a look at this post.
â marmot
Aug 22 at 4:00
Welcome to TeX.SE! Please have a look at this post.
â marmot
Aug 22 at 4:00
Isn't this what you want? tex.stackexchange.com/questions/29143/â¦
â Oleg Lobachev
Aug 22 at 12:45
Isn't this what you want? tex.stackexchange.com/questions/29143/â¦
â Oleg Lobachev
Aug 22 at 12:45
thanks to both of you, I was having trouble locating these resources by searches. Should have searched harder I guess.
â amoodie
Aug 22 at 13:56
thanks to both of you, I was having trouble locating these resources by searches. Should have searched harder I guess.
â amoodie
Aug 22 at 13:56
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
4
down vote
accepted
A simple way to fix your problem is by adding vspace0pt
as soon as a minipage is created:
documentclassarticle
usepackagegraphicx
begindocument
beginminipage[t]0.5textwidth
vspace0pt
%includegraphics[height=0.4in]theimage.png
rule0.95textwidth0.5in
endminipage%
beginminipage[t]0.5textwidth
vspace0pt
sometext to fill the line
endminipage
enddocument
This also feels a little hacky (similar to my answer below) but it works. Can you explain why adding the zero-height vspace works in this case?
â amoodie
Aug 22 at 13:57
add a comment |Â
up vote
5
down vote
You could use adjustbox
, as marmot suggested in his comment.
Moreover, instead of using minipage
s, you could use a tabularx
.
documentclassarticle
usepackagetabularx
usepackagegraphicx
usepackage[export]adjustbox
begindocument
noindentbegintabularxlinewidth@X@hspace2ptX@
includegraphics[height=0.4in, width=0.475textwidth,valign=t]example-image
&
sometext to fill the line \
endtabularx
enddocument
add a comment |Â
up vote
0
down vote
A potential workaround I found is that if I know the height of the image, I can add a negative vspace. This seems kind of hacky though and I'm wondering if there is a cleaner solution
documentclassarticle
usepackagegraphicx
begindocument
beginminipage[t]0.5textwidth
% includegraphics[height=0.4in]theimage.png%
rule0.95textwidth4baselineskip
endminipage%
beginminipage[t]0.5textwidth
vspace*-4baselineskip
sometext to fill the line
endminipage
enddocument
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
A simple way to fix your problem is by adding vspace0pt
as soon as a minipage is created:
documentclassarticle
usepackagegraphicx
begindocument
beginminipage[t]0.5textwidth
vspace0pt
%includegraphics[height=0.4in]theimage.png
rule0.95textwidth0.5in
endminipage%
beginminipage[t]0.5textwidth
vspace0pt
sometext to fill the line
endminipage
enddocument
This also feels a little hacky (similar to my answer below) but it works. Can you explain why adding the zero-height vspace works in this case?
â amoodie
Aug 22 at 13:57
add a comment |Â
up vote
4
down vote
accepted
A simple way to fix your problem is by adding vspace0pt
as soon as a minipage is created:
documentclassarticle
usepackagegraphicx
begindocument
beginminipage[t]0.5textwidth
vspace0pt
%includegraphics[height=0.4in]theimage.png
rule0.95textwidth0.5in
endminipage%
beginminipage[t]0.5textwidth
vspace0pt
sometext to fill the line
endminipage
enddocument
This also feels a little hacky (similar to my answer below) but it works. Can you explain why adding the zero-height vspace works in this case?
â amoodie
Aug 22 at 13:57
add a comment |Â
up vote
4
down vote
accepted
up vote
4
down vote
accepted
A simple way to fix your problem is by adding vspace0pt
as soon as a minipage is created:
documentclassarticle
usepackagegraphicx
begindocument
beginminipage[t]0.5textwidth
vspace0pt
%includegraphics[height=0.4in]theimage.png
rule0.95textwidth0.5in
endminipage%
beginminipage[t]0.5textwidth
vspace0pt
sometext to fill the line
endminipage
enddocument
A simple way to fix your problem is by adding vspace0pt
as soon as a minipage is created:
documentclassarticle
usepackagegraphicx
begindocument
beginminipage[t]0.5textwidth
vspace0pt
%includegraphics[height=0.4in]theimage.png
rule0.95textwidth0.5in
endminipage%
beginminipage[t]0.5textwidth
vspace0pt
sometext to fill the line
endminipage
enddocument
answered Aug 22 at 6:12
M. Al Jumaily
3636
3636
This also feels a little hacky (similar to my answer below) but it works. Can you explain why adding the zero-height vspace works in this case?
â amoodie
Aug 22 at 13:57
add a comment |Â
This also feels a little hacky (similar to my answer below) but it works. Can you explain why adding the zero-height vspace works in this case?
â amoodie
Aug 22 at 13:57
This also feels a little hacky (similar to my answer below) but it works. Can you explain why adding the zero-height vspace works in this case?
â amoodie
Aug 22 at 13:57
This also feels a little hacky (similar to my answer below) but it works. Can you explain why adding the zero-height vspace works in this case?
â amoodie
Aug 22 at 13:57
add a comment |Â
up vote
5
down vote
You could use adjustbox
, as marmot suggested in his comment.
Moreover, instead of using minipage
s, you could use a tabularx
.
documentclassarticle
usepackagetabularx
usepackagegraphicx
usepackage[export]adjustbox
begindocument
noindentbegintabularxlinewidth@X@hspace2ptX@
includegraphics[height=0.4in, width=0.475textwidth,valign=t]example-image
&
sometext to fill the line \
endtabularx
enddocument
add a comment |Â
up vote
5
down vote
You could use adjustbox
, as marmot suggested in his comment.
Moreover, instead of using minipage
s, you could use a tabularx
.
documentclassarticle
usepackagetabularx
usepackagegraphicx
usepackage[export]adjustbox
begindocument
noindentbegintabularxlinewidth@X@hspace2ptX@
includegraphics[height=0.4in, width=0.475textwidth,valign=t]example-image
&
sometext to fill the line \
endtabularx
enddocument
add a comment |Â
up vote
5
down vote
up vote
5
down vote
You could use adjustbox
, as marmot suggested in his comment.
Moreover, instead of using minipage
s, you could use a tabularx
.
documentclassarticle
usepackagetabularx
usepackagegraphicx
usepackage[export]adjustbox
begindocument
noindentbegintabularxlinewidth@X@hspace2ptX@
includegraphics[height=0.4in, width=0.475textwidth,valign=t]example-image
&
sometext to fill the line \
endtabularx
enddocument
You could use adjustbox
, as marmot suggested in his comment.
Moreover, instead of using minipage
s, you could use a tabularx
.
documentclassarticle
usepackagetabularx
usepackagegraphicx
usepackage[export]adjustbox
begindocument
noindentbegintabularxlinewidth@X@hspace2ptX@
includegraphics[height=0.4in, width=0.475textwidth,valign=t]example-image
&
sometext to fill the line \
endtabularx
enddocument
answered Aug 22 at 5:06
CarLaTeX
25.4k442110
25.4k442110
add a comment |Â
add a comment |Â
up vote
0
down vote
A potential workaround I found is that if I know the height of the image, I can add a negative vspace. This seems kind of hacky though and I'm wondering if there is a cleaner solution
documentclassarticle
usepackagegraphicx
begindocument
beginminipage[t]0.5textwidth
% includegraphics[height=0.4in]theimage.png%
rule0.95textwidth4baselineskip
endminipage%
beginminipage[t]0.5textwidth
vspace*-4baselineskip
sometext to fill the line
endminipage
enddocument
add a comment |Â
up vote
0
down vote
A potential workaround I found is that if I know the height of the image, I can add a negative vspace. This seems kind of hacky though and I'm wondering if there is a cleaner solution
documentclassarticle
usepackagegraphicx
begindocument
beginminipage[t]0.5textwidth
% includegraphics[height=0.4in]theimage.png%
rule0.95textwidth4baselineskip
endminipage%
beginminipage[t]0.5textwidth
vspace*-4baselineskip
sometext to fill the line
endminipage
enddocument
add a comment |Â
up vote
0
down vote
up vote
0
down vote
A potential workaround I found is that if I know the height of the image, I can add a negative vspace. This seems kind of hacky though and I'm wondering if there is a cleaner solution
documentclassarticle
usepackagegraphicx
begindocument
beginminipage[t]0.5textwidth
% includegraphics[height=0.4in]theimage.png%
rule0.95textwidth4baselineskip
endminipage%
beginminipage[t]0.5textwidth
vspace*-4baselineskip
sometext to fill the line
endminipage
enddocument
A potential workaround I found is that if I know the height of the image, I can add a negative vspace. This seems kind of hacky though and I'm wondering if there is a cleaner solution
documentclassarticle
usepackagegraphicx
begindocument
beginminipage[t]0.5textwidth
% includegraphics[height=0.4in]theimage.png%
rule0.95textwidth4baselineskip
endminipage%
beginminipage[t]0.5textwidth
vspace*-4baselineskip
sometext to fill the line
endminipage
enddocument
answered Aug 22 at 3:56
amoodie
233
233
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f447104%2fvertical-align-top-graphic-and-top-of-text-line%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Welcome to TeX.SE! Please have a look at this post.
â marmot
Aug 22 at 4:00
Isn't this what you want? tex.stackexchange.com/questions/29143/â¦
â Oleg Lobachev
Aug 22 at 12:45
thanks to both of you, I was having trouble locating these resources by searches. Should have searched harder I guess.
â amoodie
Aug 22 at 13:56