问题
我有一个签名宏,它决定是否在最终产品中包含签名,或者是否放入红色未签名框(用于预生产副本)。由于某些未知原因,矩形绘制得并不均匀。
平均能量损失
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,positioning,tikzmark}
\usepackage{xparse}
\usepackage{xstring}
\def\myswitch{Not for production!}
\DeclareDocumentCommand{\mysignature}{ m m O{0} O{.8\linewidth} O{0pt} O{0pt} }{
\IfEq{\myswitch}{Not for production!}
{%
\begin{tikzpicture}[overlay,remember picture,every node/.style={inner sep=0pt,outer sep=0pt}]
\path [anchor=south west,draw,red,dashed] ($ (pic cs:#1) + (0,-3mm) $) rectangle (\linewidth,4cm) node [anchor=center,pos=.5,font=\bfseries\large] {UNSIGNED};
\end{tikzpicture}
}%
{%
\begin{tikzpicture}[overlay,remember picture,every node/.style={inner sep=0pt,outer sep=0pt}]
\node [anchor=south west,rotate=#3,xshift=#5,yshift=#6] at (pic cs:#1) {\includegraphics[width=#4]{#2}};
\end{tikzpicture}
}%
}%
\begin{document}
\begin{minipage}[t]{.47\linewidth}
\tikzmark{A-sig-left}\rule{\linewidth}{.5pt}\vspace{2mm}
Dr. Joe Schmoe\\[.5\baselineskip]
{\footnotesize Managing Director
\mysignature{A-sig-left}{sig1.eps}[1][\linewidth][0mm][-12mm]
}
\end{minipage}
%
\hfill
%
\begin{minipage}[t]{.47\linewidth}
\tikzmark{A-sig-right}\rule{\linewidth}{.5pt}\vspace{2mm}
Billybob Janice\\[.5\baselineskip]
{\footnotesize Head of Peanut Gallery
\mysignature{A-sig-right}{sig2.eps}[1][.8\linewidth][5mm]
}
\end{minipage}
%%%%%%%%%%%%%%%%%%%%
\vfill
\begin{minipage}[t]{.47\linewidth}
\tikzmark{B-sig-left}\rule{\linewidth}{.5pt}\vspace{2mm}
Dr. Joe Schmoe\\[.5\baselineskip]
{\footnotesize Managing Director\\
\mysignature{B-sig-left}{sig1.eps}[1][\linewidth][0mm][-12mm]
}
\end{minipage}
%
\hfill
%
\begin{minipage}[t]{.47\linewidth}
\tikzmark{B-sig-right}\rule{\linewidth}{.5pt}\vspace{2mm}
Billybob Janice\\[.5\baselineskip]
{\footnotesize
Head of Peanut Gallery\\
}
\mysignature{B-sig-right}{sig2.eps}[1][.8\linewidth][5mm]
\end{minipage}
\end{document}
输出
答案1
您缺少\\
顶部框中的 2 个:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,positioning,tikzmark}
\usepackage{xparse}
\usepackage{xstring}
\def\myswitch{Not for production!}
\DeclareDocumentCommand{\mysignature}{ m m O{0} O{.8\linewidth} O{0pt} O{0pt} }{
\IfEq{\myswitch}{Not for production!}
{%
\begin{tikzpicture}[overlay,remember picture,every node/.style={inner sep=0pt,outer sep=0pt}]
\path [anchor=south west,draw,red,dashed] ($ (pic cs:#1) + (0,-3mm) $) rectangle (\linewidth,4cm) node [anchor=center,pos=.5,font=\bfseries\large] {UNSIGNED};
\end{tikzpicture}
}%
{%
\begin{tikzpicture}[overlay,remember picture,every node/.style={inner sep=0pt,outer sep=0pt}]
\node [anchor=south west,rotate=#3,xshift=#5,yshift=#6] at (pic cs:#1) {\includegraphics[width=#4]{#2}};
\end{tikzpicture}
}%
}%
\begin{document}
\begin{minipage}[t]{.47\linewidth}
\tikzmark{A-sig-left}\rule{\linewidth}{.5pt}\vspace{2mm}
Dr. Joe Schmoe\\[.5\baselineskip]
{\footnotesize Managing Director\\
\mysignature{A-sig-left}{sig1.eps}[1][\linewidth][0mm][-12mm]
}
\end{minipage}
%
\hfill
%
\begin{minipage}[t]{.47\linewidth}
\tikzmark{A-sig-right}\rule{\linewidth}{.5pt}\vspace{2mm}
Billybob Janice\\[.5\baselineskip]
{\footnotesize Head of Peanut Gallery\\
\mysignature{A-sig-right}{sig2.eps}[1][.8\linewidth][5mm]
}
\end{minipage}
%%%%%%%%%%%%%%%%%%%%
\vfill
\begin{minipage}[t]{.47\linewidth}
\tikzmark{B-sig-left}\rule{\linewidth}{.5pt}\vspace{2mm}
Dr. Joe Schmoe\\[.5\baselineskip]
{\footnotesize Managing Director\\
\mysignature{B-sig-left}{sig1.eps}[1][\linewidth][0mm][-12mm]
}
\end{minipage}
%
\hfill
%
\begin{minipage}[t]{.47\linewidth}
\tikzmark{B-sig-right}\rule{\linewidth}{.5pt}\vspace{2mm}
Billybob Janice\\[.5\baselineskip]
{\footnotesize
Head of Peanut Gallery\\
}
\mysignature{B-sig-right}{sig2.eps}[1][.8\linewidth][5mm]
\end{minipage}
\end{document}