如何绘制特殊的复古边框装饰

如何绘制特殊的复古边框装饰

你好,我想做一些类似这个图片的事情: 在此处输入图片描述

我的目标是让四个装饰物像图片中那样位于角落,并在边框上装饰它们。我使用以下代码制作了角落中的装饰物:

%% [ESO-PIC & PGFORNAMENT ] %%
\newcommand\AtPageUpperRight[1]{\AtPageUpperLeft{%
 \put(\LenToUnit{\paperwidth},\LenToUnit{0\paperheight}){#1}%
 }}%
\newcommand\AtPageLowerRight[1]{\AtPageLowerLeft{%
 \put(\LenToUnit{\paperwidth},\LenToUnit{0\paperheight}){#1}%
 }}%


\AddToShipoutPictureBG{%
   \AtPageUpperLeft{\put(5,-30){\pgfornament[width=1.75cm]{61}}}
   \AtPageUpperRight{\put(-55,-30){\pgfornament[width=1.75cm,symmetry=v]{61}}}
   \AtPageLowerLeft{\put(5,30){\pgfornament[width=1.75cm,symmetry=h]{61}}}
   \AtPageLowerRight{\put(-55,30){\pgfornament[width=1.75cm,symmetry=c]{61}}}
   }

尽管如此,我还是很难画出漂亮的边框:如图所示,主边框比第二个边框更粗。角落里的边框变成了我不知道如何复制的形状;而且它们与角落里的装饰物有些对齐。而且较细的边框与装饰物结合在一起,有明显的小圆环。

我被所有的绘画弄得不知所措,真的不知道该怎么做;非常欢迎大家提供帮助!

我更喜欢乳胶绘制的矢量版本,而不是放置在页面上的图像。

我希望我已经表达清楚了,提前谢谢大家,祝大家周日愉快:)

答案1

因此,我学习了 tikz 并做了以下事情:

在此处输入图片描述

对结果很满意:)

我的代码基于 esdd 的答案邮政。

\documentclass{article}
\usepackage[margin=4cm,a4paper]{geometry}
\usepackage[object=vectorian]{pgfornament}
\usepackage{xfp}
\usetikzlibrary{calc}
\usepackage{blindtext}
\usepackage[manualmark]{scrlayer-scrpage}
% scrlayer-scrpage %
\clearpairofpagestyles
\addtokomafont{pagehead}{\color{blue!50!green!80!black}\large}
\chead*{The current page style is \toplevelpagestyle{} \ifstr{\toplevelpagestyle}{\currentpagestyle}{}{as alias for \currentpagestyle}.}
\cfoot*{\pagemark}


\newcommand\om{5mm}% ornament margin
\newcommand\ow{2cm}% ornament width
\newcommand\oh{2cm}% ornament height
\newcommand\ols{0mm}% ornament line shift %1.5mm
\newcommand\on{63}% ornament number
\newcommand\magicOrnamentOffset{0.25cm}

\def\lencorner{2}
\def\lencornerdivtwo{\fpeval{\lencorner/{2}}}
\def\lencornerdivthree{\fpeval{\lencorner/{3}}}
\newcommand\lencornerdivthreecm{\lencornerdivthree cm}
\newcommand\lencornerdivtwocm{\lencornerdivtwo cm}


\colorlet{bordercolor}{black}
\tikzset{mainborder/.style={line width=0.65mm}}
\tikzset{thinborder/.style={line width=0.2mm}}

% define the border and save it in a box
\newsavebox\border
\sbox\border{%
\tikz[color=bordercolor]{
  \useasboundingbox(0,0)rectangle(\paperwidth,-\paperheight);
  
  % ornaments %
  \foreach[count=\i]\a/\p/\s in {%
  north west/{\om,-\om}/none,
  north east/{{\paperwidth-\om},-\om}/v,
  south east/{{\paperwidth-\om},{-\paperheight+\om}}/c,%
  south west/{\om,{-\paperheight+\om}}/h%
  }\node[anchor=\a](n\i) at (\p){\pgfornament[width=\ow,height=\oh, symmetry=\s]{\on}};

  \begin{scope}[mainborder]
    %% lines %%
    \draw ([yshift=-\ols]n1.north east) -- ([yshift=-\ols]n2.north west);
    \draw ([xshift=-\ols]n2.south east) -- ([xshift=-\ols]n3.north east);
    \draw ([yshift=\ols]n3.south west) -- ([yshift=\ols]n4.south east) ;
    \draw ([xshift=\ols]n4.north west) -- ([xshift=\ols]n1.south west);
    %% corners %%
    % top left %
    \coordinate (B) at ([xshift=-\lencornerdivthreecm, yshift=-\lencornerdivthreecm]n1.north east);
    \coordinate (C) at ([xshift=\lencornerdivthreecm, yshift=-\lencornerdivthreecm]n1.north west);
    \draw (n1.south west) arc (180:90:\lencornerdivthree) -- (C) -- (B) arc (180:90:\lencornerdivthree);
    % bottom left %
    \coordinate (Y) at ([xshift=\lencornerdivthreecm, yshift=\lencornerdivthreecm]n4.south west);
    \coordinate (Z) at ([xshift=-\lencornerdivthreecm, yshift=\lencornerdivthreecm]n4.south east);
    \draw (n4.north west) arc (180:270:\lencornerdivthree) -- (Y) -- (Z) arc (180:270:\lencornerdivthree);
    % top right %
    \coordinate (S) at ([xshift=-\lencornerdivthreecm, yshift=-\lencornerdivthreecm]n2.north east);
    \coordinate (T) at ([xshift=-\lencornerdivthreecm, yshift=\lencornerdivthreecm]n2.south east);
    \draw (n2.north west) arc (90:0:\lencornerdivthree) -- (S) -- (T) arc (90:0:\lencornerdivthree);
    % bottom right %
    \coordinate (F) at ([xshift=-\lencornerdivthreecm, yshift=-\lencornerdivthreecm]n3.north east);
    \coordinate (G) at ([xshift=-\lencornerdivthreecm, yshift=\lencornerdivthreecm]n3.south east);
    \draw (n3.south west) arc (-90:0:\lencornerdivthree) -- (G) -- (F) arc (-90:0:\lencornerdivthree);
  \end{scope}

  %% [thin borders] %%
  \begin{scope}[thinborder]
    % top left
    \coordinate (topLeftBottom) at ([xshift=\ols+3mm, yshift=-3mm]n1.south west); %down
    \coordinate (topLeftTop) at ([xshift=3mm, yshift=\ols-3mm]n1.north east); %up
    \coordinate (topLeftCenter) at ([yshift=-\lencornerdivtwocm-\magicOrnamentOffset, xshift=\lencornerdivtwocm+\magicOrnamentOffset]n1.north west);
    % bottom left
    \coordinate (bottomLeftBottom) at ([xshift=+3mm, yshift=\ols+3mm]n4.south east);
    \coordinate (bottomLeftTop) at ([xshift=\ols+3mm, yshift=3mm]n4.north west);
    \coordinate (bottomLeftCenter) at ([yshift=\lencornerdivtwocm+\magicOrnamentOffset, xshift=\lencornerdivtwocm+\magicOrnamentOffset]n4.south west);
    % bottom right
    \coordinate (bottomRightBottom) at ([xshift=-3mm, yshift=\ols+3mm]n3.south west);
    \coordinate (bottomRightTop) at ([xshift=-\ols-3mm, yshift=3mm]n3.north east);
    \coordinate (bottomRightCenter) at ([yshift=\lencornerdivtwocm+\magicOrnamentOffset, xshift=-\lencornerdivtwocm-\magicOrnamentOffset]n3.south east); 
    % top right
    \coordinate (topRightBottom) at ([xshift=\ols-3mm, yshift=-\ols-3mm]n2.south east);
    \coordinate (topRightTop) at ([xshift=-\ols-3mm, yshift=-\ols-3mm]n2.north west);
    \coordinate (topRightCenter) at ([yshift=-\lencornerdivtwocm-\magicOrnamentOffset, xshift=-\lencornerdivtwocm-\magicOrnamentOffset]n2.north east); 
    %% lines %%
    \draw (topLeftTop) -- (topRightTop); % top
    \draw (bottomRightBottom) -- (bottomLeftBottom) ; % bottom 
    \draw (topRightBottom) -- (bottomRightTop); % right
    \draw (bottomLeftTop) -- (topLeftBottom); % left 
    %% top left %%
    % loops %
    \draw (topLeftBottom) arc (180:0:0.2) arc (0:-180:0.1) coordinate (topLeftLower); % bottom
    \draw (topLeftTop) arc (90:270:0.2) arc (-90:90:0.1) coordinate (topLeftUpper); %top
    % brackets to center %
    \draw (topLeftCenter) to [in=90, out=280] (topLeftLower); % left
    \draw (topLeftUpper) to [in=0, out=175] (topLeftCenter); % right
    %% bottom left %%
    % loops %
    \draw (bottomLeftBottom) arc (270:90:0.2) arc (90:-90:0.1) coordinate (bottomLeftLower);
    \draw (bottomLeftTop) arc (-180:0:0.2) arc (0:180:0.1) coordinate (bottomLeftUpper);
    % brackets to center %
    \draw (bottomLeftCenter) to [in=175, out=0] (bottomLeftLower); % left
    \draw (bottomLeftUpper) to [in=90, out=280] (bottomLeftCenter); % right
    %% bottom right %%
    %% loops %%
    \draw (bottomRightBottom) arc (-90:90:0.2) arc (90:270:0.1) coordinate (bottomRightLower);
    \draw (bottomRightTop) arc (0:-180:0.2) arc (180:0:0.1) coordinate (bottomRightUpper);
    %% brackets to center %
    \draw (bottomRightCenter) to [in=0, out=175] (bottomRightLower);
    \draw (bottomRightUpper) to  [in=90, out=280] (bottomRightCenter);
    %% top right %%
    % loops %
    \draw (topRightBottom) arc (0:180:0.2) arc (-180:0:0.1) coordinate (topRightLower);
    \draw (topRightTop) arc (90:-90:0.2) arc (270:90:0.1) coordinate (topRightUpper);
    % brackets to center %
    \draw (topRightCenter) to [in=90, out=280] (topRightLower);
    \draw (topRightUpper) to  [in=175, out=0] (topRightCenter);
  \end{scope}
}}


% define a switch to enable and disable the border
\newif\ifBorder
% define a new layer
\DeclareNewLayer[{%
    background,
    page,
    contents={\ifBorder\usebox\border\fi}
  }]{border.bg}
% add the border layer to all layer page styles (scrheadings, plain, empty, ...) ...
\AddLayersAtBeginOfPageStyle{@everystyle@}{border.bg}
% but no border on empty pages 
\AddToLayerPageStyleOptions{empty}{oninit=\Borderfalse}

\begin{document}
\Bordertrue

\Blindtext
\clearpage

\pagestyle{empty}
\Blindtext[10]
\clearpage

\pagestyle{plain}
\Blindtext
\end{document}

如果需要的话,请随时提问,如果有人知道更好的方法或者如何改进我的代码,请随时解释:)

答案2

这篇文章可能会有所帮助。

https://tug.org/TUGboat/tb32-2/tb101glister.pdf

它是讨论 LaTeX(和其他)各个方面的文章集之一。

相关内容