11

I would like to have a picture that covers half of the page. The text should be in the rest area of the page. See attached picture, worth thousand words... Can somebody help me?

Update: I want only one page of this style, the previous and next pages are "normal", it means without picture, full text witdth. The text should flow from previous page, continue on this "special" page and continue to flow to next page.

Every solution I was able to find was based on condition that if you change page layout, the explicit or implicit page break is done. As I want the text to flow from previous page, those solutions were not usable.

Update2: As inserting a picture is not problem, the question could be reduced to this: How to let the text flow between pages of different layout (different text width)? (Maybe "flowfram" package could help. But I think it is not possible to mix text flow between "main" document and a flow-frame on single page in the middle of document (?))

wanted result

4
  • 2
    how you code it depends what you want to happen at the page break, is each page like this with text flowing from one to another, or do you want a separate minipage of text with either one page or manual page breaking? Commented Dec 3, 2013 at 20:46
  • 1
    Please provide more details about the specifications of the document you are going to produce. One can possibly use a combination of the geometry package and background package or the changepage package and the background package to achieve what you want. The eso-pic package is another possiblity.
    – azetina
    Commented Dec 3, 2013 at 20:51
  • There are many ways to accomplish the displayed, however implementation that will suit you best depends on the structure of entire document. Is this a one-off page, or all pages are like that etc? What margins are acceptable?
    – ajeh
    Commented Dec 3, 2013 at 21:06
  • I thought that something like "\thispagestyle" would be the way, but the page style cannot change the text width as far as I know. Maybe I'm wrong?
    – Jakub
    Commented Dec 4, 2013 at 10:06

3 Answers 3

6

There are two things here

  1. You want this only for one page. You can use a minipage
  2. You want it for all pages. You can use background package.

Only for one page

\documentclass[a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{calc}

\usepackage{kantlipsum}
\usepackage[a4paper,left=1in,right = 1in,top = 1in,bottom=1in]{geometry}
%\pagestyle{empty}
\begin{document}
\noindent
\begin{minipage}[t]{.5\linewidth}
\kant[1-3]
\end{minipage}
\begin{tikzpicture}[remember picture,overlay]
\node[anchor =north east, inner sep=0pt,outer sep=0pt] at (current page.north east) {\includegraphics[width=0.45\paperwidth,height=\paperheight]{example-image-a}};
\end{tikzpicture}

\end{document}

enter image description here

For all pages

This uses background package and a same image for all pages. You can choose different images if you like but I will leave it to you. For details refer background documentation (texdoc background from command line/prompt or visit www.texdoc.net)

\documentclass[a4paper]{article}
\usepackage{background}
\usetikzlibrary{calc}
\backgroundsetup{%
scale=1,
angle=0,
opacity=1,  %% adjust
contents={
\begin{tikzpicture}[remember picture,overlay]
\node[anchor =north east, inner sep=0pt,outer sep=0pt] at (current page.north east) {\includegraphics[width=0.45\paperwidth,height=\paperheight]{example-image-a}};
\end{tikzpicture}
}
}

\usepackage{kantlipsum}
\usepackage[a4paper,left=1in,right = 0.5\paperwidth,top = 1in,bottom=1in]{geometry}
%\pagestyle{empty}
\begin{document}
  \kant[1-100]
\end{document}

This will take at least 2-3 compilations to stabilize.

enter image description here

5
  • +1 for kantlipsum :) I hate it that kantlipsum doesn't come with standard TeX distro :(
    – Herr K.
    Commented Dec 4, 2013 at 1:07
  • @KevinC Thanks. But it comes IIRC. :-)
    – user11232
    Commented Dec 4, 2013 at 1:23
  • It's not in MikTeX 2.9...
    – Herr K.
    Commented Dec 4, 2013 at 1:41
  • @KevinC It's there in my installation. Check the package manager. :-) You know the author, he is the topper here ;-)
    – user11232
    Commented Dec 4, 2013 at 1:46
  • I just updated the question - I need a text continuously flowing from previous page, which is without picture etc...
    – Jakub
    Commented Dec 4, 2013 at 9:52
1

This more a non-answer than an answer, but anyway...

I think that what you want is not possible unless some additional constraints are made on the text which "flows" into that page.

Imagine that the last page before the one with the picture ends with a paragraph which does not fit in the page, and thus TeX decides to break it at some appropiate line. The width of that paragraph should then change in the middle of the paragraph, because the first half of it (in one page) is "full width", but the second half is going to appear in the page with the picture, and thus it should be "half-width".

So your problem is related to this question, about changing the width of a paragraph in the middle of it. And the answer there concludes that this is not something that TeX could do. Perhaps LuaTeX, but even then it would be hard.

The problem is that the height of the paragraph depends on its width, so TeX has to "typeset in his mind" (in fact in a box) the whole paragraph with a given width, to know its height and thus if it fits in the page, and then break at the appropiate line, but then it cannot "undo" the already done typesetting (in theory the box could be unboxed, but not easily, see the aforementioned question).

You can see this effect in the following naive approach (which does not work, but it is close).

The following code uses \afterpage to wait until the current page is full, and then insert commands to draw the picture and reduce the \hsize for the next page. It also inserts another \afterpage in the next page, to restore the altered \hsize:

\documentclass[a4paper]{article}
\usepackage{tikz}
\usepackage{afterpage}
\usetikzlibrary{calc}

\usepackage{kantlipsum}
\usepackage[a4paper,left=1in,right = 1in,top = 1in,bottom=1in]{geometry}
%\pagestyle{empty}
\begin{document}
\kant[1-3]
\kant[1-3]

% I want the picture in the next page:
\afterpage{\clearpage%
  \global\hsize=.5\linewidth%
  \afterpage{\clearpage\global\hsize=2\hsize}%
  \begin{tikzpicture}[remember picture,overlay]
  \node[anchor =north east, inner sep=0pt,outer sep=0pt] 
     at (current page.north east) 
       {\includegraphics[width=0.45\paperwidth, height=\paperheight]
       {example-image-a}};
  \end{tikzpicture}%
}
\kant[1-3]
\kant[1-3]
\kant[1-3]
\kant[1-3]
\kant[1-3]
\end{document}

Note how the change of width happens, but not before the "current paragraph" is finished:

Page1 -- Page2 -- Page3

0

Currently I'm using hand-crafting approach. First I typeset the document without the picture and then I use \hsize for paragraphs that are fully narrow and combination of \hangindent, \hangafter for paragraphs that are partially noarrower. In this case I must manually specify how many lines of which paragraph are indented.

For the picture I used package "textpos" ( \begin{textblock*} ) which puts a picture independently on the page content (like on the "background" of the page).

So this approach is not usable for automatic typesetting and I must do it as last step of document preparation. But at least I'm able to produce nice CMYK PDF of a book for the print shop, which is my main goal :-)

Thank you for your responses.

2
  • You are still not mentioning how many times in the document you want to use this layout :(
    – ajeh
    Commented Dec 4, 2013 at 19:21
  • I want this for only one page of about fifty in total. Somewhere in the middle of the document - see updated question text.
    – Jakub
    Commented Dec 4, 2013 at 21:23

You must log in to answer this question.

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