4

Problem

I am working on creating an auction bid sheet. Each sheet will contain two columns. At the top of each column there is a description of auction item and underneath there needs to be horizontal lines for bidders to write bid amounts.

I am having trouble figuring out how to perform a vertical fill that is composed of horizontal lines. Can someone please point me in the correct direction.

Conceptual Output

This is a description  This is a description  
on the left column     in the right side that 
that is followed by    also with lines.
lines.                 ______________________
____________________   ______________________
____________________   ______________________
____________________   ______________________

Latex

\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{lipsum}
\usepackage{multicol}

\begin{document}

\begin{multicols}{2}

\lipsum[1]
\vspace*{\fill} % How do I add horizontal lines here?

\columnbreak

\lipsum[2]
\vspace*{\fill} % How do I add horizontal lines here?

\end{multicols}

\end{document}
slaughter98
  • 143
  • 5

1 Answers1

5

Something like this?

bid sheet, possibly

\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{lipsum}
\usepackage{fillwith}
\fillwithset{style=rule}

\begin{document}
\noindent
\parbox[t][\textheight]{.475\textwidth}{%
  \lipsum[1]
  \fillwith
}\hfill
\parbox[t][\textheight]{.475\textwidth}{%
  \lipsum[2]
  \fillwith
}

\end{document}

Based on code by Harish Kumar, as noted. Save the following as fillwith.sty somewhere TeX can find it e.g. <TEXMFHOME>/tex/latex/fillwith/fillwith.sty would be good, where <TEXMFHOME> is the root of your personal TEXMF tree.

% !TEX encoding = UTF-8 Unicode
\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX)
[1994/12/01]% LaTeX date must December 1994 or later
\ProvidesPackage{fillwith}
\RequirePackage{xparse,l3keys2e,xcolor}
% BEGIN Expl pkg option setup
\ExplSyntaxOn
\keys_define:nn { fillwith }
  {
    color .meta:n = {
      colour = #1,
    },
    colour .code:n = {
      \colorlet{fillwithcolour}{#1}
    },
    dotted color .meta:n = {
      dotted colour = #1,
    },
    dotted colour .code:n = {
      \colorlet{fillwithdottedcolour}{#1}
    },
    lliw .meta:n = {
      colour = #1,
    },
    colour .initial:n = gray,
    dotted colour .initial:n = black,
  }
\ProcessKeysPackageOptions { fillwith }
\NewDocumentCommand\fillwithset { +m }{
  \keys_set:nn { fillwith } { #1 }
}
\dim_new:N \l_fillwith_ht_dim
\cs_new_protected_nopar:Nn \fillwith_style: {}
\keys_define:nn { fillwith }
{
  cont .bool_set:N = \l_fillwith_cont_bool,
  cont .default:n = true,
  fillwith~ht .tl_set:N = \l_fillwith_ht_tl,
  fillwith~ht .initial:n = 2,
  style .choices:nn =
  {
    rule , dots , unknown
  }{
    \if_case:w \l_keys_choice_int
      \or: \cs_set_protected_nopar:Nn \fillwith_style: { \hrulefill }
      \or: \cs_set_protected_nopar:Nn \fillwith_style: { \dotfill }
      \else: \cs_set_protected_nopar:Nn \fillwith_style: { \use:c { \l_keys_choice_tl } }
    \fi:
  },
  style .initial:n = dots,
}
% END Expl pkg option setup

% BEGIN \fillwith_fill:
% ref: http://tex.stackexchange.com/a/241139/ Harish Kumar
\cs_new_protected_nopar:Nn \fillwith_fill:
{
  \dim_set:Nn \l_fillwith_ht_dim { \medskipamount + \l_fillwith_ht_tl \baselineskip }
  \color{fillwithcolour}
  \ifhmode
    \bool_if:NTF \l_fillwith_cont_bool
    {
      \vrule height \l_fillwith_ht_dim depth \c_zero_skip width \c_zero_skip
      \fillwith_style:
      \par
    }{
      \par
    }
  \fi
  \hrule height \c_zero_skip
  \nobreak
  \setbox0=\hbox to \hsize{
    \skip_horizontal:n { \@totalleftmargin }
    \vrule height \l_fillwith_ht_dim depth \c_zero_skip width \c_zero_skip
    \fillwith_style:
  }
  \cleaders \copy0 \vfill \hbox{}
  \normalcolor
}
% END \fillwith_fill:
% BEGIN fillwith
\NewDocumentCommand \fillwith { s o }
{%
  \group_begin:
    \IfValueT { #2 }
    {
      \keys_set:nn { fillwith } { #2 }
    }
    \IfBooleanTF { #1 }
    {
      \bool_set_true:N \l_fillwith_cont_bool
    }{
      \bool_set_false:N \l_fillwith_cont_bool
    }
    \fillwith_fill:
  \group_end:
}
% END fillwith
% BEGIN fillwithdottedlines
\NewDocumentCommand \fillwithdottedlines { s O { 2 } }
{
  \group_begin:
    \IfBooleanTF { #1 }
    {
      \bool_set_true:N \l_fillwith_cont_bool
    }{
      \bool_set_false:N \l_fillwith_cont_bool
    }
    \keys_set:nn { fillwith } { style = dots, fillwith~ht=#2 }
    \fillwith_fill:
  \group_end:
}
% END fillwithdottedlines
\ExplSyntaxOff

\endinput
cfr
  • 198,882
  • Cool! You might want to make it a bit clearer that the second chunk of code is the fillwidth package, and what to do with it. (I know there's a \ProvidesPackage line there, but for the uninitiated, that might not be so obvious.) – Alan Munn Sep 19 '17 at 03:09
  • Bonus points if you can get the lines to line up with each other in each column! ;-) – Alan Munn Sep 19 '17 at 03:10
  • 1
    @AlanMunn Fortunately, I don't need the points :-). – cfr Sep 19 '17 at 03:11
  • @AlanMunn Can you? You are welcome to the points ;). – cfr Sep 19 '17 at 03:15
  • No. This is the dreaded 'grid' typesetting problem. – Alan Munn Sep 19 '17 at 03:16
  • @AlanMunn But the boxes are the same height. So shouldn't it be possible to push the lines down to the bottom in each case? That is, without a general solution to the grid lock. – cfr Sep 19 '17 at 03:24
  • Good morning. This is a very beautiful macro for my needs. Can you indicate for me how can I play on the space between lines and on the \vmargin? (I want to obtain more lines on a page). Thanks – Faouzi Bellalouna Nov 02 '17 at 06:38
  • @FaouziBellalouna You can change the value of fillwith ht using the \fillwithset{} configuration macro. It is defaulting to 2. Try 1.75 or something for more lines. I don't know what you mean about \vmargin. This has nothing to do with the page margins at all - it doesn't touch them. – cfr Nov 02 '17 at 23:35
  • @cfr Many thanks for the command \fillwithset{1.75}. I talk about \vmargin in relation about the distance berween the top of the page and the beginning of text – Faouzi Bellalouna Nov 03 '17 at 16:11
  • @FaouziBellalouna Don't use that package. It is buggy. Use geometry or typearea or similar (depending on you class) instead. – cfr Nov 07 '17 at 02:45
  • @cfr Ok thanks. I'll try this and let you know if any – Faouzi Bellalouna Nov 07 '17 at 06:57
  • Good morning. I recall again for your beautiful macro. I want to let dotted empty space for solutions of exercises in my textbooks so I need something based on the command \fillwithdottedlines, but I need it with a variable height, so with a parameter depending on the "tail" of the solution... something like \fillwithdottedlines{\heightof{solution_of_exercise}}. How can I obtain this ? – Faouzi Bellalouna Nov 30 '17 at 08:43