11

Consider the following code and output.

\documentclass{article}
    \usepackage{lipsum}
    \usepackage{graphicx}
    \usepackage{wrapfig}

\begin{document}
    \begin{wrapfigure}{o}{0.5\textwidth}
        \centering
        \includegraphics[width=2in]{image.png}
    \end{wrapfigure}
    \noindent\lipsum[1]
\end{document}

Output

How can I have the text follow the gradient of the triangle in the image?

10

\parshape can be used in the following setup:

enter image description here

\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{graphicx,wrapfig}% http://ctan.org/pkg/{graphicx,wrapfig}

\begin{document}
\begin{wrapfigure}{o}{0.5\textwidth}
  \centering
  \includegraphics[width=2in]{triangle.png}
\end{wrapfigure}
\noindent\lipsum[1]

\null\hfill\smash{% Place image with adjustment for height/depth
  \raisebox{\dimexpr-\height+\baselineskip}{%
    \includegraphics[width=2in]{triangle.png}}}%
\par\vspace*{\dimexpr-\baselineskip-\parskip}% Correct for following paragraph

% \parshape <num lines> <indent> <width> ...
\parshape 12 0pt 0.5\textwidth
0pt \dimexpr0.5\textwidth+\baselineskip\relax
0pt \dimexpr0.5\textwidth+0.75\baselineskip\relax
0pt \dimexpr0.5\textwidth+1.5\baselineskip\relax
0pt \dimexpr0.5\textwidth+2.25\baselineskip\relax
0pt \dimexpr0.5\textwidth+3.0\baselineskip\relax
0pt \dimexpr0.5\textwidth+3.75\baselineskip\relax
0pt \dimexpr0.5\textwidth+4.5\baselineskip\relax
0pt \dimexpr0.5\textwidth+5.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}

For a more programmatic way at dealing with this, you could use Xfig. For such an approach, see

or other, related posts:

  • What package is able to wrap text around more complex shapes, such as i.imgur.com/MsbsOVG.png or i.imgur.com/Apq8kdv.png or i.imgur.com/GxllBgA.png easier? I mean automatically wrapping around a shape without manually specifying coordinates for each line. – skan Feb 7 '17 at 19:26
  • 1
    @skan: For that you'll have to create the shape and introduce the line widths to TeX to be used within a \parshape macro; something similar to Very specific paragraph shape and Text wrap with shapepar (insert image between text). The latter example showcases the use of XFig to draw the shape and export it using fig2dev. This should work via cygwin on Windows. – Werner Feb 7 '17 at 19:49
  • I had already seen that threads, but I expected to find an easier or more automatic solution. – skan Feb 7 '17 at 20:43
  • @skan: Yes, automation is what everyone's after. TeX isn't the same as Word that provides a WYSIWIG GUI-style interface. You'll have to program the content, and that's why you need to do it that way. AFAIK, there exists no (La)TeX package that can do this automatically. Perhaps in other languages... – Werner Feb 7 '17 at 20:49
  • I was thinking more in software like Indesign – skan Feb 8 '17 at 0:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.