1

My goal is simple to accomplish in most word processing programs and it really should work here. I want at the top of a section, a photo on the right of the person the section is about, and I would like the text to wrap around that photo. Seems pretty easy, right?

I am using \wrapfig for this, but there are some pretty odd side effects and instead of just wrapping nicely around the picture, seems to effect every paragraph in the following section. Sample is at the bottom. Here is what it produces:

enter image description here

And the following page is:

enter image description here

As you can see:

(1) there is a gap between the top of the section header and the top of the photo. I would like the photo to start at the same line that starts the section, and not some 1/4 lower.

(2) the wrapping overwrites the caption

(3) this block of "wrapping" seems to repeat for every paragraph of the section.

(4) there are even worse problems if the photo is too close to the bottom of the page, so I am manually putting in page breaks for those cases.

Here is the MWE:

\documentclass[paper=7in:10in,11pt,pagesize=pdftex,openright,headings=twolinechapter,chapterprefix=true]{scrbook}

\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{makeidx}
\usepackage{fontspec}
\usepackage{needspace}
\usepackage{longtable}
\usepackage{framed}
\usepackage{enumitem}
\usepackage{setspace}
\usepackage{tcolorbox}
\usepackage{url}
\usepackage{showframe}
\usepackage{lineno}


\usepackage[natbibapa]{apacite}
\bibliographystyle{apacite}
%\usepackage{natbib}
%\usepackage[style=authoryear,sorting=ynt]{biblatex}
%\DefineBibliographyStrings{english}{urlseen = {Accessed\addcolon}}

\setmainfont[Ligatures={Common,TeX}, Numbers={OldStyle}]{Palatino Linotype}
%\KOMAoptions{DIV=last}   % goofy KOMA requirement whenever you change leading
\addtokomafont{footnote}{\footnotesize\fontspec[Ligatures=TeX]{Alegreya Sans}}
\deffootnote{1.5em}{1em}{% modified example from page 83
  \makebox[1.5em][l]{\textsuperscript{\thefootnotemark}}}

\definecolor{skyblue}{rgb}{0.53, 0.81, 0.92}
\definecolor{shadecolor}{rgb}{0.95, 0.95, 0.95}

\makeindex

%page is 7 x 10.  With these margins the printed area
%is 5.75 inches by 9 inches.
\usepackage[inner=0.75in,outer=0.50in,top=0.75in, bottom=0.75in, footnotesep=.3in, footskip=.4in]{geometry}

\renewcommand*\chapterheadstartvskip{\vspace*{.1\textheight}}
\renewcommand*\chapterheadendvskip{\vspace*{.1\textheight}}

\addtokomafont{chapter}{\fontspec[Ligatures=TeX]{Alegreya Sans SC Light}}
\addtokomafont{chapterprefix}{\fontspec[Ligatures=TeX]{Alegreya Sans SC Light}\Huge}

\addtokomafont{chapterprefix}{\raggedleft}
\renewcommand*{\chapterformat}{%
   \mbox{\scalebox{1}{\chapappifchapterprefix{\nobreakspace}}%
   \scalebox{4}{\color{gray}\thechapter}\enskip}}


%Page size settings
\pdfpagewidth=\paperwidth
\pdfpageheight=\paperheight
\widowpenalty10000
\clubpenalty10000

\hyphenation{}

\addtokomafont{section}{\raggedright}
\addtokomafont{subsection}{\raggedright}
\setcounter{secnumdepth}{0}

\setlength{\emergencystretch}{15pt}

\newenvironment{glossarylist}%
   {\begin{list}{}{\setlength\labelwidth{0pt}%
                   \setlength\itemindent{-\leftmargin}%
                   \let\makelabel\descriptionlabel}}%
   {\end{list}}


   
\newenvironment{centerTable}[1][Examples]%
   {\begin{longtable}{| p{2.5in} |} \hline \rowcolor{lightgray} \emph{#1} \\ \hline }%
   {\end{longtable}}

\newcommand{\partfrontpage}[1]{%
    \cleardoublepage\vspace*{2.0in}\thispagestyle{empty}%
    \begin{center}%
    \noindent\fontspec[Ligatures=TeX]{Alegreya Sans SC Light}%
    \doublespacing\Huge #1%
    \end{center}}

\newcommand{\centerLine}[1]{ #1 \\ \hline }
   
   
%this allows graphics from one folder to be included in one style
%but when building hypertext it includes a different set of graphics from 
%a different folder
\newcommand{\bookcoverimage}[1]{\noindent\includegraphics[width=2in]{img/#1}}
    
\newcommand{\simpleimage}[2]{%
  \begin{figure}[!ht]%
  %\vspace{10pt}%
  \begin{center}%
    \noindent\includegraphics[width=5in]{img/#1}\\%
    \emph{#2}%
  \end{center}%
  \end{figure}%
}
\newcommand{\sizeimage}[3]{%
  \begin{figure}[!ht]%
  %\vspace{10pt}%
  \begin{center}%
    \noindent\includegraphics[width=#3in]{img/#1}\\%
    \emph{#2}%
  \end{center}%
  \end{figure}%
}

%\intextsep = 0pt

\newcommand{\rightimage}[3]{%
  \begin{wrapfigure}{r}{#3in}%
  \noindent\includegraphics[width=#3in]{img/#1}\\%
  \centering\emph{#2}%
  \end{wrapfigure}%
}


\newcommand{\narrowimage}[1]{\noindent\includegraphics[width=2in]{img/#1}}

\newcommand{\citePlain}[1]{\footnote{\citep{#1}}}
\newcommand{\citePlainP}[2]{\footnote{\citep[#2]{#1}}}

\newcommand{\citeSpecial}[1]{\footnotetext{\citep{#1}}}
\newcommand{\citeSpecialP}[2]{\footnotetext{\citep[#2]{#1}}}


%control whether extra vertical space is distributed between paragraphs
%either raggedbottom or flushbottom
\raggedbottom


\usepackage{tcolorbox}
\newtcolorbox{boxedQuote}{colback=gray!30,boxrule=0pt,arc=0pt,boxsep=2pt,left=2pt,right=2pt,leftrule=1pt}

\begin{document}


Dave Campbell Purcell, second son of Margaret and David Purcell, always maintained a strong interest in our David family history---especially in his later life. In the 1960s he and his wife Elizabeth (``Betty''), made at least one trip from their home in Maine to visit their cousins in the Wallace, Gulf Shore, Fox Harbour areas of northern Nova Scotia.  I have several letters that Dave had written to my mother during those years. In later years, I corresponded with him on all things relating to the David family. He was particularly interested in any effort to learn more about the early family members who came to North America from Europe. Several times Mary Lee and I visited with Dave and Betty at their home in Maine. They were always charming and welcoming – Betty interested to know about our son and daughter, and Dave, his desk covered with notes, charts, and printouts, eager to discuss any new discoveries on the family history front. Dave died January 8th, 2004 at the age of eighty-eight and Betty on July 10, 2014.

\rightimage{ch19-DavidBettyPurcell.jpg}{Dave \& Betty Purcell   ca 1998}{2}

\section{Dave Campbell Purcell}

Dave Campbell Purcell, second son of Margaret and David Purcell, always maintained a strong interest in our David family history---especially in his later life. In the 1960s he and his wife Elizabeth (``Betty''), made at least one trip from their home in Maine to visit their cousins in the Wallace, Gulf Shore, Fox Harbour areas of northern Nova Scotia.  I have several letters that Dave had written to my mother during those years. In later years, I corresponded with him on all things relating to the David family. He was particularly interested in any effort to learn more about the early family members who came to North America from Europe. Several times Mary Lee and I visited with Dave and Betty at their home in Maine. They were always charming and welcoming – Betty interested to know about our son and daughter, and Dave, his desk covered with notes, charts, and printouts, eager to discuss any new discoveries on the family history front. Dave died January 8th, 2004 at the age of eighty-eight and Betty on July 10, 2014.

Dave and Betty Purcell had three children: David, Joanne and Elizabeth. In early December, 2017, I was able to establish contact with Joanne and her husband Bob Flynn. They live in Vermont. Throughout the spring of 2018 Joanne and I got acquainted through emails and phone chats. At one point I asked her if she had some special memories of her father that she could share with me. This is a part of her reply:

My father and I were very close; I have so many memories: spending endless house at his elbow in his workshop watching him explore, create, take apart, put together. Electrical . . . mechanical, didn't matter, he could fix anything---all the while teaching, explaining. We once even took apart a television set so he could describe how it worked! I can still envision the large picture tube, something that doesn't even exist anymore. I remember his infectious laugh, his wonderful sense of humour  . . . and his pranks  . . . he loved to play harmless pranks. One of the best was the Halloween he put a vacuum cleaner under our porch so that when the Trick or Treaters stepped up to the door, the machine would turn on. Only a few ran away!

Dave Campbell Purcell, second son of Margaret and David Purcell, always maintained a strong interest in our David family history---especially in his later life. In the 1960s he and his wife Elizabeth (``Betty''), made at least one trip from their home in Maine to visit their cousins in the Wallace, Gulf Shore, Fox Harbour areas of northern Nova Scotia.  I have several letters that Dave had written to my mother during those years. In later years, I corresponded with him on all things relating to the David family. He was particularly interested in any effort to learn more about the early family members who came to North America from Europe. Several times Mary Lee and I visited with Dave and Betty at their home in Maine. They were always charming and welcoming – Betty interested to know about our son and daughter, and Dave, his desk covered with notes, charts, and printouts, eager to discuss any new discoveries on the family history front. Dave died January 8th, 2004 at the age of eighty-eight and Betty on July 10, 2014.

Dave and Betty Purcell had three children: David, Joanne and Elizabeth. In early December, 2017, I was able to establish contact with Joanne and her husband Bob Flynn. They live in Vermont. Throughout the spring of 2018 Joanne and I got acquainted through emails and phone chats. At one point I asked her if she had some special memories of her father that she could share with me. This is a part of her reply:

My father and I were very close; I have so many memories: spending endless house at his elbow in his workshop watching him explore, create, take apart, put together. Electrical . . . mechanical, didn't matter, he could fix anything---all the while teaching, explaining. We once even took apart a television set so he could describe how it worked! I can still envision the large picture tube, something that doesn't even exist anymore. I remember his infectious laugh, his wonderful sense of humour  . . . and his pranks  . . . he loved to play harmless pranks. One of the best was the Halloween he put a vacuum cleaner under our porch so that when the Trick or Treaters stepped up to the door, the machine would turn on. Only a few ran away!

\end{document}

Previously i was given the answer to change \intextsep but changing that messes up figures in the document.

Step Two

My first sample had some problems that could be fixed:

(A) The \\ should be replaced with \par to avoid problems with the caption text

(B) An \mbox must be added after the \wrapfig in order to avoid causing the wrapping in every paragraph in the section. I don't have a conceptual understanding of why this happens, but I understand it is because the section head causes the following text to be grouped? The \mbox somehow separates the \wrapfig from the section.

(C) One must control the length of wrap space manually. I am now resigned to setting this manually for every one of 48 images in the book. Would be nice if it could calculate this from the image size itself, however for now if I can get it to work, I can set the box size manually on 48 images.

(D) The top of the box was not quite right with the section, so the text in section (the header of the section particularly) can be pulled up on the page by using \vspace*{-1.2\baselineskip} to get the top approximately at the top of the image.

I sometimes need image next to a header, and sometimes in the middle of paragraphs.

Two remaining problems:

(1) The section head with image is spaced a bit differently. Looks like if I put a vspace before the image, I can get it lower on the page, and then I can adjust the other negative vspace to line that up.

enter image description here

(2) I made a separate command for placing images in the text (not at the section head). If the \mbox was in there, it left gap of about one line. So this new command eliminates the \mbox. I used a vspace{-1.0\intextsep} to cancel out the space on top, and then of course using the manual sizing to control the space below.

Step Three

It turns out there is one other situation to consider, and that is when the section header appears at the top of a page, and this will happen any time there is not enough room on the previous page for the picture.

The \mbox approach does not work because in the above situation that \mbox causes extra white space at the top of the page which is not needed.

The better approach is to place the image into the paragraph after the section header, but use vspace to raise the image up to the height of the header. Then, because we are manually controlling the number of lines to shorten, we can make the space close in the right place.

The two commands to define are:

\newcommand{\rightimageH}[4][]{%       for use at sections head
  \begin{wrapfigure}[#1]{r}{#4in}%
  \vspace*{-3.1\baselineskip}%
  \noindent\includegraphics[width=#4in]{example-image-1x1.png}\par%
  \centering\emph{#3}%
  \end{wrapfigure}%
}
\newcommand{\rightimage}[4][]{%        for use in body text
  \begin{wrapfigure}[#1]{r}{#4in}%
  \vspace*{-1.0\intextsep}%
  \noindent\includegraphics[width=#4in]{example-image-1x1.png}\par%
  \centering\emph{#3}%
  \end{wrapfigure}%
}

This is then used with a section header like this:

\section{Dave Campbell Purcell}

\rightimageH[10]{ch19-DavidBettyPurcell.jpg}{Dave \& Betty Purcell   ca 1998}{2}
Dave Campbell Purcell, second son of Margaret ...

Note that 10 lines are reserved in this case, but if you are putting this directly into the text (no header) then it goes like this with 12 lines shortened:

\rightimage[12]{ch19-DavidBettyPurcell.jpg}{Dave \& Betty Purcell   ca 1998}{2}
Dave Campbell Purcell, second son of Margaret and David ...

With these I am successfully able to get the following tight wrapping around pictures on the right of the page:

enter image description here

9
  • Maybe take a look at the insbox plain TeX macro package, which defines an \InsertBoxR command. You don't have to specify the width of the inserted box, and have only to possibly specify (as an optional argument) the number of supplementary shorter lines in case TeX makes a wrong calculation of the required number of shorter lines.
    – Bernard
    Commented Feb 28, 2021 at 20:48
  • 2
    the space at the bottom is forced by the misuse of \\ which you can delete. For the space at the top you can add \vepace{-\baselineskip} before the image.But it is rather hard to proivide a tested answer if you provide no code. Commented Feb 28, 2021 at 21:08
  • You can use \caption or \caption* (no number) in a wrapfigure. Or just add a \par or blank line. Commented Feb 28, 2021 at 22:07
  • setting \intextsep to 0pt is unlikley to be the correct solution but as noted in the answer posted without any code it is hard to guess why you are getting the space, please add an example to the question, using example-image-1x1.png as the image as in the answer below. Commented Mar 21, 2021 at 0:06
  • in the second update you have added the text immediately after the image with no space which is why Louise appears where it does. Exactly as you specified. You want the caption to be a new paragraph so leave a blank line before \centering Commented Mar 21, 2021 at 0:30

1 Answer 1

3

As commented before the \\ between the image and caption are wrong and should be a blank line or equivalently \par.

When wrapfig fails to reset it is usually because the first paragraph started inside a group when the figure was specified outside the group. Normally that is easy to avoid but here your first paragraph is a section heading so it is easier to put a fake empty \mbox paragraph before the heading. In either case the size of the cutout needs to be manually adjusted as wrapfig just assumes normal paragraphs and does not account for larger spacing of the heading.

enter image description here

Your example was far from minimal and used an image not supplied so I cut it down a bit

\documentclass[paper=7in:10in,11pt,pagesize=pdftex,openright,headings=twolinechapter,chapterprefix=true]{scrbook}

\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{fontspec}
\usepackage{xcolor}

\setmainfont[Ligatures={Common,TeX}, Numbers={OldStyle}]{Palatino Linotype}
%\KOMAoptions{DIV=last}   % goofy KOMA requirement whenever you change leading
\addtokomafont{footnote}{\footnotesize\fontspec[Ligatures=TeX]{Alegreya Sans}}
\deffootnote{1.5em}{1em}{% modified example from page 83
  \makebox[1.5em][l]{\textsuperscript{\thefootnotemark}}}

\definecolor{skyblue}{rgb}{0.53, 0.81, 0.92}
\definecolor{shadecolor}{rgb}{0.95, 0.95, 0.95}

\makeindex

%page is 7 x 10.  With these margins the printed area
%is 5.75 inches by 9 inches.
\usepackage[inner=0.75in,outer=0.50in,top=0.75in, bottom=0.75in, footnotesep=.3in, footskip=.4in]{geometry}

% why set these after geometry???
%Page size settings
\pdfpagewidth=\paperwidth
\pdfpageheight=\paperheight

% these will force bad page breaks
\widowpenalty10000
\clubpenalty10000

\hyphenation{}

\addtokomafont{section}{\raggedright}
\addtokomafont{subsection}{\raggedright}
\setcounter{secnumdepth}{0}

\setlength{\emergencystretch}{15pt}

    

%\intextsep = 0pt

\newcommand{\rightimage}[4][]{%
  \begin{wrapfigure}[#1]{r}{#4in}%
  \noindent\includegraphics[width=#4in]{example-image-1x1.png}\par
  \centering\emph{#3}%
  \end{wrapfigure}%
}


%control whether extra vertical space is distributed between paragraphs
%either raggedbottom or flushbottom
\raggedbottom




%must use WITHOUT gap to next paragraph so that the noindent works.
% would be better to use \@afterheading like section commands 
%which never use \noindent
\newcommand{\setOffPara}[0]{%
    \begin{center}%
    \line(1,0){50}%
    \end{center}%
    \noindent}


  

\begin{document}


Dave Campbell Purcell, second son of Margaret and David Purcell,
always maintained a strong interest in our David family
history---especially in his later life. In the 1960s he and his wife
Elizabeth (``Betty''), made at least one trip from their home in Maine
to visit their cousins in the Wallace, Gulf Shore, Fox Harbour areas
of northern Nova Scotia.  I have several letters that Dave had written
to my mother during those years. In later years, I corresponded with
him on all things relating to the David family. He was particularly
interested in any effort to learn more about the early family members
who came to North America from Europe. Several times Mary Lee and I
visited with Dave and Betty at their home in Maine. They were always
charming and welcoming – Betty interested to know about our son and
daughter, and Dave, his desk covered with notes, charts, and
printouts, eager to discuss any new discoveries on the family history
front. Dave died January 8th, 2004 at the age of eighty-eight and
Betty on July 10, 2014.

\rightimage[12]{ch19-DavidBettyPurcell.jpg}{Dave \& Betty Purcell   ca 1998}{2}
\mbox{}

\vspace*{-1.2\baselineskip}

\section{Dave Campbell Purcell}


Dave Campbell Purcell, second son of Margaret and David Purcell,
always maintained a strong interest in our David family
history---especially in his later life. In the 1960s he and his wife
Elizabeth (``Betty''), made at least one trip from their home in Maine
to visit their cousins in the Wallace, Gulf Shore, Fox Harbour areas
of northern Nova Scotia.  I have several letters that Dave had written
to my mother during those years. In later years, I corresponded with
him on all things relating to the David family. He was particularly
interested in any effort to learn more about the early family members
who came to North America from Europe. Several times Mary Lee and I
visited with Dave and Betty at their home in Maine. They were always
charming and welcoming – Betty interested to know about our son and
daughter, and Dave, his desk covered with notes, charts, and
printouts, eager to discuss any new discoveries on the family history
front. Dave died January 8th, 2004 at the age of eighty-eight and
Betty on July 10, 2014.

Dave and Betty Purcell had three children: David, Joanne and
Elizabeth. In early December, 2017, I was able to establish contact
with Joanne and her husband Bob Flynn. They live in
Vermont. Throughout the spring of 2018 Joanne and I got acquainted
through emails and phone chats. At one point I asked her if she had
some special memories of her father that she could share with me. This
is a part of her reply:

My father and I were very close; I have so many memories: spending
endless house at his elbow in his workshop watching him explore,
create, take apart, put together. Electrical . . . mechanical, didn't
matter, he could fix anything---all the while teaching, explaining. We
once even took apart a television set so he could describe how it
worked! I can still envision the large picture tube, something that
doesn't even exist anymore. I remember his infectious laugh, his
wonderful sense of humour . . . and his pranks . . . he loved to play
harmless pranks. One of the best was the Halloween he put a vacuum
cleaner under our porch so that when the Trick or Treaters stepped up
to the door, the machine would turn on. Only a few ran away!

Dave Campbell Purcell, second son of Margaret and David Purcell,
always maintained a strong interest in our David family
history---especially in his later life. In the 1960s he and his wife
Elizabeth (``Betty''), made at least one trip from their home in Maine
to visit their cousins in the Wallace, Gulf Shore, Fox Harbour areas
of northern Nova Scotia.  I have several letters that Dave had written
to my mother during those years. In later years, I corresponded with
him on all things relating to the David family. He was particularly
interested in any effort to learn more about the early family members
who came to North America from Europe. Several times Mary Lee and I
visited with Dave and Betty at their home in Maine. They were always
charming and welcoming – Betty interested to know about our son and
daughter, and Dave, his desk covered with notes, charts, and
printouts, eager to discuss any new discoveries on the family history
front. Dave died January 8th, 2004 at the age of eighty-eight and
Betty on July 10, 2014.

Dave and Betty Purcell had three children: David, Joanne and
Elizabeth. In early December, 2017, I was able to establish contact
with Joanne and her husband Bob Flynn. They live in
Vermont. Throughout the spring of 2018 Joanne and I got acquainted
through emails and phone chats. At one point I asked her if she had
some special memories of her father that she could share with me. This
is a part of her reply:

My father and I were very close; I have so many memories: spending
endless house at his elbow in his workshop watching him explore,
create, take apart, put together. Electrical . . . mechanical, didn't
matter, he could fix anything---all the while teaching, explaining. We
once even took apart a television set so he could describe how it
worked! I can still envision the large picture tube, something that
doesn't even exist anymore. I remember his infectious laugh, his
wonderful sense of humour . . . and his pranks . . . he loved to play
harmless pranks. One of the best was the Halloween he put a vacuum
cleaner under our porch so that when the Trick or Treaters stepped up
to the door, the machine would turn on. Only a few ran away!

\end{document}

Alternatively if you just want the image cut in to the paragraph use teh wrapfig after the heading, and make simmilar space adjustments.


Original answer

You have not provided any example, and the space at the top is not expected, and I can not reproduce. I correct for it here anyway causing the image to protude above the text.

Mostly the space at the bottom is forced by the \\ which should never be used at the end of a paragraph, and causes TeX to warn about the underfull box with badness 10000 (ie, the empty forced line) In this case, even without the \\ it is possible to make the insert one line less, if a tight fit is required.

enter image description here

\documentclass{article}

\usepackage{wrapfig}
\usepackage{graphicx}

\begin{document}

\begin{wrapfigure}{R}{2in}
% I would not expect any space at the top  but
\vspace{-\baselineskip}
\includegraphics[width=2in]{example-image-1x1.png}%
% never use \\ at end of paragraph\\
% TeX will give badness 10000 warning
\vspace{-\baselineskip}
\end{wrapfigure}
Zzzz zzz zzz zzz zzz zzz zzz zzz zzz zzz.
Zabc abc abc abc abc abc abc abc abc abc.
Zzzz zzz zzz zzz zzz zzz zzz zzz zzz zzz.
Zabc abc abc abc abc abc abc abc abc abc.
Zzzz zzz zzz zzz zzz zzz zzz zzz zzz zzz.
Zabc abc abc abc abc abc abc abc abc abc.
Zzzz zzz zzz zzz zzz zzz zzz zzz zzz zzz.
Zabc abc abc abc abc abc abc abc abc abc.
Zzzz zzz zzz zzz zzz zzz zzz zzz zzz zzz.
Zabc abc abc abc abc abc abc abc abc abc.
Zzzz zzz zzz zzz zzz zzz zzz zzz zzz zzz.
Zabc abc abc abc abc abc abc abc abc abc.
Zzzz zzz zzz zzz zzz zzz zzz zzz zzz zzz.
Zabc abc abc abc abc abc abc abc abc abc.
Zzzz zzz zzz zzz zzz zzz zzz zzz zzz zzz.
Zabc abc abc abc abc abc abc abc abc abc.
Zzzz zzz zzz zzz zzz zzz zzz zzz zzz zzz.
Zabc abc abc abc abc abc abc abc abc abc.
Zzzz zzz zzz zzz zzz zzz zzz zzz zzz zzz.
Zabc abc abc abc abc abc abc abc abc abc.
Zzzz zzz zzz zzz zzz zzz zzz zzz zzz zzz.
Zabc abc abc abc abc abc abc abc abc abc.
Zzzz zzz zzz zzz zzz zzz zzz zzz zzz zzz.
Zabc abc abc abc abc abc abc abc abc abc.
\end{document}
4
  • At the request of David Carlisle I have completely changed the question with an example, and this answer no longer applies to the current question. I probably should have just asked a new question, however did ask me to provide an example for this one, which was originally formulated around a conceptual question, instead of an example question.
    – AgilePro
    Commented Mar 21, 2021 at 0:59
  • Thanks, that is helpful. For the section head, the picture is still "too high" (the space between it and the previous paragraph is smaller than a regular section header without an image.) I would like to find a way to adjust the image position down. Then I can tweak the header position. (2) when used in regular paragraph, there is still extra space above the image (I know the space below can be adjusted manually). I appended to the question and new example file.
    – AgilePro
    Commented Mar 21, 2021 at 16:01
  • @AgilePro you can normally just use \vspace after \begin{wrapfig} but you hid that possibility with your macro, I already extended it once to allow the number of lines argument but stopped at that point. Oe similarly you may prefer to place teh wrapfig after the heading and then adjust teh image up slightly. Commented Mar 21, 2021 at 16:46
  • David: the \mbox approach does not work because in the case that the section header is at the top of the page, this causes them to start lower down. However, putting the image after the section head, and "raising" it up to the level of the header, and then manually setting the lines to reserve does seem to work in all three situations. I will post the final solution.
    – AgilePro
    Commented Mar 21, 2021 at 20:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .