[texhax] Entering horizontal lines between items

Philip TAYLOR P.Taylor at Rhul.Ac.Uk
Fri Jan 11 16:58:12 CET 2013



Uwe Lück wrote:

> BTW, this \line does not work with LaTeX, where it is a 
> command for the {picture} environment.

Perfectly true (I never use LaTeX, so have no idea which
(Plain) TeX commands it steals).  Here is a LaTeX solution :

	\documentclass {minimal}
	\def \line #{\hbox to \hsize}
	\def \rulefilledhbox #1#2{\hbox #1 {#2 \hrulefill}}
	\def \rulefilledline #1{\line {#1 \hrulefill}}
	\begin {document}
	\rulefilledline {\rulefilledhbox {to 5 in}{Name} Phone :}
	\rulefilledline {\rulefilledhbox {to 5 in}{Property owner} Phone :}
	\end {document}

and here is a far more elegant version that avoids the need for
braces around the "to 5 in"

	\documentclass {minimal}
	\newtoks \hboxtoks
	\def \line #{\hbox to \hsize}
	\def \rulefilledhbox #1#%
		{%
			\def \hboxmodifier {#1}%
			\afterassignment \postrulefilledhbox
			\hboxtoks =
		}
	\def \postrulefilledhbox
		{%
			\hbox \hboxmodifier {\the \hboxtoks \hrulefill}%
		}
	\def \rulefilledline #1{\line {#1 \hrulefill}}
	\begin {document}
	\rulefilledline {\rulefilledhbox to 5 in {Name} Phone :}
	\rulefilledline {\rulefilledhbox to 5 in {Property owner} Phone :}
	\end {document}

** Phil.


More information about the texhax mailing list