[texhax] Entering horizontal lines between items

Uwe Lück uwe.lueck at web.de
Fri Jan 11 16:18:46 CET 2013


Am Donnerstag, den 10.01.2013, 13:45 +0000 schrieb Philip TAYLOR: 
> Uwe Lück wrote:
> > The most interesting question for me still is what you want to get. 
> 
> I /think/ that I understood.
> I /know/ that my solution needed just five lines to express :
> 
> \def \rulefilledhbox #1#2{\hbox #1 {#2 \hrulefill}}
> \def \rulefilledline #1{\line {#1 \hrulefill}}

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

> \rulefilledline {\rulefilledhbox {to  5 in}{Name} Phone :}
> \rulefilledline {\rulefilledhbox {to  5 in}{Property owner} Phone :}
> \end
> 
> I am not convinced that a prolix discussion of whether we are
> discussing an 2-variable problem or an n-variable problem really
> gets us very far.
> 
> > this would be the next thing I would like to find out, 
> > but I must stop now. E.g., why have they referred to 
> > 5 inches?
> 
> Because Jerry referred to five inches :
> 
> > This is probably a bad example. However, assume I want the PHONE to
> > begin in 5in. from the left margin.

OK, fine, you have solved the PHONE problem where I could not 
make sense of the 5 inches because I thought an indent of 
5 inches means that 5 inches of the line are blank. 
(And as a German, I underestimated 5 inches.) And Jerry wrote

> Not every line has every item in the same location and some
> lines have 3 items on them. 

In general there are no 5 inches, and other proposals 
dealt with a more general situation, like I did.

Now below is a LaTeX version of the "indent" approach 
(with a little variation of spacing) both for two and 
for three "items".

Cheers,

    Uwe.
_______________________________________________________

\documentclass{minimal}
\newcommand{\rulefilledline}[1]{%
%     \noindent
    \makebox[\linewidth]{#1 \hrulefill}%
    \hspace{0pt}\ignorespaces
%     \par
}
%% |\keyindentkeyline{<key1>}{<indent1>}{<key2>}|
\newcommand{\keyindentkeyline}[3]{%
    \rulefilledline{\makebox[#2]{#1 \hrulefill} \ #3}}
\newcommand{\phoneline}[1]{\keyindentkeyline{#1}{5in}{PHONE:}}
%% |
\keyindentkeyindentkeyline{<key1>}{<indent1>}{<key2>}{<indent2>}{<key>3}|
\newcommand{\keyindentkeyindentkeyline}[5]{%
    \rulefilledline{%
        \makebox[#4]{\makebox[#2]{#1 \hrulefill} \ #3 \hrulefill} \ #5}}
\begin{document}
  \setlength{\parindent}{0pt} %% or use \noindent ... \par
  \keyindentkeyline{First:}{3.5in}{Second:}
  \phoneline{XYZ}
  \keyindentkeyindentkeyline{First:}{2.5in}{Second:}{4.5in}{Third:}
  %% compare line width:
  \noindent 
  \makebox[\linewidth]{\hrulefill}
\end{document}





More information about the texhax mailing list