当字符延伸到水平线以下时调整信件末尾的签名行

当字符延伸到水平线以下时调整信件末尾的签名行

我正在使用 LaTeX 编写合同,并试图使签名块的格式看起来正确。我已经让它显示得很好了,但签名行有一个小麻烦。我使用签名的扫描图像并将其叠加在水平线上,如图所示。但是,我无法使行距与右侧列中客户的未填充行匹配。

在下面的当前版本中,您可以看到我的签名的水平线位于“我的名字”上方,并留有相当多的额外空间。

版本错误

它看起来应该如下所示,其中两列具有相同的垂直间距。

正确版本

我的 MWE 显示如下。

\documentclass[12pt,letterpaper]{article}
\usepackage[letterpaper,top=1.25in,left=1in,right=1in,bottom=1.25in,showframe=false,headheight=1in]{geometry}
\usepackage[scaled]{uarial}
\usepackage[T1]{fontenc}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{multicol}
\usepackage{graphicx}
\usepackage{parskip}
\usepackage{tikz}
\usepackage{color,soul}

\usepackage{sectsty}
\allsectionsfont{\normalsize\bfseries}

\def\mydate{\leavevmode\hbox{\the\year/\twodigits\month/\twodigits\day}}
\def\twodigits#1{\ifnum#1<10 0\fi\the#1}

\setlength\parindent{0pt}
\newcommand{\MyMargin}{0.5in}   %Define global margin

\begin{document}
    
Sincerely,

\vspace{12pt}

\begin{multicols}{2}
    \noindent
    \begin{tabular}{@{}p{2.5in}}
        My Business Name\\
        \\
        \begin{tikzpicture}
            \draw[thin](0,0)--(2.5in,0)node[midway,yshift=0.25cm](c){\includegraphics[width=1.5in]{signature.png}};
            \node[yshift=1cm] at (c.south) {};
        \end{tikzpicture}\\
        My Name\\
        Owner\\
        Address\\
        City, State ZIP\\
        \\
        \quad\quad \mydate\\
        \hline
        \vspace{-0.2cm}Date\\
    \end{tabular}
    

    
    \noindent
    \begin{tabular}{p{2.5in}}
        Agreed to and Accepted by:\\
        \\
        \\
        \hrulefill\\
        Client Name \\
        Client's Business Name     %do not include \\, it's defined with \ClientBus
        \\
        \\
        \hrulefill\\
        Date\\
    \end{tabular}
\end{multicols}

\end{document}

答案1

您不需要multicols,只需使顶部对齐的tabulars 与第一行具有相同的间距即可。

对于固定宽度的列,最好使用w提供的列类型array

签名可以作为不占用垂直空间的框添加到空行中,并且可以随意升高或降低。注意:我以前height只是用通用图像来模拟您的图片。

\documentclass[12pt,letterpaper]{article}
\usepackage[
  letterpaper,
  top=1.25in,
  left=1in,
  right=1in,
  bottom=1.25in,
  showframe=false,
  headheight=1in
]{geometry}
\usepackage[scaled]{uarial}
\usepackage[T1]{fontenc}
\usepackage{array}
\usepackage{graphicx}
\usepackage{parskip}
\usepackage{color,soul}
\usepackage{sectsty}

\renewcommand{\familydefault}{\sfdefault}
\allsectionsfont{\normalsize\bfseries}

\makeatletter
\newcommand\mydate{\mbox{\the\year/\two@digits\month/\two@digits\day}}
\makeatother

%\newcommand{\MyMargin}{0.5in}   %Define global margin

\begin{document}
    
Sincerely,

\vspace{12pt}

\begin{tabular}[t]{@{}w{l}{2.5in}@{}}
  My Business Name \\[2ex]
  \multicolumn{1}{@{}c@{}}{%
    \raisebox{-10pt}[0pt][0pt]{\includegraphics[width=1.5in,height=0.7cm]{example-image}}%
  } \\
  \hline
  \\[-1ex]
  My Name\\
  Owner\\
  Address\\
  City, State ZIP\\
  \\
  \quad\quad \mydate\\
  \hline
  Date\\
\end{tabular}\hfill
\begin{tabular}[t]{@{}w{l}{2.5in}@{}}
  Agreed to and Accepted by:\\[2ex]
  \\
  \hline
  \\[-1ex]
  Client Name \\
  Client's Business Name \\
  \\ \\
  \hline
  Date\\
\end{tabular}

\end{document}

在此处输入图片描述

答案2

我通常在独立环境中使用 tikz 制作所有此类文档,将纸张大小定义为绘图的最大正方形;主要是因为我可以分批生成它们,针对具有相同消息或根据特定主题按定义排序的消息的多个收件人。利用每个独立 tikzpicture 环境代表一页的事实,当然可以迭代几页。

对于您的特定示例,我在 tikzpicture 环境中添加了选项,您可以使用常量\linewidth来定义宽度,然后创建一些变量,这些变量允许您控制中间空间的分隔和宽度以及一些加法和减法以将它们放置在相应的位置。定义一些具有名称的节点,以便稍后放置签名,并使用 calc 库进行相应的位移;我还添加了一些可以使用inkscapeplugin生成代码的签名,以防tikz您希望所有内容都是矢量。

代码行的结果\def\helplines{none}

在此处输入图片描述

梅威瑟:

\documentclass[12pt,letterpaper]{article}
\usepackage[letterpaper,top=1.25in,left=1in,right=1in,bottom=1.25in,showframe=false,headheight=1in]{geometry}
\usepackage[scaled]{uarial}
\usepackage[T1]{fontenc}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{multicol}
\usepackage{graphicx}
\usepackage{parskip}
\usepackage{tikz}
\usepackage{color,soul}
\usetikzlibrary{calc,backgrounds}
\usepackage{fancyvrb}
\usepackage{sectsty}
\allsectionsfont{\normalsize\bfseries}

\def\mydate{\leavevmode\hbox{\the\year/\twodigits\month/\twodigits\day}}
\def\twodigits#1{\ifnum#1<10 0\fi\the#1}

\setlength\parindent{0pt}
\newcommand{\MyMargin}{0.5in}   %Define global margin

\def\MySignature#1#2#3{%\MySignature{position}{scale}{line widht}
    \begin{scope}[shift={(#1)},scale=#2]
        %\fill(0,0) circle (5pt); uncoment to find the origin or insertion point
        \path[draw,x=1pt,y=1pt,shift={(-170, 735.3)}, line width=#3]%points obtained in pt using svg to tkz inkscape externsion https://github.com/xyz2tex/svg2tikz
        (96.7, -725.4).. controls (96.7, -725.4) and (93.7, -729.8) .. (91.8, -728.8).. controls (89.8, -727.9) and (90.6, -723.0) .. (95.5, -715.6).. controls (100.5, -708.3) and (104.0, -706.1) .. (105.5, -706.8).. controls (107.1, -707.5) and (103.4, -717.8) .. (100.2, -722.1).. controls (97.0, -726.3) and (96.6, -727.0) .. (97.2, -727.5).. controls (97.8, -728.0) and (105.0, -723.2) .. (104.2, -722.1).. controls (103.4, -720.9) and (100.8, -725.6) .. (101.9, -725.9).. controls (103.0, -726.3) and (108.3, -721.1) .. (108.3, -721.1).. controls (108.3, -721.1) and (105.2, -724.3) .. (106.1, -724.9).. controls (107.0, -725.4) and (115.8, -719.9) .. (115.8, -719.9).. controls (115.8, -719.9) and (109.4, -724.8) .. (110.9, -725.3).. controls (112.3, -725.7) and (114.4, -723.5) .. (116.3, -719.9).. controls (118.2, -716.4) and (122.9, -705.3) .. (124.4, -706.1).. controls (125.9, -706.9) and (113.5, -722.7) .. (114.8, -723.7).. controls (116.0, -724.7) and (122.6, -717.6) .. (122.6, -717.6).. controls (122.6, -717.6) and (120.0, -719.9) .. (120.5, -720.5).. controls (121.1, -721.2) and (125.3, -718.4) .. (125.3, -718.4).. controls (125.3, -718.4) and (122.1, -722.5) .. (122.7, -722.9).. controls (123.4, -723.4) and (128.7, -718.3) .. (128.7, -718.3).. controls (128.7, -718.3) and (124.4, -722.7) .. (125.4, -723.3).. controls (126.4, -724.0) and (133.0, -719.1) .. (133.1, -718.3).. controls (133.2, -717.5) and (128.4, -722.3) .. (129.5, -722.6).. controls (130.6, -722.9) and (133.1, -720.8) .. (133.1, -720.8) -- (133.1, -720.7)
        (134.6, -718.1).. controls (134.6, -718.1) and (137.7, -717.0) .. (137.3, -716.1).. controls (136.9, -715.2) and (128.8, -732.2) .. (128.8, -732.2).. controls (128.8, -732.2) and (133.8, -722.9) .. (138.5, -717.1).. controls (143.1, -711.3) and (145.8, -706.5) .. (146.7, -706.9).. controls (147.6, -707.3) and (145.9, -709.1) .. (147.6, -709.8).. controls (149.4, -710.5) and (153.5, -708.5) .. (153.5, -708.5)
        (154.5, -706.1).. controls (149.1, -705.5) and (136.1, -719.3) .. (138.1, -720.5).. controls (140.2, -721.7) and (149.5, -711.8) .. (149.5, -711.8).. controls (149.5, -711.8) and (150.0, -712.2) .. (150.6, -712.2).. controls (151.3, -712.2) and (152.4, -711.3) .. (152.4, -711.3).. controls (152.4, -711.3) and (144.9, -719.3) .. (146.2, -720.1).. controls (147.4, -720.8) and (159.4, -713.9) .. (162.4, -710.4).. controls (165.5, -706.9) and (167.9, -705.0) .. (167.0, -704.3).. controls (166.1, -703.5) and (148.8, -718.4) .. (153.1, -720.3).. controls (157.3, -722.1) and (175.4, -706.8) .. (174.2, -704.7).. controls (172.9, -702.6) and (161.8, -716.1) .. (163.4, -717.6).. controls (165.0, -719.1) and (168.5, -716.1) .. (169.3, -716.4).. controls (170.1, -716.8) and (168.2, -720.2) .. (168.2, -720.2).. controls (168.2, -720.2) and (176.7, -714.4) .. (177.1, -715.4).. controls (177.5, -716.4) and (172.2, -719.1) .. (173.2, -719.7).. controls (174.2, -720.3) and (192.9, -708.3) .. (191.4, -706.4).. controls (189.8, -704.5) and (176.6, -717.8) .. (177.9, -718.8).. controls (179.2, -719.7) and (192.6, -713.6) .. (194.6, -711.0).. controls (196.5, -708.4) and (200.1, -704.7) .. (199.0, -704.1).. controls (197.9, -703.4) and (183.3, -718.2) .. (184.5, -718.8).. controls (185.7, -719.3) and (187.4, -715.3) .. (191.5, -715.5).. controls (195.6, -715.7) and (204.9, -716.6) .. (206.1, -715.4).. controls (207.3, -714.2) and (208.2, -713.2) .. (208.2, -713.2).. controls (208.2, -713.2) and (203.6, -717.1) .. (205.4, -717.8).. controls (207.2, -718.4) and (224.4, -703.5) .. (224.4, -703.5).. controls (224.4, -703.5) and (209.5, -716.2) .. (212.5, -717.5).. controls (215.4, -718.9) and (232.5, -702.1) .. (232.1, -700.6).. controls (231.7, -699.2) and (216.3, -714.3) .. (219.8, -716.1).. controls (223.3, -717.9) and (232.5, -711.1) .. (232.5, -711.1).. controls (232.5, -711.1) and (225.6, -715.4) .. (228.0, -715.4).. controls (230.4, -715.5) and (241.7, -712.6) .. (241.7, -712.6).. controls (241.7, -712.6) and (228.1, -715.8) .. (232.4, -716.7).. controls (236.7, -717.6) and (239.9, -717.5) .. (239.9, -718.6).. controls (239.9, -719.7) and (227.3, -723.6) .. (198.4, -725.3).. controls (169.5, -727.1) and (163.0, -730.3) .. (163.3, -731.3).. controls (163.6, -732.3) and (168.6, -733.9) .. (183.9, -733.4).. controls (199.1, -732.9) and (202.9, -733.2) .. (202.9, -733.2);
    \end{scope}
}

\def\MySignatureB#1#2#3#4{%\MySignature{position}{scale}{line width}{color}
    \begin{scope}[shift={(#1)},scale=#2]
        %\fill(0,0) circle (5pt); uncoment to find the origin or insertion point
        \path[draw,x=1pt,y=1pt,shift={(-190, 720)}, line width=#3,#4]%points obtained in pt using svg to tkz inkscape externsion https://github.com/xyz2tex/svg2tikz
        (152.4, -711.3).. controls (152.4, -711.3) and (144.9, -719.3) .. (146.2, -720.1).. controls (147.4, -720.8) and (159.4, -713.9) .. (162.4, -710.4).. controls (165.5, -706.9) and (167.9, -705.0) .. (167.0, -704.3).. controls (166.1, -703.5) and (148.8, -718.4) .. (153.1, -720.3).. controls (157.3, -722.1) and (175.4, -706.8) .. (174.2, -704.7).. controls (172.9, -702.6) and (161.8, -716.1) .. (163.4, -717.6).. controls (165.0, -719.1) and (168.5, -716.1) .. (169.3, -716.4).. controls (170.1, -716.8) and (168.2, -720.2) .. (168.2, -720.2).. controls (168.2, -720.2) and (176.7, -714.4) .. (177.1, -715.4).. controls (177.5, -716.4) and (172.2, -719.1) .. (173.2, -719.7).. controls (174.2, -720.3) and (192.9, -708.3) .. (191.4, -706.4).. controls (189.8, -704.5) and (176.6, -717.8) .. (177.9, -718.8).. controls (179.2, -719.7) and (192.6, -713.6) .. (194.6, -711.0).. controls (196.5, -708.4) and (200.1, -704.7) .. (199.0, -704.1).. controls (197.9, -703.4) and (183.3, -718.2) .. (184.5, -718.8).. controls (185.7, -719.3) and (187.4, -715.3) .. (191.5, -715.5).. controls (195.6, -715.7) and (204.9, -716.6) .. (206.1, -715.4).. controls (207.3, -714.2) and (208.2, -713.2) .. (208.2, -713.2).. controls (208.2, -713.2) and (203.6, -717.1) .. (205.4, -717.8).. controls (207.2, -718.4) and (224.4, -703.5) .. (224.4, -703.5).. controls (224.4, -703.5) and (209.5, -716.2) .. (212.5, -717.5).. controls (215.4, -718.9) and (232.5, -702.1) .. (232.1, -700.6).. controls (231.7, -699.2) and (216.3, -714.3) .. (219.8, -716.1).. controls (223.3, -717.9) and (232.5, -711.1) .. (232.5, -711.1);
    \end{scope}
}
\def\Acot[#1]#2#3(#4)#5{
    \draw[|<->|,#5] (#1)++(0,-0.3) -- ++(#2,0) node[midway](#4-W){};
    \draw[|<->|,#5] (#1)++(0.3,0) -- ++(0,-#3) node[pos=0.3](#4-H){};
}


\begin{document}
    
    Sincerely,
    
    \begin{tikzpicture}
        \def\helplines{none} % Default "none" , to see what happens change to your favoryte color.
        \def\midspace{5em}
        \def\topsignatureSpace{5em}
        \def\bottomsignatureSpace{1em}
        \draw(0,0) node[anchor=north west,draw=\helplines](MBN){My Business Name};
        \draw(\linewidth/2+\midspace/2,0) node[anchor=north west,draw=\helplines](CLI){Agreed to and Accepted by:};
        \draw[thick]
        ($(MBN.south west)+(0,-\topsignatureSpace)$) coordinate (a)
            -- ++(\linewidth/2-\midspace/2,0)
            node[pos=0.5,anchor=south](sig1){};
        \draw[thick]
        ($(MBN.south west-|CLI.180)+(0,-\topsignatureSpace)$)coordinate(b)
            -- ++(\linewidth/2-\midspace/2,0)
            node[pos=0.5,anchor=south](sig2){};
        
        \draw($(a)+(0,-\bottomsignatureSpace)$) node[anchor=north west,draw=\helplines, align=left](MBN-dat){
            My Name\\
            Owner\\
            Address\\
            City, State ZIP%
        };
        \draw($(b)+(0,-\bottomsignatureSpace)$) node[anchor=north west,draw=\helplines, align=left](CLI-dat){
            Client Name \\
            Client's Business Name %
        };
        \draw[thick]
        ($(MBN-dat.south west)+(0,-\bottomsignatureSpace-1em)$)coordinate (c) 
            -- ++(\linewidth/2-\midspace/2,0)
            node[pos=0,anchor=north west]{Date}
            node[pos=0.5,anchor=south]{\mydate};
        \draw[thick]
        ($(CLI-dat.south west)+(0,-\bottomsignatureSpace-1em)$)coordinate (d) 
            -- ++(\linewidth/2-\midspace/2,0)
            node[pos=0,anchor=north west]{Date}
            node[pos=0.5,anchor=south]{\mydate};
        \path[draw=\helplines](0,0) rectangle ($(c.south east)+(\linewidth,-2em)$);
        %Put some defined signatures
        \MySignature{$(sig1)+(0,0)$}{1}{1pt}
        \MySignatureB{$(sig2)+(0,0.5pt)$}{1}{1pt}{draw=blue!50!black}
        
        %Code to see the nodes and others (uncoment or erase because for nodes y use the trick to draw te text in white to work with the none option.
        \begin{scope}[on background layer]
            \foreach \k in {MBN,MBN-dat,sig1,sig2,CLI,CLI-dat}{
                \draw[draw=\helplines,fill=\helplines] (\k.north west) circle (1.5pt);
                \draw[draw=\helplines](\k.north west)++(6em,-1.5em) node[anchor=180,draw=\helplines,fill=\helplines,inner sep=1pt,text=white]{\tiny \k.north west} -- ++(-1em,0)--  (\k.north west);}
            \foreach \k in {a,b,c,d}{
                \draw[draw=\helplines,fill=\helplines] (\k.north west) circle (1.5pt);
                \draw[draw=\helplines](\k.north west)++(6em,-1.5em) node[anchor=180,draw=\helplines,fill=\helplines,inner sep=1pt,text=white]{\tiny \k.coordinate} -- ++(-1em,0)-- (\k.north west);} %
            \Acot[MBN.south west]{\linewidth}{\topsignatureSpace}(C1){draw=\helplines}
            \draw[draw=\helplines] (C1-W) node[draw=\helplines,fill=\helplines,inner sep=1pt,text=white]{\tiny\verb+\linewidth =+ \texttt{\pgfmathprint{int(\linewidth*3.527)/10}mm} };
            \draw[draw=\helplines] (C1-H) node[anchor=180,draw=\helplines,fill=\helplines,inner sep=1pt,text=white]{\tiny\verb+\topsignature space = 5em =+ \texttt{\pgfmathprint{int(\topsignatureSpace*3.527)/10}mm}};%Actually I dont find how to invoke verb inside a definition. It was done directly
        \end{scope}
        
    \end{tikzpicture}
    
    Text before tikzpicture
    
\end{document}

代码行的结果\def\helplines{red}

在此处输入图片描述

勘误表:

在节点sig1sig2定位点的名称应该是nodename.center

相关内容