1

I have wrapped a text around a circular figure. I need to horizontally adjust the position of the figure by bringing it to the middle of page with text circularly wrapped around it.

\hspace*{-5cm}\includegraphics... is not working. How can I do that?

\documentclass{article}
\usepackage{lipsum}
\usepackage{graphicx,wrapfig}
\begin{document}

\null\hfill\smash{
\raisebox{\dimexpr-\height+\baselineskip}{%
\includegraphics[width=2in]{magmag2.png}}}%
\par\vspace*{\dimexpr-\baselineskip-\parskip}% 
\parshape 12 0pt 0.7\textwidth
0pt \dimexpr0.5\textwidth+4.5\baselineskip\relax
0pt \dimexpr0.5\textwidth+3.75\baselineskip\relax
0pt \dimexpr0.5\textwidth+3.25\baselineskip\relax
0pt \dimexpr0.5\textwidth+3.00\baselineskip\relax
0pt \dimexpr0.5\textwidth+3.0\baselineskip\relax
0pt \dimexpr0.5\textwidth+3.20\baselineskip\relax
0pt \dimexpr0.5\textwidth+3.5\baselineskip\relax
0pt \dimexpr0.5\textwidth+4.25\baselineskip\relax
0pt \dimexpr0.5\textwidth+6.0\baselineskip\relax
0pt \dimexpr0.5\textwidth+6.75\baselineskip\relax
0pt \textwidth
\noindent\lipsum[1]
\end{document}

magmag2

enter image description here

Sebastiano
  • 54,118
Reza
  • 811
  • 1
    it isn't clear what you mean by "bring to the middle of the page"? your parshape is making the text to the left of the figure more than half the text width in all cases. So what do you want to be in the middle? it would be easier if you showed your current output then annotated it in an image editor to show what you want to move – David Carlisle Dec 24 '19 at 18:08
  • My apologies for the inaccurate question. I added a picture of what I am trying to achieve. @david-carlisle – Reza Dec 24 '19 at 19:36
  • 1
    you can't do that with wrapfig or \parshape as neither can make a gap mid-line, there are I think answers on site showing approaches to this, I'll see if i can find one... – David Carlisle Dec 24 '19 at 19:44
  • 1
    It is theoretically possible to do with \shapepar (shapepar package), but so far no joy. – John Kormylo Dec 24 '19 at 23:25
  • 2
    https://tex.stackexchange.com/a/34556/197451 – js bibra Dec 25 '19 at 01:30
  • I did not see this page before. It is simple and works great. I only had to add \tikzpicture. @js-bibra – Reza Dec 25 '19 at 05:58

2 Answers2

1

This is based of a hole radius of 1.1in to provide some margin. Note that lipsum has always been difficult to hyphenate.

I tried to set up \holeshape using pgfmath, but you can't use \edef. OTOH, it should be possible to write the definition to a file and read it back.

\documentclass{article}
\usepackage{lipsum}
\usepackage{shapepar}
\usepackage{tikz}
\usepackage{showframe}
\marginparsep=0.5in

\def\holeshape{{14.375}% h center
{0}b{0}\\
{0}t{0}{28.75}\\
{1}t{0}{11.566}st{17.184}{11.566}\\
{2}t{0}{10.029}t{18.721}{10.029}\\
{3}t{0}{9.0941}t{19.655}{9.0941}\\
{4}t{0}{8.4684}t{20.281}{8.4684}\\
{5}t{0}{8.0593}t{20.690}{8.0593}\\
{6}t{0}{7.836}t{20.924}{7.826}\\
{7}t{0}{7.750}t{20.999}{7.750}\\
{8}t{0}{7.836}t{20.924}{7.826}\\
{9}t{0}{8.0593}t{20.690}{8.0593}\\
{10}t{0}{8.4684}t{20.281}{8.4684}\\
{11}t{0}{9.0941}t{19.655}{9.0941}\\
{12}t{0}{10.029}t{18.721}{10.029}\\
{13}t{0}{11.566}jt{17.184}{11.566}\\
{14}t{0}{28.75}\\
{16}t{0}{28.75}\\
{16}e{28.75}}


\begin{document}
By using \verb|\baselineskip| as the scale, one can use $\sqrt{r^2-n^2}$ for $n=0,1,\dots$
to compute the offset startng at the center.

radius = \pgfmathparse{1.1in/\baselineskip}\pgfmathresult\par
text width = \pgfmathparse{\textwidth/\baselineskip}\pgfmathresult

\noindent\begin{tikzpicture}[overlay,baseline=(origin)]
  \coordinate (origin) at (0,3pt);% ad hoc fudge factor
  \draw (0.5\textwidth,-7\baselineskip) circle[radius=1in];
\end{tikzpicture}%
\shapepar[\baselineskip]{\holeshape}\lipsum[1]

\end{document}

demo

John Kormylo
  • 79,712
  • 3
  • 50
  • 120
0
\documentclass{article}
\usepackage{lipsum}
\usepackage{shapepar}
\usepackage{tikz}
%\usepackage{showframe}
\marginparsep=0.5in
\def\holeshape{{14.375}% h center
{0}b{0}\\
{0}t{0}{28.75}\\
{1}t{0}{11.566}st{17.184}{11.566}\\
{2}t{0}{10.029}t{18.721}{10.029}\\
{3}t{0}{9.0941}t{19.655}{9.0941}\\
{4}t{0}{8.4684}t{20.281}{8.4684}\\
{5}t{0}{8.0593}t{20.690}{8.0593}\\
{6}t{0}{7.836}t{20.924}{7.826}\\
{7}t{0}{7.750}t{20.999}{7.750}\\
{8}t{0}{7.836}t{20.924}{7.826}\\
{9}t{0}{8.0593}t{20.690}{8.0593}\\
{10}t{0}{8.4684}t{20.281}{8.4684}\\
{11}t{0}{9.0941}t{19.655}{9.0941}\\
{12}t{0}{10.029}t{18.721}{10.029}\\
{13}t{0}{11.566}jt{17.184}{11.566}\\
{14}t{0}{28.75}\\
{16}t{0}{28.75}\\
{16}e{28.75}}
\begin{document}
By using \verb|\baselineskip| as the scale, one can use $\sqrt{r^2-n^2}$ for 
$n=0,1,\dots$
to compute the offset starting at the center.
radius = \pgfmathparse{1.1in/\baselineskip}\pgfmathresult\par
text width = \pgfmathparse{\textwidth/\baselineskip}\pgfmathresult

\noindent\begin{tikzpicture}[overlay,baseline=(origin)]
\coordinate (origin) at (0,3pt);% ad hoc fudge factor
\fill [white] (0.5\textwidth,-7\baselineskip) circle[radius=1in];
\node[inner sep=0pt] (magmag2) at (6,-3)[opacity=1]
{\includegraphics[width=.4\textwidth]{magmag2.png}
};
\end{tikzpicture}%
\shapepar[\baselineskip]{\holeshape}\lipsum[1]
\end{document}

enter image description here

Reza
  • 811
  • 1
    Please keep in mind that imaginative layouts don't mix well with good typography. The space after "mauris." is horrendous and "fringilla" is nearly a margin note. Adding some like \usepackage[latin]{babel} \usepackage{microtype} \xspaceskip1ex\usepackage{microtype}\xspaceskip1ex to the preamble can mitigate these effects, but there are not fix for the annoying disrupt of the reading flow except remove the image. – Fran Dec 25 '19 at 09:22