Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

enter image description hereI am trying to make a sign in sheet with multiple rules that generates however many fields I need for different occasions. I've got a working solution but I can't figure out how to make it so that each entry has two or three rules if necessary. Here's my code so far.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{article}

\usepackage[top=1in, right=1in, left=1in, bottom=1in]{geometry}
\usepackage{mathspec}
\setmainfont{Times New Roman}
\setmonofont{Lucida Sans Typewriter}

\usepackage{titling}

\title{ Computer Sign In Sheet}
\author{\ttfamily Physics Department}

\date{}

\usepackage{mathabx}

\usepackage{xkeyval}
\makeatletter
\define@key{setpar}{left}[0pt]{\leftmargin=#1}
\define@key{setpar}{right}[0pt]{\rightmargin=#1}
\define@key{setpar}{both}{\leftmargin=#1\relax\rightmargin=#1}

\usepackage{titling, xcolor}
\definecolor{title}{HTML}{000000}
\definecolor{title2}{HTML}{000000}
\pretitle{\begin{center}\hspace{0cm}\Huge\textcolor{title} \ttfamily}     % %% center can also be flushrig%     
\posttitle{\par\end{center} }                                                 %% don't use centering %%%%
\preauthor{\begin{center}\large\rmfamily\vskip 0mm  }           %%%% \scshape give small caps fonts %%%
\postauthor{\end{center}  }
\predate{\begin{center}\large\scshape \vskip -1cm}
\postdate{\end{center} \vskip 2mm}


\usepackage{calc}





\newenvironment{instructions}[1][both=1.5in]
  {\normalsize\list{}{\setkeys{setpar}{left,right}%
     \setkeys{setpar}{#1}%
     \listparindent=0em
     \topsep=0pt
     \partopsep=0pt
     \parsep=0ex}\item\relax\hspace{\listparindent}\ignorespaces}
  {\endlist\vspace{3ex}}




\begin{document}

\ttfamily

\maketitle

\rmfamily



\begin{instructions}
Please sign your name below on the line corresponding to the computer that you are going to use for the day.  You must sign for the computer in order to borrow it.  Please sign in all of your group members.  Thank you.
\end{instructions}

\vspace{5ex}
%\setlength{\parindent}{0ex}


\newcounter{computer}



    \newcommand{\makelines}[1]{  \mbox{\noindent Computer no. #1 \rule{0.35\textwidth }{0.1 ex} }} 




\setcounter{computer}{1}
      \noindent
      \@whilenum{\value{computer}<20}\do{%
         \makelines{\thecomputer}\vspace{2em} \hfill%
         \addtocounter{computer}{1}}%
      \newpage\stepcounter{computer} 



\end{document}
share|improve this question
    
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. –  Heiko Oberdiek Oct 30 '13 at 20:57
    
I couldn't run this (needs XeTeX) to see what it looks like, but you might try using a tabular with \hline and | for the visible lines and struts or \makebox to create blank fields of a given size.. –  John Kormylo Oct 30 '13 at 23:05
    
My problem with tabular was I wanted automatic generation of the fields and I couldn't figure out how to do that with a tabular environment. –  ben Nov 1 '13 at 15:01
    
With only three possible outcomes, you could just code each and use \if \fi, or a separate .tex file for each. You still need some way to tell TeX how many computers (I assume that is the variable) to use. –  John Kormylo Nov 2 '13 at 11:34
    
If you want to pursue the tabular solution, you might find tex.stackexchange.com/questions/141920/… useful. If you could upload an image of what you are trying to achieve... –  John Kormylo Nov 2 '13 at 19:51

1 Answer 1

up vote 0 down vote accepted

I had to lose the mathspec to get it to run on my system. I assume this is what you meant by multiple rules. You realize that you are pushing into the right margin, hence the need for \mbox.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{article}

\usepackage[top=1in, right=1in, left=1in, bottom=1in]{geometry}
%\usepackage{mathspec}
%\setmainfont{Times New Roman}
%\setmonofont{Lucida Sans Typewriter}

\usepackage{titling}

\title{ Computer Sign In Sheet}
\author{\ttfamily Physics Department}

\date{}

\usepackage{mathabx}

\usepackage{xkeyval}
\makeatletter
\define@key{setpar}{left}[0pt]{\leftmargin=#1}
\define@key{setpar}{right}[0pt]{\rightmargin=#1}
\define@key{setpar}{both}{\leftmargin=#1\relax\rightmargin=#1}

\usepackage{titling, xcolor}
\definecolor{title}{HTML}{000000}
\definecolor{title2}{HTML}{000000}
\pretitle{\begin{center}\hspace{0cm}\Huge\textcolor{title} \ttfamily}     % %% center can also be flushrig%     
\posttitle{\par\end{center} }                                                 %% don't use centering %%%%
\preauthor{\begin{center}\large\rmfamily\vskip 0mm  }           %%%% \scshape give small caps fonts %%%
\postauthor{\end{center}  }
\predate{\begin{center}\large\scshape \vskip -1cm}
\postdate{\end{center} \vskip 2mm}

\usepackage{calc}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{xparse}

% \newcommand{\append}[2] #1=text to repeat, #2=number or repetitions
\ExplSyntaxOn
\DeclareExpandableDocumentCommand{\append}{mm}
 {
  \prg_replicate:nn{#2}{#1}
 }
\ExplSyntaxOff

\def\NumberRulesPerComputer{3}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newenvironment{instructions}[1][both=1.5in]
  {\normalsize\list{}{\setkeys{setpar}{left,right}%
     \setkeys{setpar}{#1}%
     \listparindent=0em
     \topsep=0pt
     \partopsep=0pt
     \parsep=0ex}\item\relax\hspace{\listparindent}\ignorespaces}
  {\endlist\vspace{3ex}}

\begin{document}

\ttfamily

\maketitle

\rmfamily

\begin{instructions}
Please sign your name below on the line corresponding to the computer that  you are going to use for the day.  You must sign for the computer in   order to borrow it.  Please sign in all of your group members.  Thank you.
\end{instructions}

\vspace{5ex}
\setlength{\parindent}{0ex}

\newcounter{computer}

\newcommand{\makelines}[1]{\mbox{Computer no. #1%
 \parbox[t]{0.35\textwidth}{\append{\rule{0pt}{3em}
 \rule{0.35\textwidth}{0.1 ex}\\}
 {\NumberRulesPerComputer}}}}

\setcounter{computer}{1}
      \noindent
      \@whilenum{\value{computer}<20}\do{%
         \makelines{\thecomputer}\vspace{2em} \hfill%
         \addtocounter{computer}{1}}%
      \newpage\stepcounter{computer} 

\end{document}
share|improve this answer
    
Mmmmmm, how does this answer the question? –  Werner Nov 2 '13 at 16:26
    
This works great –  ben Nov 9 '13 at 16:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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