![LaTex 线上签名问题](https://linux22.com/image/366300/LaTex%20%E7%BA%BF%E4%B8%8A%E7%AD%BE%E5%90%8D%E9%97%AE%E9%A2%98.png)
我怎样才能将线放在以名称为中心的位置,并使其长度相同(所有名称的最宽长度)?谢谢!
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[portuguese]{babel}
\newcommand\namegroup[1]{%
\begin{minipage}[t]{0.4\textwidth}
\vspace*{1.5cm} % leave some space above the horizontal line
\hrule
\vspace{1mm} % just a bit more whitespace below the line
\centering
\begin{tabular}[t]{c}
#1
\end{tabular}
\end{minipage}}
\begin{document}
APROVADO: 5 de Dezembro de 2017.
\begin{center}
\namegroup{Prof.$^a$ Daniele Cristiane Menezes\\(UFV)}
\hspace{1.5cm}
\namegroup{Prof.$^a$ Rita de Cássia Superbi de Sousa\\(UFV)}
\namegroup{Prof. Emilio Borges\\(Orientador)\\(UFV)}
\hspace{1.5cm}
\namegroup{Prof.$^a$ Rejane de Castro Santana\\ (Presidente da banca e coordenadora da disciplina) \\(UFV)}
\end{center}
\end{document}
答案1
这是一个(半)自动版本:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[portuguese]{babel}
\usepackage{etoolbox}
\newcounter{signatures}
\newlength{\signaturewidth}
\newenvironment{approbation}[1]
{%
% reset the counter for the number of signatures
\setcounter{signatures}{0}%
% go to vertical mode and insert a minipage
\par\noindent
\begin{minipage}{\textwidth}
% first the header
APROVADO: #1\par
% followed by some vertical space
\vspace{3\baselineskip}%
}
{%
% we want to have flexible glue on other side
% in order to center the last signature, if alone
\setlength{\leftskip}{0pt plus 1fil}%
\setlength{\rightskip}{0pt plus 1fil}%
\setlength{\parfillskip}{0pt}%
% at this point we have gathered the signatures, let's print them;
% \par will remove the trailing \hfill if there's an odd number of signatures
\signatures\par
\end{minipage}\par
}
\newcommand{\signature}[1]{%
% measure the width of the current signature
\measuresignature{#1}%
% add the signature as argument to \makesignature
\appto{\signatures}{\makesignature{#1}}%
% count them
\stepcounter{signatures}%
\ifodd\value{signatures}%
% place \hfill after the odd-numbered signatures
\appto{\signatures}{\hfill}%
\else
% place \par\bigskip after the even-numbered signatures
\appto{\signatures}{\par\bigskip}%
\fi
}
\newcommand{\measuresignature}[1]{%
% get the width
\settowidth{\dimen0}{\begin{tabular}{@{}c@{}}#1\end{tabular}}%
% if the stored value up to now is less than the current one, update
\ifdim\dimen0>\signaturewidth \signaturewidth=\dimen0 \fi
}
\newcommand{\makesignature}[1]{%
% make a tabular as wide as \signaturewidth
\begin{tabular}[t]{@{}c@{}}
\makebox[\signaturewidth]{}\\
\hline
#1
\end{tabular}%
}
\begin{document}
\begin{approbation}{5 de Dezembro de 2017}
\signature{Prof.\textsuperscript{a} Daniele Cristiane Menezes\\(UFV)}
\signature{Prof.\textsuperscript{a} Rita de Cássia Superbi de Sousa\\(UFV)}
\signature{Prof. Emilio Borges\\(Orientador)\\(UFV)}
\signature{Prof.\textsuperscript{a} Rejane de Castro Santana\\
(Presidente da banca e \\ coordenadora da disciplina) \\(UFV)}
\end{approbation}
\bigskip
\begin{approbation}{5 de Dezembro de 2017}
\signature{Prof.\textsuperscript{a} Daniele Cristiane Menezes\\(UFV)}
\signature{Prof.\textsuperscript{a} Rita de Cássia Superbi de Sousa\\(UFV)}
\signature{Prof. Emilio Borges\\(Orientador)\\(UFV)}
\end{approbation}
\bigskip
\begin{approbation}{5 de Dezembro de 2017}
\signature{Prof.\textsuperscript{a} Daniele Cristiane Menezes\\(UFV)}
\signature{Prof.\textsuperscript{a} Daniele Cristiane Menezes\\(UFV)}
\signature{Prof.\textsuperscript{a} Daniele Cristiane Menezes\\(UFV)}
\end{approbation}
\end{document}
不过,您有责任确保最大宽度不超过文本宽度的一半。