寻找一种用于信件的特殊纸张样式

寻找一种用于信件的特殊纸张样式

我正在寻找一种特殊的纸张样式。它应该是一张背景好看的纸张,这样我就可以在上面写字。理想情况下,它应该是像附图这样的样式。

我希望拥有的一些主要功能:

  1. 纸张大小可调。如A4或Letter;
  2. 纸张边缘的装饰。南、北、西、东的装饰应自动调整为纸张大小;
  3. 水平网格线。网格线间距应可调整。文本(无图片)应自动调整/对齐到这些网格;
  4. 文本对齐至少应有两种选项,一种是居中对齐,另一种是底部对齐。

理想的纸张样式

平均能量损失

这是我的丑陋代码,请不要笑。

%!TEX program = latex
%!TEX encoding = UTF-8 Unicode

\documentclass{article}
\usepackage[letterpaper, top=0in, bottom=0in, left=0in, right=0in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc} 
\usepackage{concrete}  
\PassOptionsToPackage{dvipsnames,svgnames}{xcolor}
\usepackage[object=vectorian]{pgfornament}
\usepackage{lipsum}
\usetikzlibrary{shapes.multipart}
\usepackage{adjustbox}
\usepackage{setspace}

\begin{document}
\pagenumbering{gobble}% Remove page numbers (and reset to 1)
\begin{center} 

%\begin{tikzpicture}[color=black!60,transform shape,scale=1, 
%                     every node/.style={inner sep=0pt}]
\begin{tikzpicture}[xshift=0cm,yshift=-13.6cm,color=black!60,scale=1,overlay]
\node[minimum width=21.2cm,minimum height=27.7cm,fill=gray!0,inner sep=0pt](vecbox){}; 
\node[anchor=north west] at (vecbox.north west){\pgfornament[color=MidnightBlue,width=2cm]{39}};
\node[anchor=north east] at (vecbox.north east){\pgfornament[color=MidnightBlue,width=2cm,symmetry=v]{39}};
\node[anchor=south west] at (vecbox.south west){\pgfornament[color=MidnightBlue,width=2cm,symmetry=h]{39}};
\node[anchor=south east] at (vecbox.south east){\pgfornament[color=MidnightBlue,width=2cm,symmetry=c]{39}};
 \node[anchor=north,yshift=2pt] at (vecbox.north){\pgfornament[width=16cm,symmetry=h]{88}};
 \node[anchor=south,yshift=-2pt] at (vecbox.south){\pgfornament[width=16cm]{88}};
 \node[anchor=north,rotate=90,yshift=2pt]  at (vecbox.west){\pgfornament[width=23cm,symmetry=h]{88}};
 \node[anchor=north,rotate=-90,yshift=2pt] at (vecbox.east){\pgfornament[width=23cm,symmetry=h]{88}};

 \foreach \y in {-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}
    \draw[black!40] (-9cm,1.6*\y cm) -- (9cm,1.6*\y cm);
\end{tikzpicture} 

\end{center}

\begin{center}
\adjustbox{padding*=0ex 0ex 0ex 19.5ex,margin*=0ex 0ex 0ex 0ex}{
\begin{minipage}[b]{0.8\textwidth}
\Large
{\setstretch{2.54}\color{black}
\lipsum[1]
}
\end{minipage}
}
\end{center}


\end{document}

这是结果的pdf。英文字母

这是一封竖式的中文字。繁体中文信件

答案1

我不确定您正在寻找什么样的建议,因为正如其他人所说,您现有的代码已经令人印象深刻。

我稍微调整了一下,让它与包一起工作,并background尝试让它更灵活一些。代码使用 2 个命令:每个命令都接受 1 个参数,指定相关的装饰。宽度和长度是自动计算的(尽管您可能希望调整公式)。我还设置了一些标准颜色,以便将您需要定义的所有内容放在一个地方。\CornerOrn{}\OtherOrn{}

基本上,布局设置如下:

\colorlet{CornerColor}{MidnightBlue}
\colorlet{MainColor}{black!60}
\colorlet{LineColor}{black!40}
\CornerOrn{39}
\OtherOrn{88}

其余的只是背景。

要将文本对齐到底部,您只需要一个minipage具有适当对齐方式的全宽。此解决方案不需要adjustbox或类似,因为使用geometry允许您指定边距等。(我scale=.8在下面的示例中使用了。)

但是,这并不能自动计算行距。我不太清楚你想在那里做什么,或者如何才能最好地做到这一点。这基本上是因为各种长度之间的关系让我感到困惑,我不知道如何消除我的困惑!

我确信,无论如何,这是一种极其低效的做事方式……

花式框架

%!TEX program = latex
%!TEX encoding = UTF-8 Unicode

\documentclass{article}
\usepackage[letterpaper, scale=.8]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{concrete}
\PassOptionsToPackage{dvipsnames,svgnames}{xcolor}
\usepackage[object=vectorian]{pgfornament}
\usepackage{lipsum}
\usepackage{tikzpagenodes, calc}
\usetikzlibrary{calc}
\usepackage{setspace}
\colorlet{CornerColor}{MidnightBlue}
\colorlet{MainColor}{black!60}
\colorlet{LineColor}{black!40}
\gdef\cornerorn{39}
\newlength{\cornerwidth}
\newlength{\testa}
\setlength\testa{\paperwidth-\textwidth}
\newlength{\testb}
\setlength\testb{\paperheight-\textheight}
\ifdim\testa>\testb
  \setlength\cornerwidth{.5\testb}
\else
  \setlength\cornerwidth{.5\testa}
\fi
\newlength{\horizwidth}
\setlength{\horizwidth}{\paperwidth-2\cornerwidth-10pt}
\newlength{\vertwidth}
\setlength{\vertwidth}{\paperheight-2\cornerwidth-10pt}
\newcommand*{\CornerOrn}[1]{\gdef\cornerorn{#1}}
\newcommand*{\OtherOrn}[1]{\gdef\otherorn{#1}}
\CornerOrn{39}
\OtherOrn{88}
\newlength{\testc}
\settoheight\testc{\pgfornament[width=\vertwidth]{\otherorn}}
\usepackage[scale=1, opacity=1, angle=0]{background}
  \backgroundsetup{%
    contents={%
      \begin{tikzpicture}[color=MainColor, remember picture, overlay]
        \node[anchor=north west] at (current page.north west){\pgfornament[color=CornerColor,width=\cornerwidth]{\cornerorn}};
        \foreach \i/\j in {north east/v, south west/h, south east/c}
          \node[anchor=\i] at (current page.\i) {\pgfornament[color=CornerColor,width=\cornerwidth,symmetry=\j]{\cornerorn}};
         \node[anchor=north,yshift=-2pt] at (current page.north) {\pgfornament[width=\horizwidth,symmetry=h]{\otherorn}};
         \node[anchor=south,yshift=2pt] at (current page.south) {\pgfornament[width=\horizwidth,symmetry=h]{\otherorn}};
         \node[anchor=north,rotate=90,yshift=-2pt]  at (current page.west) {\pgfornament[width=\vertwidth,symmetry=h]{\otherorn}};
         \node[anchor=north,rotate=-90,yshift=-2pt] at (current page.east) {\pgfornament[width=\vertwidth]{\otherorn}};
         \foreach \y in {-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}
           {\coordinate (coord\y) at (0,1.6*\y cm);
             \draw[LineColor] (current page text area.west |- coord\y) -- (current page text area.east |- coord\y);}
        \end{tikzpicture}}
  }

\begin{document}
\pagenumbering{gobble}% Remove page numbers (and reset to 1)

\Large
{\setstretch{2.54}\color{black}
\lipsum[1]
}


\end{document}

相关内容