I have a square logo placed on the bottom right of every page (placed using absolute positioning and tikz) and it's fairly big. I want it so that text flows / wraps around the logo – is it possible to this?
For example, I want to have something like the following where (a
is text and l
is logo)
+--------------+
| aaaaaaaaaaaa |
| aaaaaaaaaaaa |
| aaaaaaaaaaaa |
| aaaaa +------+
| aaaaa | llll |
| aaaaa | llll |
+------ +------+
Edit, here is an example of what I have with overlapping text and logo:
\documentclass{article}
\usepackage[letterpaper,margin=1in]{geometry}
\usepackage{tikz}
\usepackage{lipsum}
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
\node [shift={(-2 in, 2 in)}] at (current page.south east) {
\rule{2in}{2in}
};
\end{tikzpicture}
\lipsum[1-8]
\end{document}
This generates the following document
You will notice that the block on the bottom right overwrites some of the text and I would like to avoid that by having it wrap around it. The logo is large, so I do not want it taking up the footer space.
Best Answer
You can use
\parshape
to specify an irregular paragraph shape to which the subsequent paragraph should adhere to. This only holds for the subsequent paragraph, and should be redefined for the following one. This is viable since the image is small enough that so that at most two paragraphs would probably be "affected" by the addition of the logo.Since
\parshape
applies to a specific paragraph, and paragraphs depend on the document contents, it would be very difficult to automate this procedure. Remember that you are producing the logo as atikz
overlay
, so TeX would have no idea that there's "something" at the time of typesetting. However, on a manual basis, there is no problem in wrapping around the logo.Here is an MWE:
\parshape=<n> <i1> <l1> <i2> <l2> ...
sets the linei
ndents andl
ine widths for the following<n>
lines in a paragraph. If the paragraph continues past<n>
lines, it uses the last set<i> <l>
pair.For the first paragraph with adjusted formatting, two lines are formatted (
\parshape=2
): First line hasi
ndent0pt
andl
ine width\linewidth
while the second and subsequent lines havei
ndent0pt
andl
ine width\linewidth-2in-1ex
, which leaves a1ex
gap between the logo boundary and the text.For the second paragraph that requires adjusted formatting, five lines are formatted (
\parshape=5
): Four lines havei
ndent0pt
andl
ine width\linewidth-2in-1ex
, and the last and subsequent lines havei
ndent0pt
andl
ine width\linewidth
, restoring the traditional paragraph shape.