# Can TeX/LaTeX draw lines at precise positions?

I need to draw lines at specific distances (in mm). For example:

---- line 0
---- line 1 at 35.64 mm below line 0
---- line 2 at 33.64 mm below line 1


The macro I'm using is as follows (I don't remember from where I copied it):

\def\fr#1{
\vbox{
\dimen0=#1
%\advance \dimen0 by -2.41pt
\advance \dimen0 by -1pt
\vskip \dimen0
\vrule height 0.5pt depth 0.5pt width 2in
}
}


And I use it as follows:

\parindent=0pt
\baselineskip=-\maxdimen
\lineskiplimit=\maxdimen
\lineskip=0pt

\#0 \fr{1mm}
\#1 \fr{35.64}
\#2 \fr{33.64}


However I cannot get the lines to appear at the desired positions.

-

This should be a matter of \vrule and \vskip only. The following should work:

\def\fr#1#2{\vskip #2\noindent\smash{#1}%
\vrule height 0.4pt depth 0pt width 2in\relax}

\fr{0}{0mm}
\fr{1}{35.64mm}
\fr{2}{33.64mm}

\bye


Note how the \smash macro is used to prevent the numbers from adding any height or depth.

-
Is the AMS \smash very different in use/behaviour from plain \smash? –  morbusg Feb 22 '12 at 6:52
@morbusg: No, it's just that I didn't know Plain TeX also has it. –  Andrey Vihrov Feb 22 '12 at 7:25
i may be missing something, but doesn't the rule height accumulate? it's not smashed ... –  barbara beeton Feb 22 '12 at 15:17
@barbarabeeton: It does, and it's what I intended. The question asks for relative line position, not absolute. egreg has the other alternative, so let the op choose the correct one. –  Andrey Vihrov Feb 22 '12 at 16:30

A Plain solution (inspired by Andrey's one):

\def\fr#1#2{\vskip #2\smash{#1 \vrule height 0.4pt depth 0pt width 2in}}

\offinterlineskip

% A ruler in the margin to show alignment
\llap{\smash{\vtop to 100pt{