0

I'm trying to create an inventory sheet for our lab, and as such I need a large blank table. Is there a better way to do this then copy and pasting \midrule&&&\\ over and over again?

I'd like to look like this, but automatically repeat the blank cells until the page is full:

%Page layout here
\documentclass[letterpaper, 12pt,twocolumn]{article}
\usepackage[left= 2 cm, right=2 cm, top = 2 cm, bottom = 2 cm]{geometry}

%Font stuff here
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

%Goddamn tables.
\usepackage{booktabs} %Makes the pretty table based on wikibooks example

\begin{document}

\centering
{\large
\begin{tabular}{c|c|c|c}
\toprule
Date & User & Amount Used & Procedure\\
\phantom{2015-3-17} & \phantom{NAME} & (mg) &  \phantom{XXX3-33}\\
\midrule
&&&\\
\midrule
&&&\\
\midrule&&&\\
\midrule&&&\\
\midrule&&&\\
\bottomrule
\end{tabular}
}
\end{document}

Note: I'm just using Booktabs to add the midrule, that can be dropped. This is just going on a clipboard on the wall, it can be ugly as you want. I'm just sick of fighting with Word's hellish layout tools.

Edit: There is this answer that places blank lines in the middle, but I don't understand the code nearly enough to modify it to fill to the end of the page.

  • 1
    oh, golly, this would be so easy in plain tex, but i'm resisting temptation. – barbara beeton Mar 18 '15 at 13:01
2

David Carlisle has gotten me most of the way to a solution, so I thought I'd post it:

%Page layout here
\documentclass[letterpaper, 12pt,twocolumn]{article}
\usepackage[left= 1 cm, right=1 cm, top = 2 cm, bottom = 1 cm]{geometry}

\newlength\linefillheight % vertical distance between lines
\setlength\linefillheight{1cm}

\newlength\wcolone %first column width
\setlength\wcolone{\dimexpr.125\textwidth-4mm\relax}
\newlength\wcoltwo %second column width
\setlength\wcoltwo{\dimexpr.125\textwidth-4mm\relax}
\newlength\wcolthree % third column width
\setlength\wcolthree{\dimexpr.125\textwidth-4mm\relax}
\newlength\wcolfour % third column width
\setlength\wcolfour{\dimexpr.125\textwidth-4mm\relax}

\newcommand\linefill{\leavevmode
    \rule{\wcolone}{0.4pt}\hspace*{4mm}\rule{\wcoltwo}{0.4pt}\hspace*{4mm}\rule{\wcolthree}{0.4pt}\hspace*{4mm}\rule{\wcolfour}{0.4pt}}

\makeatletter
\def\fillwithlines#1{%
  \begingroup
  \ifhmode
    \par
  \fi
  \hrule height 0pt
  \nobreak
  \cleaders\hbox to \hsize{\hskip \@totalleftmargin
          \vrule height \linefillheight depth 0pt width 0pt
          \linefill} \vskip #1 \hbox{}%
  \endgroup}
\makeatother


\begin{document}

\noindent\begin{minipage}[c][1cm][t]{\textwidth}
\parbox{\dimexpr\wcolone+4mm\relax}{\textbf{\centering Date}}%
\parbox{\dimexpr\wcoltwo+4mm\relax}{\textbf{\centering User}}%
\parbox{\dimexpr\wcoltwo+4mm\relax}{\textbf{\centering Amount Used\\mg}}%
\parbox{\dimexpr\wcoltwo+4mm\relax}{\textbf{\centering Procedure}}%
\end{minipage}

\fillwithlines{\dimexpr\textheight-1cm\relax}

\noindent\begin{minipage}[c][1cm][t]{\textwidth}
\parbox{\dimexpr\wcolone+4mm\relax}{\textbf{\centering Date}}%
\parbox{\dimexpr\wcoltwo+4mm\relax}{\textbf{\centering User}}%
\parbox{\dimexpr\wcoltwo+4mm\relax}{\textbf{\centering Amount Used\\mg}}%
\parbox{\dimexpr\wcoltwo+4mm\relax}{\textbf{\centering Procedure}}%
\end{minipage}

\fillwithlines{\dimexpr\textheight-1cm\relax}
\end{document}

Based on this answer. However, I'd like to be able to centre the column headers and draw a line down the middle, if anyone could help with this.

some minor tweaks:

\documentclass[letterpaper, 12pt,twocolumn]{article}
\usepackage[left= 1 cm, right=1 cm, top = 2 cm, bottom = 1 cm]{geometry}

\newlength\linefillheight % vertical distance between lines
\setlength\linefillheight{1cm}

\newlength\wcolone %first column width
\setlength\wcolone{\dimexpr.125\textwidth-4mm-1.25pt\relax}
\newlength\wcoltwo %second column width
\setlength\wcoltwo{\dimexpr.125\textwidth-4mm-1.25pt\relax}
\newlength\wcolthree % third column width
\setlength\wcolthree{\dimexpr.125\textwidth-4mm-1.25pt\relax}
\newlength\wcolfour % third column width
\setlength\wcolfour{\dimexpr.125\textwidth-4mm-1.25pt\relax}

\newcommand\linefill{\leavevmode
    \rule{\wcolone}{0.4pt}\hspace*{4mm}\rule{\wcoltwo}{0.4pt}\hspace*{4mm}\rule{\wcolthree}{0.4pt}\hspace*{4mm}\rule{\wcolfour}{0.4pt}}

\makeatletter
\def\fillwithlines#1{%
  \begingroup
    \par
  \hrule height 0pt
  \nobreak
  \cleaders\hbox to \hsize{%
          \vrule height \linefillheight depth 0pt width 0pt
          \hss\linefill\hss} \vskip #1 \hbox{}%
  \endgroup}
\makeatother\showoutput

\setlength\columnseprule{1pt}

\begin{document}


\noindent\begin{minipage}[c][1cm][t]{\linewidth}
\parbox{\dimexpr\wcolone+4mm\relax}{\centering\textbf{Date}}%
\parbox{\dimexpr\wcoltwo+4mm\relax}{\centering\textbf{User}}%
\parbox{\dimexpr\wcoltwo+4mm\relax}{\centering\textbf{Amount Used\\mg}}%
\parbox{\dimexpr\wcoltwo+4mm\relax}{\centering\textbf{Procedure}}%
\end{minipage}

\fillwithlines{\dimexpr\textheight-1cm\relax}

\noindent\begin{minipage}[c][1cm][t]{\linewidth}
\parbox{\dimexpr\wcolone+4mm\relax}{\centering\textbf{Date}}%
\parbox{\dimexpr\wcoltwo+4mm\relax}{\centering\textbf{User}}%
\parbox{\dimexpr\wcoltwo+4mm\relax}{\centering\textbf{Amount Used\\mg}}%
\parbox{\dimexpr\wcoltwo+4mm\relax}{\centering\textbf{Procedure}}%
\end{minipage}

\fillwithlines{\dimexpr\textheight-1cm\relax}
\end{document}

In chat you said you wanted single column with 7 headings...

\documentclass[letterpaper, 12pt]{article}
\usepackage[left= 1 cm, right=1 cm, top = 2 cm, bottom = 1 cm]{geometry}

\newlength\linefillheight % vertical distance between lines
\setlength\linefillheight{1cm}
\usepackage[T1]{fontenc}

\newcommand\linefill{\hspace{\stretch{.5}}%
    \rule{.1\textwidth}{0.4pt}\hfill
    \rule{.1\textwidth}{0.4pt}\hfill
    \rule{.1\textwidth}{0.4pt}\hfill
    \rule{.1\textwidth}{0.4pt}\hfill
    \rule{.1\textwidth}{0.4pt}\hfill
    \rule{.1\textwidth}{0.4pt}\hfill
    \rule{.1\textwidth}{0.4pt}\hspace{\stretch{.5}}%
}

\makeatletter
\def\fillwithlines#1{%
  \begingroup
    \par
  \hrule height 0pt
  \nobreak
  \cleaders\hbox to \hsize{%
          \vrule height \linefillheight depth 0pt width 0pt
          \linefill} \vskip #1 \hbox{}%
  \endgroup}
\makeatother

\setlength\columnseprule{1pt}

\begin{document}


\noindent\begin{minipage}[c][1cm][t]{\linewidth}
\parbox[t]{\dimexpr\linewidth/7\relax}{\centering\textbf{Date}}%
\parbox[t]{\dimexpr\linewidth/7\relax}{\centering\textbf{User}}%
\parbox[t]{\dimexpr\linewidth/7\relax}{\centering\textbf{Amount Used\\mg}}%
\parbox[t]{\dimexpr\linewidth/7\relax}{\centering\textbf{Procedure}}%
\parbox[t]{\dimexpr\linewidth/7\relax}{\centering\textbf{User}}%
\parbox[t]{\dimexpr\linewidth/7\relax}{\centering\textbf{Amount Used\\mg}}%
\parbox[t]{\dimexpr\linewidth/7\relax}{\centering\textbf{Procedure}}%
\end{minipage}

\fillwithlines{\dimexpr\textheight-1cm\relax}
\end{document}
|improve this answer|||||
  • Great, thank you. Now if only I could get the column headers centered it would be perfect. – Canageek Mar 18 '15 at 18:06
  • Answer updated. – David Carlisle Mar 18 '15 at 23:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.