foreach 루프가 있는 tikzpicture의 \prevlength가 부적절합니다.

foreach 루프가 있는 tikzpicture의 \prevlength가 부적절합니다.

나는 카드 포맷을 위해 별도로(명령으로) 카드를 만들기 위해 ShareLatex에서 명함 템플릿을 수정하려고 합니다. 그런 다음 foreach 루프를 만들어 이 카드의 두 열을 만듭니다. \singlecard 명령은 OverLeaf의 카드 템플릿입니다(모든 권한은 해당 소유자에게 있음).

루프를 만드는 동안 다음과 같은 오류 메시지가 나타납니다.

<h1>improper \prevdepth.</h1>
\[email protected]@prevdepth=\prevdepth
                         \prevdepth=-1000pt\expan...

=-1000pt=PDF에 를 추가하는 중 오류가 발생한 것 같습니다.

나는 카드를 다음과 같이 정의합니다.

\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} & [email protected]\\
                    {\color{gray}email} & [email protected]\\
                    {\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{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}

테스트를 위한 전체 코드는 다음과 같습니다.

% 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}{
[email protected]
}%
\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} & [email protected]\\
                    {\color{gray}email} & [email protected]\\
                    {\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}

출력은 다음과 같습니다. tex 파일 출력

답변1

오류는 수평 모드에 있음을 의미하며 \prevdepth선언으로 비활성화할 수 있습니다.

  \dimendef\prevdepth=0

\prevdepth로컬에서 별칭을 만드는 카드 앞에\dimen0

관련 정보