如何调整包装图形的水平位置?

如何调整包装图形的水平位置?

我将文本环绕在圆形图形周围。我需要水平调整图形的位置,将其移至页面中间,并将文本环绕在图形周围。

\hspace*{-5cm}\includegraphics... 不起作用。我该怎么做?

\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

在此处输入图片描述

答案1

这是基于 1.1 英寸的孔半径来提供一些余量。请注意,lipsum 一直很难用连字符连接。

我尝试使用 pgfmath 进行设置\holeshape,但不能使用\edef。另一方面,应该可以将定义写入文件并将其读回。

\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}

演示

答案2

\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}

在此处输入图片描述

相关内容