[看撕碎的纸张:将撕碎的边缘拼接起来了解有关该主题的更多信息,以及最终产品的更好的说明。
我有一份文档,其中散布着很多来自另一本书的简短摘录。在它们周围加上框架看起来有点太“干净”了。我怎样才能获得“撕页”类型的效果,使其看起来像是从书中撕下来的摘录?(我偶尔在印刷书籍中看到过这种情况,尽管我现在找不到例子。)
我并不拘泥于某个特定的视角——谷歌搜索“撕页”给出了大量示例。但为了提供一些参考,以下是一些更好的示例:
http://www.vectorstock.com/i/composite/84,79/white-paper-rip-edge-vector-198479.jpg
http://lh6.ggpht.com/-eO-uRyGeA_0/TUkzCMuwuJI/AAAAAAAB6E/2och4rP0l88/386--x--277--torn-paper.jpg
(第二个例子中的强烈色彩可能有点太分散注意力,不适合实际使用,尽管作为一种选择它可能很有趣。我更感兴趣的是边缘效果。)
再次编辑:我尝试根据以下答案的更新版本排版我的文本。结果如下:
答案1
虽然不是你想要的结果,但可以作为一个起点。它结合framed
并tikz
打包。这个想法可以带来进一步的改进。
看http://www.texample.net/tikz/examples/framed-tikz/ (顺便说一下,我是作者)
更新:玩弄分形装饰的想法,以及阴影纸和模糊阴影,我得到了以下结果。目前实现仍然不使用framed
,因此它仅限于带框段落的情况页面间无断页。
\documentclass[a5paper]{article}
\usepackage{lipsum} % To generate test text
\usepackage{framed}
\usepackage{tikz}
\usepackage[margin=1cm]{geometry}% for screen preview
\usetikzlibrary{decorations.pathmorphing,calc,shadows.blur,shadings}
\pgfmathsetseed{1} % To have predictable results
% Define a background layer, in which the parchment shape is drawn
\pgfdeclarelayer{background}
\pgfsetlayers{background,main}
% This is the base for the fractal decoration. It takes a random point between the start and end, and
% raises it a random amount, thus transforming a segment into two, connected at that raised point
% This decoration can be applied again to each one of the resulting segments and so on, in a similar
% way of a Koch snowflake.
\pgfdeclaredecoration{irregular fractal line}{init}
{
\state{init}[width=\pgfdecoratedinputsegmentremainingdistance]
{
\pgfpathlineto{\pgfpoint{random*\pgfdecoratedinputsegmentremainingdistance}{(random*\pgfdecorationsegmentamplitude-0.02)*\pgfdecoratedinputsegmentremainingdistance}}
\pgfpathlineto{\pgfpoint{\pgfdecoratedinputsegmentremainingdistance}{0pt}}
}
}
% define some styles
\tikzset{
paper/.style={draw=black!10, blur shadow, shade=bilinear interpolation,
lower left=black!20, upper left=black!15, upper right=white, lower right=black!10},
irregular border/.style={decoration={irregular fractal line, amplitude=0.2},
decorate,
},
ragged border/.style={ decoration={random steps, segment length=7mm, amplitude=2mm},
decorate,
}
}
% Macro to draw the shape behind the text, when it fits completly in the
% page
\def\tornpaper#1{
\tikz{
\node[inner sep=1em] (A) {#1}; % Draw the text of the node
\begin{pgfonlayer}{background} % Draw the shape behind
\fill[paper] % recursively decorate the bottom border
decorate[irregular border]{decorate{decorate{decorate{decorate[ragged border]{
($(A.south east) - (0, random*5mm)$) -- ($(A.south west) - (0, random*5mm)$)
}}}}}
-- (A.north west) -- (A.north east) -- cycle;
\end{pgfonlayer}}
}
\begin{document}
\noindent
\tornpaper{
\parbox{.9\textwidth}{\lipsum[11]}
}
\bigskip
\noindent
\tornpaper{
\parbox{.9\textwidth}{\lipsum[15]}
}
\end{document}
笔记一些 pdf 查看器(例如 Sumatra)在显示最后示例中使用的插值阴影时遇到问题。
更新另请参阅相关问题撕碎的纸张:将撕碎的边缘拼接起来
答案2
编辑:根据要求添加颜色。
以下是 Marc van Dongen 对以下问题的回答模拟手绘线条。
\documentclass{memoir}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\definecolor{paper}{RGB}{239,227,157}
\usepackage{lipsum}
\begin{document}
\begin{tikzpicture}[pencildraw/.style={ %
decorate,
decoration={random steps,segment length=2pt,amplitude=1pt}
} %
]
\node[
preaction={fill=black,opacity=.5,transform canvas={xshift=1mm,yshift=-1mm}},
pencildraw,draw,fill=paper,text width=.8\textwidth,inner sep=5mm]
{\lipsum[1]};
\end{tikzpicture}
\end{document}
输出:
是的,这看起来确实不像纸。
答案3
我认为这将是tcolorbox
包裹。
在下面的答案中,我使用了部分Jesper 的回答装饰tcolorbox
环境;这种方法允许基于环境的方法,以便您可以使用,例如,
\begin{tornpage}
\lipsum
\end{tornpage}
此外,还tcolorbox
允许分页。
这是一个完整的、可供构建的 MWE。
% arara: pdflatex
% !arara: indent: {overwrite: on}
\documentclass{article}
\usepackage[many]{tcolorbox}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{shadows}
\definecolor{paper}{RGB}{239,227,157}
\usepackage{lipsum}
\newtcolorbox{tornpage}{%
enhanced jigsaw, breakable, % allow page breaks
frame hidden, % hide the default frame
overlay={%
\draw [
fill=paper, % fill paper
draw=paper!50!black, % boundary colour
decorate, % decoration
decoration={random steps,segment length=2pt,amplitude=1pt},
drop shadow, % shadow
]
% top line
(frame.north west)--(frame.north east)--
% right line
(frame.north east)--(frame.south east)--
% bottom line
(frame.south east)--(frame.south west)--
% left line
(frame.south west)--(frame.north west);
},
% paragraph skips obeyed within tcolorbox
parbox=false,
}
\begin{document}
\begin{tornpage}
\lipsum[1]
\end{tornpage}
\begin{tornpage}
\lipsum
\end{tornpage}
\end{document}