1

im trying to modify the business card template from ShareLatex in order to make a card seperatly (as a command) for formating of the card. Then to make a foreach loop to make two columns of these cards. Notice the \singlecard command is a card template from OverLeaf (all right go to respective owners).

While making the loop I get an error message saying :

<h1>improper \prevdepth.</h1>
\tp@commonendtextblock...P@prevdepth=\prevdepth
                         \prevdepth=-1000pt\expan...

i think this is the error thats adding a =-1000pt= in the pdf

I define the card as :

\newcommand*{\singlecard}{
    \begin{textblock}{6.5}(0.2,0.2)
        %\noindent
        \textbf{Helena Doe}\\
        \tiny subtitle \hfill {\color{gray}Division / Employer}\\ 
        \rule{3in}{.3mm}\\
        \begin{minipage}[t]{33mm}
            \vspace{-0mm}%
            \includegraphics[height=25mm]{logo}
        \end{minipage}
        \hspace{1mm}
        \begin{minipage}[t]{42mm}
            \vspace{-0mm}%
            \begin{flushleft}
            {\scriptsize
    %            \begin{Spacing}{1}%
                \textbf{Job Title}\\
                \hspace{5mm}Speciality 1\\
                \hspace{5mm}Speciality 2\\
                \hspace{5mm}Speciality 3 \vspace{2mm}\\
    %            \end{Spacing}
            }
            {\tiny
                \begin{tabular}{rl}
                    {\color{gray}web} & https://fqdn/\\
                    {\color{gray}email} & helena@univ.edu\\
                    {\color{gray}email} & hxr42@gmail.com\\
                    {\color{gray}mobile} & +1 123 456 7890\\
                \end{tabular}
                \vspace*{2mm}
            }
            \end{flushleft}
        \end{minipage}
        \rule{74mm}{0mm}\\
        \texttt{\fontsize{2.84mm}{3.55mm}\selectfont 425B 030A B8D2 0316 CA1B 4709 CA83 5DDA EC31 CA56} % GPG KEY ID
    \end{textblock}
}

and i repeat it in the document this way:

\begin{tikzpicture}

% grid
\foreach \i in {0,1,2,3,4,5} \draw[very thin, gray,dashed] (0,\i*\cardh) -- (2*\cardw,\i*\cardh);
\foreach \j in {0,1,2} \draw[very thin, gray,dashed] (\j*\cardw,0) -- (\j*\cardw,5*\cardh);
% card content
\foreach \i in {0,1} \foreach \j in {0,1,2,3,4} {
    \node at (\i*\cardw+\i*1,\j*\cardh) {\singlecard};
};
\end{tikzpicture}

here is the entire code for testing:

% BUSINESS CARD template
% created by Karol Kozioł (www.karol-koziol.net)
% for ShareLaTeX - online LaTeX editor (www.sharelatex.com)
% May 2013

\documentclass[10pt]{letter}
\usepackage[dvips]{graphicx}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage{hyperref}
\usepackage{fontawesome}
\usepackage{standalone}
\RequirePackage[showboxes]{textpos}

\usepackage{geometry}
\geometry{
    letterpaper,
    total={8.5in,11in},
    left=0.5in,
    top=0.5in,
}

\pagestyle{empty}

\renewcommand\familydefault{\sfdefault}
\usepackage{tgadventor}

%%% BUSINESS CARD SIZE
\newlength{\cardw}
\newlength{\cardh}
%% ISO 7810 size: 85.60mm × 53.98mm
%\setlength{\cardw}{85.60mm}
%\setlength{\cardh}{53.98mm}
%% European size: 85mm × 55mm
%\setlength{\cardw}{85mm}
%\setlength{\cardh}{55mm}
%% US size: 3.5 in × 2 in
\setlength{\cardw}{3.5in}
\setlength{\cardh}{2in}

\definecolor{maingreen}{HTML}{008000}

% Command for printing the contact information icons
\newcommand*\icon[1]{\tikz[baseline=(char.base)]{\node[shape=circle,draw,inner sep=1pt, fill=maingreen,maingreen,text=white] (char) {#1};}}

%%% DEFINE USER DATA
\newcommand{\Name}{
{\huge \textbf{Joe Doe}}
}%
\newcommand{\Description}{
{\large CEO of XYZ Company}
}%
\newcommand{\Email}{
joe.doe@emails.com
}%
\newcommand{\Phone}{
+44 123456789
}%
%%%
% \textsc{\icon{\faLinkedin}} & \underline{\href{http://www.linkedin.com/in/\cvlinked}{\cvlinked}}
\newcommand*{\singlecard}{
    \begin{textblock}{6.5}(0,0)
        %\noindent
        \textbf{Helena Doe}\\
        \tiny subtitle \hfill {\color{gray}Division / Employer}\\ 
        \rule{3in}{.3mm}\\
        \begin{minipage}[t]{33mm}
            \vspace{-0mm}%
            \includegraphics[height=25mm]{logo}
        \end{minipage}
        \hspace{1mm}
        \begin{minipage}[t]{42mm}
            \vspace{-0mm}%
            \begin{flushleft}
            {\scriptsize
    %            \begin{Spacing}{1}%
                \textbf{Job Title}\\
                \hspace{5mm}Speciality 1\\
                \hspace{5mm}Speciality 2\\
                \hspace{5mm}Speciality 3 \vspace{2mm}\\
    %            \end{Spacing}
            }
            {\tiny
                \begin{tabular}{rl}
                    {\color{gray}web} & https://fqdn/\\
                    {\color{gray}email} & helena@univ.edu\\
                    {\color{gray}email} & hxr42@gmail.com\\
                    {\color{gray}mobile} & +1 123 456 7890\\
                \end{tabular}
                \vspace*{2mm}
            }
            \end{flushleft}
        \end{minipage}
        \rule{74mm}{0mm}\\
        \texttt{\fontsize{2.84mm}{3.55mm}\selectfont 425B 030A B8D2 0316 CA1B 4709 CA83 5DDA EC31 CA56} % GPG KEY ID
    \end{textblock}
}

\begin{document}

    \begin{tikzpicture}


        % grid
        \foreach \i in {0,1,2,3,4,5} \draw[very thin, gray] (0,\i*\cardh) -- (2*\cardw,\i*\cardh);
        \foreach \j in {0,1,2} \draw[very thin, gray] (\j*\cardw,0) -- (\j*\cardw,5*\cardh);
        % card content
        \foreach \i in {0,1} \foreach \j in {0,1,2,3,4} {
            \node at (\i*\cardw,\j*\cardh + \cardh) {\singlecard};
        };

    \end{tikzpicture}

\end{document}

and this is the output: output of tex file

  • it would be much easier to answer if your example was complete but the error means that you are in horizontal mode, so probably you want to give the outer \node a width so it becomes a minipage for your \singlecard, or just put \dimendef\prevdepth=0 to disable prevdepth – David Carlisle Jan 30 '17 at 23:42
  • There is a link to the full example which is in a sharelatex project. for the node width i tried like this \foreach \i in {0,1} \foreach \j in {0,1,2,3,4} { \node[width = 3.5in] at (\i*\cardw+\i*1,\j*\cardh) {\singlecard}; }; but the \dimendef\prevdepth=0 worked really well! thanks! – RenéB Jan 30 '17 at 23:57
  • yes but people often don't follow external links, and this question is archived forever and will make less sense if the sharelatex link goes after some time. It is always best to make a small example on site. – David Carlisle Jan 31 '17 at 0:25
3

The error means that you are in horizontal mode, you can disable \prevdepth by a declaration

  \dimendef\prevdepth=0

before the card which makes \prevdepth locally an alias for \dimen0

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.