Creating a right aligned signature block
At first I came up with this:
\documentclass{article}
%-------Definition of \myrule--
\def\myrule#1#2#3{{\hskip#1in{\hbox to #2in%
{\leaders\hbox to .00625in{\hfil.\hfil}\hfill}}%
\par\hskip#1in#3\vskip1cm}}
%------------------------------
\begin{document}
\hfill margin
\myrule{2.56}{2}{Chairperson, Professor A}
\myrule{2.56}{2}{Professor B}
\myrule{2.56}{2}{Professor C}
\end{document}
This makes signature lines the same thickness as a period. See TeX Primitive Control Sequences-leaders.
\hfill margin
is there to show you where the right margin is, take it out when you have the signature blocks placed correctly.
The first variable of \myrule
takes the horizontal placement of the left edge of the signature line in inches; the second variable is the length of the signature line; and the third takes the name of the signatory.
Producing:
Which is pretty good at placing the signature block where one wants it.
But the OP really didn't ask that, he wants it to be automatic.
Enclosing variables #2-#5 (the variables place under the signature line) in a \vtop box, preceded by \hfill, placed the \vtop box containing the information under the signature against the right margin. Variable #1 is used as both to size the \vtop box hsize=#1in
, and the definition of \mynewrule, \hbox to #1in
.
So both the signature line, contained in the \hbox, and the material under the signature line, contained in the \vtop box will be the same length. This allows the \hfill in both the signature line definition, and the definition of what is under the signature line, to push them as far to the right as the length given in variable #1 permits, but correctly aligned per the OP's request:
\documentclass{article}
%Definition of right aligned signature block
%%%Defined the signature line using \leaders%%%
\def\mynewrule#1{\hbox to #1in{\leaders\hbox to 0.00625in{\hfil.\hfil}\hfill}}
%%%%Defined the signature line with \hfill%%%
\def\rnewrule#1{\hfill\mynewrule{#1}}
%%%%Defined block to include rule and information%%%
\def\rsignblock#1#2#3#4#5{\rnewrule{#1}\par
\hfill\vtop{\hsize=#1in\noindent{#2}\par\noindent{#3}%
\par\noindent{#4}\par\noindent{#5}}%
\vskip1cm}
%-------------------------------------------X
\begin{document}
%-to demonstrate where the margin is---X
\hfill margin\par
%--------------------------------------X
\rsignblock{2}{Chairperson, Professor A}{}{}{}
\rsignblock{2}{Professor B}{}{}{}
\rsignblock{2}{Professor C}{}{}{}
\rsignblock{2}{Professor D}{Head of the Institute of Pearls}{50 Rainbow Street}{Succhitash, OH}
\end{document}
Which produces:
Same result, but works differently, now there is no variable to place the block with relation to the left margin, only the single length variable, the length of the signature line/block in inches, and the signature block is automatically placed flush with the right margin.
The rest of the fields, #2,#3,#4,#5 are for information that is under the signature line, as shown by "Professor D".
Related: How to write macro with variable amount of text variables
My suggestion - use \parbox
and \hfill
before it to move the block to the right side. Something like the following:
\documentclass{article}
\begin{document}
\hfill
\parbox{5cm}{
\underline{\hspace{5cm}}\\
Chairperson, Professor A\\[1cm]
\underline{\hspace{5cm}}\\
Professor B\\[1cm]
\underline{\hspace{5cm}}\\
Professor C
}
\end{document}
Adjust the spacing as needed. Here's what the result looks like, with the default wide margins of the article
class:
You could simply use minipage
and flushright
, and set the width of your rule
to \linewidth
.
\documentclass{article}
\usepackage{lipsum}
\newcommand{\mysignrule}[1]{%
\vspace{5ex}
\rule{\linewidth}{0.5pt}\newline
#1\par
}
\begin{document}
\lipsum[1]
\begin{flushright}
\begin{minipage}{0.45\linewidth}
\mysignrule{Chairperson, Professor A}
\mysignrule{Professor B}
\mysignrule{Professor C}
\end{minipage}
\end{flushright}
\end{document}