Miktex/XeLaTeX - wrong aligned images to the top of text using wrapfigure
Clash Royale CLAN TAG#URR8PPP
I'm trying to display image wrapped by text, but I'm not able to align them exactly. Image is always rendered one line below the begin of text block. Additionally, it's displayed line below even when I want to align it with the subsection.
I've tried to shift the image by vspace-33pt, but it works only when wrapfigure has specified width. This setting is completely ignored in my case when I need to detect wrapfigure width using 0pt width settings.
(Please don't be confused by specified image (=rule) width in my example - real document contains hundreds of images of variable width, so width can't be specified as a parameter and wrapfigure width must be really detected.)
How shall be correctly aligned top of the image to
1) subsection header
2) first line of text
with additional requirement for wrapfigure width detection?
Full non-working code and screenshots describing observed and expected behaviour are below.
documentclass[a4paper]book
usepackagefontspec
usepackagepolyglossia
setmainlanguageczech
usepackageulem
usepackagespverbatim
usepackage[unicode]hyperref
usepackagegraphicx
usepackagegrffile
usepackagecolor
usepackagewrapfig
usepackagehologo
usepackagepdfpages
usepackageneedspace
begindocument
chapterChapter 1
sectionSection 1
needspace6cm
beginwrapfigureR0pt
%vspace-33pt % Doesn't work for width detection (0pt above)
centering
rule3cm4cm
%includegraphics[height=4cm,width=3cm]img.jpg
endwrapfigure
subsectionSubsection 1 % <----- Image shall be here, but is one line below Some text
Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below.
chapterChapter 2
sectionSection 2
subsectionSubsection 2
needspace6cm
beginwrapfigureR0pt
centering
rule3cm4cm
%includegraphics[height=4cm,width=3cm]img.jpg
endwrapfigure
Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below.
enddocument
xetex wrapfigure alignment
add a comment |
I'm trying to display image wrapped by text, but I'm not able to align them exactly. Image is always rendered one line below the begin of text block. Additionally, it's displayed line below even when I want to align it with the subsection.
I've tried to shift the image by vspace-33pt, but it works only when wrapfigure has specified width. This setting is completely ignored in my case when I need to detect wrapfigure width using 0pt width settings.
(Please don't be confused by specified image (=rule) width in my example - real document contains hundreds of images of variable width, so width can't be specified as a parameter and wrapfigure width must be really detected.)
How shall be correctly aligned top of the image to
1) subsection header
2) first line of text
with additional requirement for wrapfigure width detection?
Full non-working code and screenshots describing observed and expected behaviour are below.
documentclass[a4paper]book
usepackagefontspec
usepackagepolyglossia
setmainlanguageczech
usepackageulem
usepackagespverbatim
usepackage[unicode]hyperref
usepackagegraphicx
usepackagegrffile
usepackagecolor
usepackagewrapfig
usepackagehologo
usepackagepdfpages
usepackageneedspace
begindocument
chapterChapter 1
sectionSection 1
needspace6cm
beginwrapfigureR0pt
%vspace-33pt % Doesn't work for width detection (0pt above)
centering
rule3cm4cm
%includegraphics[height=4cm,width=3cm]img.jpg
endwrapfigure
subsectionSubsection 1 % <----- Image shall be here, but is one line below Some text
Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below.
chapterChapter 2
sectionSection 2
subsectionSubsection 2
needspace6cm
beginwrapfigureR0pt
centering
rule3cm4cm
%includegraphics[height=4cm,width=3cm]img.jpg
endwrapfigure
Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below.
enddocument
xetex wrapfigure alignment
2
off-topic: your problem is not related to miktex , the very same problem you will meet at anylatex
distribution...wrapfigure
work correctly (only) at standard paragraph.
– Zarko
Dec 22 '18 at 22:46
add a comment |
I'm trying to display image wrapped by text, but I'm not able to align them exactly. Image is always rendered one line below the begin of text block. Additionally, it's displayed line below even when I want to align it with the subsection.
I've tried to shift the image by vspace-33pt, but it works only when wrapfigure has specified width. This setting is completely ignored in my case when I need to detect wrapfigure width using 0pt width settings.
(Please don't be confused by specified image (=rule) width in my example - real document contains hundreds of images of variable width, so width can't be specified as a parameter and wrapfigure width must be really detected.)
How shall be correctly aligned top of the image to
1) subsection header
2) first line of text
with additional requirement for wrapfigure width detection?
Full non-working code and screenshots describing observed and expected behaviour are below.
documentclass[a4paper]book
usepackagefontspec
usepackagepolyglossia
setmainlanguageczech
usepackageulem
usepackagespverbatim
usepackage[unicode]hyperref
usepackagegraphicx
usepackagegrffile
usepackagecolor
usepackagewrapfig
usepackagehologo
usepackagepdfpages
usepackageneedspace
begindocument
chapterChapter 1
sectionSection 1
needspace6cm
beginwrapfigureR0pt
%vspace-33pt % Doesn't work for width detection (0pt above)
centering
rule3cm4cm
%includegraphics[height=4cm,width=3cm]img.jpg
endwrapfigure
subsectionSubsection 1 % <----- Image shall be here, but is one line below Some text
Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below.
chapterChapter 2
sectionSection 2
subsectionSubsection 2
needspace6cm
beginwrapfigureR0pt
centering
rule3cm4cm
%includegraphics[height=4cm,width=3cm]img.jpg
endwrapfigure
Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below.
enddocument
xetex wrapfigure alignment
I'm trying to display image wrapped by text, but I'm not able to align them exactly. Image is always rendered one line below the begin of text block. Additionally, it's displayed line below even when I want to align it with the subsection.
I've tried to shift the image by vspace-33pt, but it works only when wrapfigure has specified width. This setting is completely ignored in my case when I need to detect wrapfigure width using 0pt width settings.
(Please don't be confused by specified image (=rule) width in my example - real document contains hundreds of images of variable width, so width can't be specified as a parameter and wrapfigure width must be really detected.)
How shall be correctly aligned top of the image to
1) subsection header
2) first line of text
with additional requirement for wrapfigure width detection?
Full non-working code and screenshots describing observed and expected behaviour are below.
documentclass[a4paper]book
usepackagefontspec
usepackagepolyglossia
setmainlanguageczech
usepackageulem
usepackagespverbatim
usepackage[unicode]hyperref
usepackagegraphicx
usepackagegrffile
usepackagecolor
usepackagewrapfig
usepackagehologo
usepackagepdfpages
usepackageneedspace
begindocument
chapterChapter 1
sectionSection 1
needspace6cm
beginwrapfigureR0pt
%vspace-33pt % Doesn't work for width detection (0pt above)
centering
rule3cm4cm
%includegraphics[height=4cm,width=3cm]img.jpg
endwrapfigure
subsectionSubsection 1 % <----- Image shall be here, but is one line below Some text
Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below.
chapterChapter 2
sectionSection 2
subsectionSubsection 2
needspace6cm
beginwrapfigureR0pt
centering
rule3cm4cm
%includegraphics[height=4cm,width=3cm]img.jpg
endwrapfigure
Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below.
enddocument
xetex wrapfigure alignment
xetex wrapfigure alignment
edited Dec 22 '18 at 22:57
David Carlisle
483k4011151856
483k4011151856
asked Dec 22 '18 at 22:33
Joseph
596
596
2
off-topic: your problem is not related to miktex , the very same problem you will meet at anylatex
distribution...wrapfigure
work correctly (only) at standard paragraph.
– Zarko
Dec 22 '18 at 22:46
add a comment |
2
off-topic: your problem is not related to miktex , the very same problem you will meet at anylatex
distribution...wrapfigure
work correctly (only) at standard paragraph.
– Zarko
Dec 22 '18 at 22:46
2
2
off-topic: your problem is not related to miktex , the very same problem you will meet at any
latex
distribution... wrapfigure
work correctly (only) at standard paragraph.– Zarko
Dec 22 '18 at 22:46
off-topic: your problem is not related to miktex , the very same problem you will meet at any
latex
distribution... wrapfigure
work correctly (only) at standard paragraph.– Zarko
Dec 22 '18 at 22:46
add a comment |
2 Answers
2
active
oldest
votes
You can set intextsep to 0 to align with the first line of the paragraph. To move it more up in e.g. a heading use raisebox and hide the real height with the option argument. Be aware that a long heading will be overwritten by such an image.
documentclass[a4paper]book
usepackagewrapfig
usepackageneedspace
intextsep=0pt
begindocument
chapterChapter 1
sectionSection 1
needspace6cm
beginwrapfigureR0pt
centering
raiseboxbaselineskip[dimexprheight-baselineskip][0pt]rule3cm4cm
endwrapfigure
subsectionSubsection 1 % <----- Image shall be here, but is one line below Some text
Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below.
chapterChapter 2
sectionSection 2
subsectionSubsection 2
needspace6cm
beginwrapfigureR0pt
centering
rule3cm4cm
endwrapfigure
Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below.
enddocument
add a comment |
You can play with raisebox
, fooling LaTeX with the real height of the image via the 1st optional argument of the command:
documentclass[a4paper]book
usepackagefontspec
usepackagepolyglossia
setmainlanguageczech
usepackageulem
usepackagespverbatim
usepackage[unicode]hyperref
usepackage[demo]graphicx
usepackagegrffile
usepackagecolor
usepackagewrapfig
usepackagehologo
usepackagepdfpages
usepackageneedspace
usepackagelipsum
begindocument
chapterChapter 1
sectionSection 1
needspace6cm
beginwrapfigureR0pt
%vspace-33pt % Doesn't work for width detection (0pt above)
centering
rule3cm4cm
%includegraphics[height=4cm,width=3cm]img.jpg
endwrapfigure
subsectionSubsection 1 % <----- Image shall be here, but is one line below Some text
Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below.
chapterChapter 2
sectionSection 2
subsectionSubsection 2
needspace6cm
beginwrapfigure[8]R0pt
centering
raisebox4ex[0.8height] includegraphics[height=4cm,width=3cm]img.jpg
endwrapfigure
leavevmode lipsum[1]
enddocument
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
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
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f467036%2fmiktex-xelatex-wrong-aligned-images-to-the-top-of-text-using-wrapfigure%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can set intextsep to 0 to align with the first line of the paragraph. To move it more up in e.g. a heading use raisebox and hide the real height with the option argument. Be aware that a long heading will be overwritten by such an image.
documentclass[a4paper]book
usepackagewrapfig
usepackageneedspace
intextsep=0pt
begindocument
chapterChapter 1
sectionSection 1
needspace6cm
beginwrapfigureR0pt
centering
raiseboxbaselineskip[dimexprheight-baselineskip][0pt]rule3cm4cm
endwrapfigure
subsectionSubsection 1 % <----- Image shall be here, but is one line below Some text
Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below.
chapterChapter 2
sectionSection 2
subsectionSubsection 2
needspace6cm
beginwrapfigureR0pt
centering
rule3cm4cm
endwrapfigure
Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below.
enddocument
add a comment |
You can set intextsep to 0 to align with the first line of the paragraph. To move it more up in e.g. a heading use raisebox and hide the real height with the option argument. Be aware that a long heading will be overwritten by such an image.
documentclass[a4paper]book
usepackagewrapfig
usepackageneedspace
intextsep=0pt
begindocument
chapterChapter 1
sectionSection 1
needspace6cm
beginwrapfigureR0pt
centering
raiseboxbaselineskip[dimexprheight-baselineskip][0pt]rule3cm4cm
endwrapfigure
subsectionSubsection 1 % <----- Image shall be here, but is one line below Some text
Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below.
chapterChapter 2
sectionSection 2
subsectionSubsection 2
needspace6cm
beginwrapfigureR0pt
centering
rule3cm4cm
endwrapfigure
Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below.
enddocument
add a comment |
You can set intextsep to 0 to align with the first line of the paragraph. To move it more up in e.g. a heading use raisebox and hide the real height with the option argument. Be aware that a long heading will be overwritten by such an image.
documentclass[a4paper]book
usepackagewrapfig
usepackageneedspace
intextsep=0pt
begindocument
chapterChapter 1
sectionSection 1
needspace6cm
beginwrapfigureR0pt
centering
raiseboxbaselineskip[dimexprheight-baselineskip][0pt]rule3cm4cm
endwrapfigure
subsectionSubsection 1 % <----- Image shall be here, but is one line below Some text
Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below.
chapterChapter 2
sectionSection 2
subsectionSubsection 2
needspace6cm
beginwrapfigureR0pt
centering
rule3cm4cm
endwrapfigure
Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below.
enddocument
You can set intextsep to 0 to align with the first line of the paragraph. To move it more up in e.g. a heading use raisebox and hide the real height with the option argument. Be aware that a long heading will be overwritten by such an image.
documentclass[a4paper]book
usepackagewrapfig
usepackageneedspace
intextsep=0pt
begindocument
chapterChapter 1
sectionSection 1
needspace6cm
beginwrapfigureR0pt
centering
raiseboxbaselineskip[dimexprheight-baselineskip][0pt]rule3cm4cm
endwrapfigure
subsectionSubsection 1 % <----- Image shall be here, but is one line below Some text
Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below.
chapterChapter 2
sectionSection 2
subsectionSubsection 2
needspace6cm
beginwrapfigureR0pt
centering
rule3cm4cm
endwrapfigure
Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below.
enddocument
answered Dec 22 '18 at 22:48
Ulrike Fischer
187k7290670
187k7290670
add a comment |
add a comment |
You can play with raisebox
, fooling LaTeX with the real height of the image via the 1st optional argument of the command:
documentclass[a4paper]book
usepackagefontspec
usepackagepolyglossia
setmainlanguageczech
usepackageulem
usepackagespverbatim
usepackage[unicode]hyperref
usepackage[demo]graphicx
usepackagegrffile
usepackagecolor
usepackagewrapfig
usepackagehologo
usepackagepdfpages
usepackageneedspace
usepackagelipsum
begindocument
chapterChapter 1
sectionSection 1
needspace6cm
beginwrapfigureR0pt
%vspace-33pt % Doesn't work for width detection (0pt above)
centering
rule3cm4cm
%includegraphics[height=4cm,width=3cm]img.jpg
endwrapfigure
subsectionSubsection 1 % <----- Image shall be here, but is one line below Some text
Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below.
chapterChapter 2
sectionSection 2
subsectionSubsection 2
needspace6cm
beginwrapfigure[8]R0pt
centering
raisebox4ex[0.8height] includegraphics[height=4cm,width=3cm]img.jpg
endwrapfigure
leavevmode lipsum[1]
enddocument
add a comment |
You can play with raisebox
, fooling LaTeX with the real height of the image via the 1st optional argument of the command:
documentclass[a4paper]book
usepackagefontspec
usepackagepolyglossia
setmainlanguageczech
usepackageulem
usepackagespverbatim
usepackage[unicode]hyperref
usepackage[demo]graphicx
usepackagegrffile
usepackagecolor
usepackagewrapfig
usepackagehologo
usepackagepdfpages
usepackageneedspace
usepackagelipsum
begindocument
chapterChapter 1
sectionSection 1
needspace6cm
beginwrapfigureR0pt
%vspace-33pt % Doesn't work for width detection (0pt above)
centering
rule3cm4cm
%includegraphics[height=4cm,width=3cm]img.jpg
endwrapfigure
subsectionSubsection 1 % <----- Image shall be here, but is one line below Some text
Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below.
chapterChapter 2
sectionSection 2
subsectionSubsection 2
needspace6cm
beginwrapfigure[8]R0pt
centering
raisebox4ex[0.8height] includegraphics[height=4cm,width=3cm]img.jpg
endwrapfigure
leavevmode lipsum[1]
enddocument
add a comment |
You can play with raisebox
, fooling LaTeX with the real height of the image via the 1st optional argument of the command:
documentclass[a4paper]book
usepackagefontspec
usepackagepolyglossia
setmainlanguageczech
usepackageulem
usepackagespverbatim
usepackage[unicode]hyperref
usepackage[demo]graphicx
usepackagegrffile
usepackagecolor
usepackagewrapfig
usepackagehologo
usepackagepdfpages
usepackageneedspace
usepackagelipsum
begindocument
chapterChapter 1
sectionSection 1
needspace6cm
beginwrapfigureR0pt
%vspace-33pt % Doesn't work for width detection (0pt above)
centering
rule3cm4cm
%includegraphics[height=4cm,width=3cm]img.jpg
endwrapfigure
subsectionSubsection 1 % <----- Image shall be here, but is one line below Some text
Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below.
chapterChapter 2
sectionSection 2
subsectionSubsection 2
needspace6cm
beginwrapfigure[8]R0pt
centering
raisebox4ex[0.8height] includegraphics[height=4cm,width=3cm]img.jpg
endwrapfigure
leavevmode lipsum[1]
enddocument
You can play with raisebox
, fooling LaTeX with the real height of the image via the 1st optional argument of the command:
documentclass[a4paper]book
usepackagefontspec
usepackagepolyglossia
setmainlanguageczech
usepackageulem
usepackagespverbatim
usepackage[unicode]hyperref
usepackage[demo]graphicx
usepackagegrffile
usepackagecolor
usepackagewrapfig
usepackagehologo
usepackagepdfpages
usepackageneedspace
usepackagelipsum
begindocument
chapterChapter 1
sectionSection 1
needspace6cm
beginwrapfigureR0pt
%vspace-33pt % Doesn't work for width detection (0pt above)
centering
rule3cm4cm
%includegraphics[height=4cm,width=3cm]img.jpg
endwrapfigure
subsectionSubsection 1 % <----- Image shall be here, but is one line below Some text
Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below. Some text below.
chapterChapter 2
sectionSection 2
subsectionSubsection 2
needspace6cm
beginwrapfigure[8]R0pt
centering
raisebox4ex[0.8height] includegraphics[height=4cm,width=3cm]img.jpg
endwrapfigure
leavevmode lipsum[1]
enddocument
answered Dec 22 '18 at 23:08
Bernard
166k769194
166k769194
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f467036%2fmiktex-xelatex-wrong-aligned-images-to-the-top-of-text-using-wrapfigure%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
off-topic: your problem is not related to miktex , the very same problem you will meet at any
latex
distribution...wrapfigure
work correctly (only) at standard paragraph.– Zarko
Dec 22 '18 at 22:46