Article View: comp.text
Article #1448Help with repeating commands in LaTeX
From: Earle Ake
Date: Sun, 14 Jan 1990 14:30
Date: Sun, 14 Jan 1990 14:30
60 lines
2027 bytes
2027 bytes
I am trying to come up with a way of not putting in 50 or so of the
same thing when I want to make up a checklist in a tabular environment of
LaTeX. I tried to use the \loop...\repeat construct but to no avail. Has
anyone else done this and if so how? Any help would be appreciated. Thanks
in advance. Example of what I would like to do is below:
%
%
% Some sort of macro to do a \duplicate{command}{number-of-times}
%
%
\newcount\n
\def\duplicate#1#2{\n=0
\loop\ifnum\n<#2 \advance\n by1
{#1} % \endgraf
\repeat}
\documentstyle{article}
\pagestyle{empty}
\begin{document}
%
%
% Just a little tabular environment here
%
%
\begin{tabular}{p{1.5in}p{1.0in}p{1.0in}p{1.8in}}
\multicolumn{1}{c}{\rule{1.3in}{0pt}}
& \multicolumn{1}{c}{\rule{0.8in}{0pt}}
& \multicolumn{1}{c}{\rule{0.8in}{0pt}}
& \multicolumn{1}{c}{\rule{1.6in}{0pt}} \\
\hline
%
%
% I don't want to put 50 or so of the following line in the TeX file. Would
% some form of repeat work here?
%
%
\duplicate{
\multicolumn{1}{c}{\rule{1.3in}{1pt}}
& \multicolumn{1}{c}{\rule{0.8in}{1pt}}
& \multicolumn{1}{c}{System\rule{0.2in}{0pt}User}
& \multicolumn{1}{c}{Readonly\rule{0.2in}{0pt}Read/Write}\\
}{5}
\end{tabular}
\end{document}
--
_____________________________________________________________________________
____ ____ ___
Earle Ake /___ /___/ / / Science Applications International Corporation
____// / / /__ Dayton, Ohio
-----------------------------------------------------------------------------
Internet: fac2%dayton.saic.com@uunet.uu.net uucp: uunet!dayvb!fac2
Technical Details
Message-ID:
<907.25b046af@dayton.saic.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!dayton.saic.com!fac2Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!dayton.saic.com!fac2 From: fac2@dayton.saic.com (Earle Ake) Newsgroups: comp.text Subject: Help with repeating commands in LaTeX Message-ID: <907.25b046af@dayton.saic.com> Date: 14 Jan 90 14:30:23 GMT Organization: Science Applications Intl. Corp., Dayton, Ohio Lines: 60