7

I was able to make a single business card that is 3in x 2.5in. However, I am having problems find a script that will repeat it 10 times on a page without a frame.

This is what I am currently using (the second set of code on the bottom half of the post). What I want is a script that will repeat the pdf file 10 times but with guidelines similar to this.

Updated:

\documentclass{article}
\usepackage{stackengine}
\usepackage{graphicx}
\usepackage{fullpage}
\usepackage[top=.5in, bottom=.5in,right=1.25in,left=1.25in, paperheight=11in, paperwidth=8.5in]{geometry}

\begin{document}
\pagestyle{empty}
\def\myimg{\protect\includegraphics[]{BusinessCards.pdf}}
\def\myhgap{\protect\hspace{1pt}}
\setstackgap{S}{1pt}
\Shortstack
{{\myimg\myhgap\myimg} {\myimg\myhgap\myimg} {\myimg\myhgap\myimg} 
  {\myimg\myhgap\myimg} {\myimg\myhgap\myimg}}
\end{document}
emka
  • 215

4 Answers4

4

If emka.pdf is the PDF file that contains the business card, you can do

\documentclass{article}
\usepackage[
  paperwidth=8in,   %???
  paperheight=13in, %???
  textwidth=6in,
  textheight=12.5in
]{geometry}
\usepackage{graphicx}
\newcommand{\putpic}{%
  \includegraphics{emka.pdf}\includegraphics{emka.pdf}\par}

\begin{document}
\setlength{\parindent}{0pt}
\offinterlineskip
\putpic
\putpic
\putpic
\putpic
\putpic
\end{document}

Set the precise dimensions of your paper; five rows won't fit on Letter or A4 paper.

enter image description here

egreg
  • 1,121,712
2

I put a 1ex gap between images, which can be changed with the \myhgap definition and \myvgap. The size of the graphic is immaterial to the approach, except insofar as you have enough margin to contain them.

EDITED to center result vertically and horizontally on page.

REDITED to provide registration marks for cutting. Also, cleaned up code, for proper vertical spacing.

\documentclass{article}
\usepackage{stackengine}
\usepackage{graphicx}
\newlength\plusheight
\newlength\stackvgap
%%%
\def\myvgap{1ex}
\def\myhgap{1ex}
%%%
\addtolength\textheight{.8in}
\def\myimg{\protect\includegraphics[scale=.4]{iV9q1}}
%  \def\myimg{\protect\rule{1in}{1in}}% THIS CAN BE USED TO CHECK GAP SPACING
\def\myimgwd{\widthof{\myimg}-\widthof{+}}
\def\imgline{\myimg\protect\hspace{\myhgap}\myimg}
\def\seperatorline{+\protect\rule{\myimgwd+\myhgap}{0pt}%
  +\protect\rule{\myimgwd+\myhgap}{0pt}+}
\setlength\plusheight{\heightof{+}}
\addtolength\plusheight{\depthof{+}}
\setlength\stackvgap{\myvgap-\the\plusheight}
\setlength\stackvgap{.5\stackvgap}
\setstackgap{S}{\the\stackvgap}
\begin{document}
\centering
\vfill
\Shortstack{%
 {\seperatorline}
 {\imgline} {\seperatorline}
 {\imgline} {\seperatorline}
 {\imgline} {\seperatorline}
 {\imgline} {\seperatorline}
 {\imgline} {\seperatorline}}
\vfill
\end{document}

enter image description here

  • I'm trying to experiment with your method, but I keep getting this error: stackengine.sty not found. – emka Jul 30 '13 at 20:49
  • @emka The package is relatively new. Most LaTeX installations will authomatically download new packages as needed. Yours apparently does not. It can be found at http://ctan.org/tex-archive/macros/latex/contrib/stackengine. If you put the .sty file in your current directory, it should compile. But in the long term, that file should be placed in your local LaTeX repository (which depends on which version of LaTeX you are using...) Let me know if you get over the hump with this reply. – Steven B. Segletes Jul 30 '13 at 20:51
  • @emka - Also, the image I loaded (iV9q1) was grabbed off the web. Please use an image file that you have on your local machine. – Steven B. Segletes Jul 30 '13 at 20:52
  • I modified your code a bit. I'm now stuck trying to center my block of business cards. Basically the block of 10 cards is way off center even though I have set the margins. – emka Jul 30 '13 at 21:58
  • Thanks! This is my last question. It there a way to introduce some sort of guide so I can cut them relatively evenly? Like a line or a cross so I can line them up with a paper cutter? – emka Jul 30 '13 at 22:42
  • @emka see revision for registration marks – Steven B. Segletes Jul 30 '13 at 23:21
1

First, compile the following code (using latex --> dvips --> ps2pdf) in the file single.tex:

\documentclass[11pt,a4paper]{memoir}

\usepackage{pst-barcode}

\setstocksize{55mm}{85mm} % UK Stock size
\setpagecc{55mm}{85mm}{*}
\settypeblocksize{45mm}{75mm}{*}
\setulmargins{5mm}{*}{*}
\setlrmargins{5mm}{*}{*}

\setheadfoot{0.1pt}{0.1pt}
\setheaderspaces{1pt}{*}{*}

\checkandfixthelayout[fixed]

\pagestyle{empty}

% Code for the card.
\newcommand*\BusinessCard{%
    %\pagecolor[cmyk]{.22,.36,.51,.08}%
    \begin{Spacing}{0.75}%
    \noindent
    \textbf{Alexander~Slesarev}\\
    \rule{74mm}{1mm}\\
    \begin{minipage}[t]{30mm}
        \vspace{-1.5mm}%
        \begin{pspicture}(30mm,30mm)
            % The MECARD format is used to exchange contact information. More information at:
            % http://www.nttdocomo.co.jp/english/service/imode/make/content/barcode/function/application/addressbook/index.html
            \psbarcode{MECARD:N:Slesarev,Alexander;TEL:+16047165085;EMAIL:alex.slesarev@gmail.com;URL:http://nuald.blogspot.com;;}{eclevel=L width=1.15 height=1.15}{qrcode}
        \end{pspicture}
    \end{minipage}
    \hspace{1mm}
    \begin{minipage}[t]{42mm}
        \vspace{-1mm}%
        \begin{flushleft}
        {\scriptsize
            \begin{Spacing}{1}%
            \textbf{IT Specialist}\\
            \hspace{5mm}Software Development\\
            \hspace{5mm}Security Researcher\\
            \hspace{5mm}High Load Systems\vspace{9mm}\\
            \end{Spacing}
        }
        {\tiny
            \textbf{email:} alex.slesarev@gmail.com\\
            \textbf{phone:} 604-716-5085\\
            \textbf{web:} http://nuald.blogspot.com/\\
            \vspace*{2mm}
        }
        \end{flushleft}
    \end{minipage}
    \rule{74mm}{1mm}
    \end{Spacing}
}

\begin{document}

\BusinessCard
\BusinessCard
\BusinessCard
\BusinessCard
\BusinessCard 
\BusinessCard
\BusinessCard
\BusinessCard
\BusinessCard
\BusinessCard

\end{document}

Next, compile the following code (using pdflatex):

\documentclass{article}

\usepackage{pdfpages}

\newcommand*\TheCards{\includepdf[nup=2x5,pages=-]{single}}

\begin{document}

\TheCards
\TheCards
\TheCards

\end{document}

Is this what you are looking for?


An improvement (in my opinion) to the card is if you use the url package:

\documentclass[11pt,a4paper]{memoir}

\usepackage{pst-barcode}
\usepackage{url}

\setstocksize{55mm}{85mm} % UK Stock size
\setpagecc{55mm}{85mm}{*}
\settypeblocksize{45mm}{75mm}{*}
\setulmargins{5mm}{*}{*}
\setlrmargins{5mm}{*}{*}

\setheadfoot{0.1pt}{0.1pt}
\setheaderspaces{1pt}{*}{*}

\checkandfixthelayout[fixed]

\pagestyle{empty}

% Code for the card.
\newcommand*\BusinessCard{%
    %\pagecolor[cmyk]{.22,.36,.51,.08}%
    \begin{Spacing}{0.75}%
    \noindent
    \textbf{Alexander~Slesarev}\\
    \rule{74mm}{1mm}\\
    \begin{minipage}[t]{30mm}
        \vspace{-1.5mm}%
        \begin{pspicture}(30mm,30mm)
            % The MECARD format is used to exchange contact information. More information at:
            % http://www.nttdocomo.co.jp/english/service/imode/make/content/barcode/function/application/addressbook/index.html
            \psbarcode{MECARD:N:Slesarev,Alexander;TEL:+16047165085;EMAIL:alex.slesarev@gmail.com;URL:http://nuald.blogspot.com;;}{eclevel=L width=1.15 height=1.15}{qrcode}
        \end{pspicture}
    \end{minipage}
    \hspace{1mm}
    \begin{minipage}[t]{42mm}
        \vspace{-1mm}%
        \begin{flushleft}
        {\scriptsize
            \begin{Spacing}{1}%
            \textbf{IT Specialist}\\
            \hspace{5mm}Software Development\\
            \hspace{5mm}Security Researcher\\
            \hspace{5mm}High Load Systems\vspace{9mm}\\
            \end{Spacing}
        }
        {\tiny
            \textbf{email:} \url{alex.slesarev@gmail.com}\\
            \textbf{phone:} 604-716-5085\\
            \textbf{web:} \url{http://nuald.blogspot.com/}\\
            \vspace*{2mm}
        }
        \end{flushleft}
    \end{minipage}
    \rule{74mm}{1mm}
    \end{Spacing}
}

\begin{document}

\BusinessCard 
\BusinessCard 
\BusinessCard
\BusinessCard  
\BusinessCard  
\BusinessCard 
\BusinessCard  
\BusinessCard 
\BusinessCard
\BusinessCard

\end{document}

(Compare the email address and website.)

P.S. I have adjusted the \vspace at the beginning of the {minipage} enviroment in order the vertivally center it relativt to the text.

P.P.S. The drawing of the card is not done using good LaTeX code, but it works. :)

ShreevatsaR
  • 45,428
  • 10
  • 117
  • 149
0

If you download the (free) Sage computer algebra system then the sagetex package gives you the power of Sage and Python. Since all you need is a simple for loop you don't have to worry about learning the languages.

\documentclass{article}%
\usepackage{sagetex}
\usepackage{graphics}
\pagestyle{empty} % removes page numbers
\textwidth 22.00cm % 21.59cm
\textheight 27.94cm
\topmargin -1.75in % was -1.0
\headheight 0in
\headsep 0in
\oddsidemargin -0.5in % ok fits A4 paper

\begin{document}
\noindent
\setlength{\unitlength}{1in}
\begin{sagesilent}
output = ""
output += r"\begin{picture}(8.5,11)(0.0,0.3937)\\"
for i in range(0,5):
    output += r"\put(0,%d){\includegraphics*{BusinessCards.pdf}}\\"%(2*i)

for i in range(0,5):
    output += r"\put(3.5,%d){\includegraphics*{BusinessCards.pdf}}\\"%(2*i)
output += r"\end{picture}"
\end{sagesilent}
\sagestr{output}
\end{document}

The sagesilent environment creates a string, which I've called output, that contains the code to put the BusinessCards.pdf where you want. By using 2 for loops, your scripting needs are filled. At the end of the process, all the LaTeX code you wanted is in the string output, so we leave sagesilent. Whenever you want to insert that code into your document, use\sagestr{output}. As you can see, using Python makes the code more readable. The r is for raw string since the "...backslash character is used to escape characters that otherwise have a special meaning".

DJP
  • 12,451