2009-09-16 678 views
10

當我在LaTeX中撰寫實驗報告時,我最近不得不在表格上簽名字段。如何在LaTeX中製作簽名字段

    Trondheim 4.september 2009 


______________________   ___________________________ 
    Ivar Nesje      Team mate's name 

的問題是,我無法找到一個簡單的方法來做到這一點讓很多在網上搜索後,我想出了這個簡單的解決方案

\newcommand{\doubleSignature}[3]{ 
\begin{minipage}[c]{\textwidth} 
\vspace{2cm} 

\makebox[12cm][c]{ 
#1, \today 
} 
\vspace{3cm} 

\makebox[12cm][c]{ 
\hfill \makebox[5cm][c] {\hrulefill} \hfill \makebox[5cm][c] {\hrulefill} \hfill 
} 
\makebox[12cm][c]{ 
\hfill #2 \hfill #3 \hfill 
} 
\vspace{1cm} 
\end{minipage} 
} 

這讓我的類型;

\doubleSignature{Trondheim}{Ivar Nesje}{Team mate's name} 

實現想要的結果。如果你們有另一種方式來做這件事,而不是使用信件文件課程,我會很高興聽到你的建議。

回答

13

我想我會從\rule[<raise>]{<width>}{<thickness>}工作。因爲參考點是左下角,您可能甚至不需要可選的引發參數。例如:

\newcommand{\doublesignature}[3][Ivar Nesje]{% 
    \parbox{\textwidth}{ 
    \centering #3 \today\\ 
    \vspace{2cm} 

    \parbox{7cm}{ 
     \centering 
     \rule{6cm}{1pt}\\ 
     #1 
    } 
    \hfill 
    \parbox{7cm}{ 
     \centering 
     \rule{6cm}{1pt}\\ 
     #2 
    } 
    } 
} 

我已經重新排列了您的參數以使您的名稱成爲可選項。

2

假設有沒有其他格式的限制,我可能會使用一個tabular環境,而不是盒子,我會用\rule{length}{width},而不是\hrulefill

\newcommand{\doubleSignature}[3]{ 
\vspace{2cm} 

\begin{center} 
    #1, \today 
\end{center} 
\vspace{3cm} 

\noindent 
\begin{tabular}{lcl} 
    \rule{5cm}{1pt} & \hspace{2cm} & \rule{5cm}{1pt} \\ 
    #2 & & #3 
\end{tabular} 
\vspace{1cm} 
}