如何在当前页面的侧面排列一张大图片?

如何在当前页面的侧面排列一张大图片?

我有一张装饰图片,想显示在当前页面的右侧。图片应该填满整个文本主体的垂直长度(甚至可能大 1 厘米)。图片又长又窄,所以我想在右侧留出大约 1/3 的空间给文本。

因此,页面的正确草图将如下所示:

+------------------+  +------------------+  +------------------+ 
|                  |  |            \/\/\/|  |                  |
|  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|
+------------------+  +------------------+  +------------------+ 

我使用 tikz 来生成该图片:

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

答案1

以下是一个概念证明:

在此处输入图片描述

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

段落形状必须针对跨页面边界的两个段落进行专门调整,这两个段落进入和离开缩小的文本块。对于跨越缩小页面的文本块,我使用了changepageadjustwidth环境。

tikzpagenodes用于识别页面上的节点以绘制蓝色矩形。您只需使用常规tikz图像完成该操作即可。

答案2

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

在此处输入图片描述

答案3

您可以完成这项工作,但您必须在文本的正确位置插入 \framebreak(在段落之间)或 \nopar(在段落内)。

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

多页图像

相关内容