Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a decorative picture that I want to display on the right side current page. The picture should fill the whole vertical length of the text body (maybe even 1cm larger). The picture is long and narrow, so I imagine it to leave about 1/3rd on its right side for the text.

So a right sketch of the pages would look like that:

+------------------+  +------------------+  +------------------+ 
|                  |  |            \/\/\/|  |                  |
|  the quick brow  |  |  whole pag /\/\/\|  |  And This  page  |
|  n fox jumps ov  |  |  e. It  is \/\/\/|  |  has normal lay  |
|  er the lazy do  |  |  longer th /\/\/\|  |  out again.      |
|  g. Franz fährt  |  |  en one pa \/\/\/|  |                  |
|  im Taxi quer d  |  |  ge but co /\/\/\|  |                  |
|  urch Bayern. T  |  |  ntains  a \/\/\/|  |                  |
|  his is just  a  |  |  long tikz /\/\/\|  |                  |
|  standard  text  |  |  picture s \/\/\/|  |                  |
|  that fills the  |  |  omewhere. /\/\/\|  |                  |
|                41|  |            \/\/42|  |                43|
+------------------+  +------------------+  +------------------+ 

I use tikz to generate that picture:

\begin{tikzpicture} [scale=0.3,
    every node/.style={shape=circle, fill=black!30},
]

 \node at (17,-20) {};
 \node at (2,-19) {};
%...
 \node at (16,42) {};
 \node at (8,43) {};
 \node at (28,44) {}; % 20.4.2014
 \node at (13,45) {};
%...
 \node at (17,75) {};
 \node at (2,76) {};
 \node at (22,77) {};
 \node at (13,78) {};
 \node at (26,79) {};

\draw[draw=black!20,thick]
 (0,-20) -- (0,80)
 (14,-20) -- (14,80)
 (21,-20) -- (21,80)
 (28,-20) -- (28,80)
;

\path[draw=black!100,very thick,every node/.style={sloped,anchor=south,auto=false}]
 (7,-20) edge node {1.April} (7,80) % 1.4.
;

\path[draw=black!100,very thick,every node/.style={sloped,anchor=south,auto=false}]
 (-1,44) edge node {2014} (33,44) % 1.4.
;

\end{tikzpicture}
share|improve this question
    
There a couple of ways. You can use minipages, columns or something like wrapfig. –  John Kormylo Mar 1 at 16:07
1  
Do you want to adjust the text block dimensions for that page? If not, consider looking into the tikzpagenodes package that gives you anchors into the page to place your object. –  Werner Mar 1 at 16:29
    
@Werner The text should not run into the figure. So the current page's text should gat adjusted dimensions, yes –  towi Mar 1 at 16:32
    
@JohnKormylo With minipage/columns it looks as if I must know exactly how much text fits alongside the picture. LaTeX should be able to float as much text around it as needed. With wrapfig it looks like I have to place the first paragraph of the text together with where the graphic starts. But it does not look like its made for graphics that are as long as a whole page. –  towi Mar 1 at 16:42
    
I just tried using flowfram, but it doesn't seem to be able to change column widths in the middle of a paragraph. I can show you the code as an answer, even though it doesn't work right (if you are interested). –  John Kormylo Mar 1 at 18:12

3 Answers 3

up vote 4 down vote accepted

Here is a proof-of-concept:

enter image description here

\documentclass{article}
\usepackage{graphicx,tikzpagenodes,fancyhdr,changepage,lipsum}
\usetikzlibrary{calc}
\usepackage[margin=1in]{geometry}

\pagestyle{fancy}
\fancyhf{}% Clear header/footer
\renewcommand{\headrulewidth}{0pt}% No header rule
\fancyfoot[R]{\thepage}

% More condensed version of \parshape (http://tex.stackexchange.com/q/127504/5764)
\makeatletter
\def\newparshape{\parshape\@npshape0{}}
\def\@npshape#1#2#3{\ifx\\#3\expandafter\@@@npshape\else\expandafter\@@npshape\fi
  {#1}{#2}{#3}}
\def\@@npshape#1#2#3#4#5{%
  \ifnum#3>\z@\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
  {\expandafter\@@npshape\expandafter{\the\numexpr#1+1\relax}{#2 #4 #5}{\numexpr#3-1\relax}{#4}{#5}}%
  {\@npshape{#1}{#2}}}
\def\@@@npshape#1#2#3{#1 #2 }
\makeatother

\begin{document}

\lipsum[1-8]% Dummy text

\newparshape{2}{0pt}{\textwidth}{1}{0pt}{.7\textwidth}\\% Adjust paragraph shape
\lipsum[9]% Dummy text

\begin{adjustwidth}{0pt}{.3\textwidth}
\tikz[remember picture,overlay] {%
  \draw [blue,line width=2mm]
    ($(current page.south east)+(\dimexpr-\pdfpagewidth+\hoffset+1in+.75\textwidth,0)$)% 1in = margins
    rectangle
    (current page.north east)
;}%
\hspace*{\parindent}\lipsum[10-14]
\end{adjustwidth}

\newparshape{5}{0pt}{.7\textwidth}{1}{0pt}{\textwidth}\\% Re-establish regular flow of text
\lipsum[15-20]

\end{document}

The paragraph shape has to be adjusted specifically for the two paragraphs that break across the page boundary into and from the narrowed text block. For the text block spanning the narrowed page, I've used changepage's adjustwidth environment.

tikzpagenodes is used to identify nodes on the page to draw the blue rectangle. You should just complete that with your regular tikz image.

share|improve this answer
    
Seeing the difficulties at tex.stackexchange.com/questions/126203/…, I'm impressed. –  Steven B. Segletes Mar 1 at 18:11
    
Yes, that is truly amazing. To "manually" shape the breaking paragraphs is a drawback though. I would have to leave that for the very final version of the layout then. –  towi Mar 1 at 20:01
1  
    
@Werner I see. So, my wish to adjust the width of the "current page" is not only impossible because a) modifying it would change what fits on the current page and would pose a hen-before-the-egg-problem (similar to footnotes, I guess) no also b) TeX can not automatically handle changing text-widths in one paragraph. Well, well, alright. Great research. For the explanation why its not possible the cup goes to you. –  towi Mar 1 at 21:24
\documentclass{article}
\usepackage{graphicx,tikzpagenodes,fancyhdr,changepage,lipsum}
\usetikzlibrary{calc}
\usepackage[margin=1in]{geometry}

\begin{document}   
\lipsum[1-8]% Dummy text
\newgeometry{rmargin=2in}

\lipsum[9]% Dummy text

\tikz[remember picture,overlay] {%
  \draw [blue,line width=2mm]
    ($(current page.south east)+(\dimexpr-\pdfpagewidth+2in+0.9\textwidth,0)$)% 1in = margins
    rectangle (current page.north east);}%
\lipsum[10-14]
\restoregeometry

\lipsum[15-20]   
\end{document}

enter image description here

share|improve this answer
    
How do you create a multipage image? –  John Kormylo Mar 1 at 21:28
    
Looks like I have to put the \newgeometry/\restoregeometry manually in the right places. And a paragraph over a page break seems not doable this way. –  towi Mar 1 at 21:28
    
@towi: That is correct. While you can adjust the layout, it's done on a page-by-page basis with no mid-paragraph flow. flowfram could also be used to create similar output, but would still require some manual tweaking in terms of mid-paragraph flow adjustment. –  Werner Mar 1 at 21:37

You can make this work, but you have to insert \framebreak (between paragraphs) or \nopar (inside paragraphs) into the text at the right spots.

\documentclass{article}
 %\usepackage[margin=1in]{geometry}
\usepackage{flowfram}
\usepackage{tikz}
\usepackage{lipsum}

%framebreak within a paragraph
\newcommand{\nopar}{\parfillskip=0pt\framebreak\parfillskip=0pt plus1fil\noindent}

%calculate margins for page 2
\newsavebox{\myname}
\newlength{\mywidth}
\newlength{\myheight}
\newlength{\subwidth}
\newlength{\x}
\newlength{\y}

%compute distance from origin to right edge
\newlength{\rightside}
\setlength{\rightside}{\paperwidth}
\addtolength{\rightside}{-1in}
\addtolength{\rightside}{-\evensidemargin}

\sbox{\myname}{%
\begin{tikzpicture} [scale=0.25,%0.3 is bigger than the paper
    every node/.style={shape=circle, fill=black!30},
]

 \node at (17,-20) {};
 \node at (2,-19) {};
%...
 \node at (16,42) {};
 \node at (8,43) {};
 \node at (28,44) {}; % 20.4.2014
 \node at (13,45) {};
%...
 \node at (17,75) {};
 \node at (2,76) {};
 \node at (22,77) {};
 \node at (13,78) {};
 \node at (26,79) {};

\draw[draw=black!20,thick]
 (0,-20) -- (0,80)
 (14,-20) -- (14,80)
 (21,-20) -- (21,80)
 (28,-20) -- (28,80)
;

\path[draw=black!100,very thick,every node/.style={sloped,anchor=south,auto=false}]
 (7,-20) edge node {1.April} (7,80) % 1.4.
;

\path[draw=black!100,very thick,every node/.style={sloped,anchor=south,auto=false}]
 (-1,44) edge node {2014} (33,44) % 1.4.
;

\end{tikzpicture}}
\settowidth{\mywidth}{\usebox{\myname}}
\settoheight{\myheight}{\usebox{\myname}}

%calculate column widths, etc.
\setlength{\y}{\textheight}
\addtolength{\y}{-\myheight}

\setlength{\x}{\rightside}
\addtolength{\x}{-\mywidth}
\setlength{\subwidth}{\x}
\addtolength{\subwidth}{-5pt}%margin

%create frames

\newflowframe[1,3]{\textwidth}{\textheight}{0pt}{0pt}
\newflowframe[2]{\subwidth}{\textheight}{0pt}{0pt}
\newstaticframe[2]{\mywidth}{\myheight}{\x}{0.5\y}[mylabel]
\setstaticcontents*{mylabel}{\usebox{\myname}}

\begin{document}
\lipsum[1-5]
\framebreak

\lipsum[6-8]

Morbi luctus, wisi viverra faucibus pretium, nibh est placerat odio, nec com-
modo wisi enim eget quam. Quisque libero justo, consectetuer a, feugiat vitae,
porttitor eu, libero. Suspendisse sed mauris vitae elit sollicitudin malesuada.
Maecenas ultricies eros sit amet ante. Ut venenatis velit. Maecenas sed mi eget
dui varius euismod. Phasellus aliquet volutpat odio. Vestibulum ante ipsum
primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque\nopar
sit
amet pede ac sem eleifend consectetuer. Nullam elementum, urna vel imperdiet
sodales, elit ipsum pharetra ligula, ac pretium ante justo a nulla. Curabitur
tristique arcu eu metus. Vestibulum lectus. Proin mauris. Proin eu nunc eu
urna hendrerit faucibus. Aliquam auctor, pede consequat laoreet varius, eros
tellus scelerisque quam, pellentesque hendrerit ipsum dolor sed augue. Nulla
nec lacus.

\lipsum[10-12]

\end{document}

multipage image

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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