如何在 LaTeX 中打印相同的文件内容直至给定的次数?

如何在 LaTeX 中打印相同的文件内容直至给定的次数?

这是 MWE,假设我们给出的数字是 400,那么它应该在单个 pdf 文件中打印最多 400 页的页数。下面显示的起始页码是 0001。在此处输入图片描述

\PassOptionsToPackage{svgnames,x11names}{xcolor}
\documentclass[16pt,a4paper]{scrartcl}              %class
\usepackage[landscape,left=2cm,right=2cm,top=2.5cm,bottom=1cm]{geometry} %for layout
%\usepackage[landscape,left=2cm,right=2cm,top=0.5cm,bottom=2.5cm]{geometry} %for layout
\usepackage[english]{babel}
\usepackage{setspace} % for spacing between lines
\usepackage{graphicx}         %for including images
\usepackage{eso-pic}     %package for including background image
\usepackage{color,tikz,xcolor}
\usepackage{wallpaper,fancyhdr}
\usepackage{ulem,anyfontsize,pdflscape,calligra,niceframe}
\usepackage[T1]{fontenc}
\usepackage[object=vectorian]{pgfornament}
\usepackage{ragged2e,filecontents,tcolorbox}

\definecolor{mycolor}{rgb}{0, 0, 0}% Rule colour
\makeatletter
  \newcommand{\mybox}[1]{%
   \setbox0=\hbox{#1}%
   \setlength{\@tempdima}{\dimexpr\wd0+13pt}%
  \begin{tcolorbox}[colframe=mycolor,colback=mycolor,boxrule=0.5pt,arc=4pt,
      left=6pt,right=6pt,top=6pt,bottom=6pt,boxsep=0pt,width=\@tempdima]
      #1
    \end{tcolorbox}
    }
    \makeatother
    \usepackage{ifthen}
    \newboolean{long}

    \usepackage{fancyhdr}


    \renewcommand{\headrulewidth}{0pt}
    \fancypagestyle{plain}{%
    \fancyhf{}
    \fancyhead[R]{%
    \color{DarkRed}  \ifnum\value{page}<10\relax%
       000\arabic{page}%
       \else
       \ifnum\value{page}<100\relax%
       00\arabic{page}%
       \else
       0\arabic{page}
       \fi
       \fi
    }
    }
    %%==================================
    \usetikzlibrary{shapes.geometric,calc}  
    \definecolor{a}{rgb}{0,0.08,0.45}

    \definecolor{red}{rgb}{0.5,0,0}
    %---------------------------------------------------------------
    \newcommand\BackgroundPic{
    \put(0,0){
     \parbox[b][\paperheight]{\paperwidth}{%
    \vfill
    \centering
     \includegraphics[width=\paperwidth,height=\paperheight,
     keepaspectratio]{tiling.png}              % here include background image

     \vfill
     }}}
       %----------------------------------------------------------------
     %=============================
     \usepackage{datatool}  % This package is required to include database file as .csv 
                   % data.csv includes information from database
       %=============================

       \begin{filecontents}{scripture.csv}
        Condition, BibleVerse, BookName, Chapter, VerseNo
        false,Go therefore and make disciples in all the nation,Matthew,28,19
        \end{filecontents}
        \DTLloaddb{scripture}{scripture.csv} 
          %=============================
          %=============================

              %=============================
           \def\signature#1#2{\parbox[b]{1in}{\smash{#1}\vskip12pt}
            \hfill \parbox[t]{2.8in}{\shortstack{\vrule width 2.8in height 0.4pt\\\small#2}}}
             \def\sigskip{\vskip0.4in plus 0.1in}
             \def\beginskip{\vskip0.5875in plus 0.1in}
            %=============================


           %% Font styles start

            %\setcounter{page}{3000} %% set page numbering

            \input Elzevier.fd
            \newcommand*\initfamily{\usefont{U}{Elzevier}{xl}{n}}

             %% Font styles end


                \def\verrulefill#1{\leaders\hrule width 40pt height#1\hfill}

               \begin{document}


                \pagestyle{plain}

                 \vspace*{-28mm}


                    %% ====== Book Number coding starts here =======================
                  \vspace{-3.1mm}
                 {\flushleft \color{Black}\calligra Book No. \Large 01}\\
                  \hspace*{-1mm} {~}\\
                   %% ====== Book Number coding ends here ======================= 
                  \noindent
                   \hfill
                   %============================= 
                   \vspace*{-20mm}
                    \begin{minipage}[c]{8.3in}
                    {\centering
                    {\onehalfspacing
                     %\fontfamily{pzd}\selectfont

                      %\normalfont\initfamily
                      %  \hspace*{20mm} {\fontsize{30}{30}\bfseries\color{a} \underline{\it{CERTIFICATE OF BAPTISM}}}\\ 
                    \hspace*{50mm} {\fontsize{30}{30}\bfseries\color{black} \MakeUppercase{abc church}}\\
                    \vspace{2mm} 
                     \hspace*{50mm} {\fontsize{25}{25}\bfseries\color{black} {Love \& Service, Since 1920}}\\ 
                    \hspace*{48mm} {\fontsize{25}{25}\color{black} {Abc Road, P.O. Box-00, Ward No.00}}\\ 
                    \hspace*{48mm} {\fontsize{25}{25}\color{black} {ddd-123456, xyz, dyz.}}\\ 
                      \vspace{16mm}

                    }}
                  \end{minipage}

                  \vspace{25mm}
                \hspace*{80mm}\begin{minipage}[c]{6in}
                \mybox{\LARGE \bfseries \color{white} Baptism Certificate}
                 \end{minipage} 



                 \hfill

                 \noindent
                 \begin{minipage}[l]{1.5in}
                 \end{minipage}
                 \hfill

                %=============================
                \begin{minipage}[r]{1.0in}
                \end{minipage}
                 \hfill

                %=============================

                \vspace{0.5cm}
                \doublespacing

               %%============== Uncomment to get output as Black writing===========================
               {\fontsize{18}{18}{\it This is to certify that Mr./Mrs./Miss {{\rule[-0.5ex]{15.7cm}{1.0pt}}}\\ Son/Daughter/Wife of {\rule[-0.5ex]{17cm}{1pt}} inhabitant\\ of {\rule[-0.5ex]{10cm}{1.0pt}} in the ~District of {\rule[-0.5ex]{9.0cm}{1.0pt}}~ was baptised at Diphu Baptist Church and received into full membership on {\rule[-0.5ex]{7.0cm}{1.0pt}}.

                 }}
                 \vspace{6mm}
                 \noindent
                %\beginskip
                {\singlespacing 
                 \vfill
                \begin{minipage}[l]{2.8in}
                 \sigskip \signature{}{\bfseries\color{mycolor} Minister }
                \end{minipage}
                 \hfill
                 \hfill
                 \begin{minipage}[r]{2.8in}
                   \sigskip \signature{}{\bfseries\color{mycolor} Pastor \\ \small ABC Church }
                 \end{minipage}}

                 %=============================
               \vspace{2mm}
                 %\hrulefill\\
               \centering
               \noindent\rule[-1.0ex]{26cm}{1.0pt}\\
                 \hfill
      \DTLforeach{scripture}{\printverse=Condition, \bibleverse=BibleVerse,\bookname=BookName,\chapter=Chapter,\versen=VerseNo}{\setboolean{long}{\printverse}   
      \ifthenelse{\boolean{long}}{\justifying\fontsize{12}{12}\bfseries\it``\bibleverse''.~\textup{\bookname ~\chapter:\versen}}{} 
       \hfill
        \normalfont
       \pagebreak
        }
        \end{document}

答案1

虽然你应该已经熟悉我们的格式,因为你已经问过一些问题了,但这里有一个简短的版本:我只是遵循了关联我为您提供了该代码,并用它包围了您的代码。

\PassOptionsToPackage{svgnames,x11names}{xcolor}
\documentclass[14pt,a4paper]{scrartcl}              %class
\usepackage[landscape,left=2cm,right=2cm,top=2cm,bottom=1cm]{geometry} %for layout
%\usepackage[landscape,left=2cm,right=2cm,top=0.5cm,bottom=2.5cm]{geometry} %for layout
\usepackage[english]{babel}
\usepackage{setspace} % for spacing between lines
\usepackage{graphicx}         %for including images
\usepackage{eso-pic}     %package for including background image
\usepackage{color,tikz,xcolor}
\usepackage{wallpaper,fancyhdr}
\usepackage{ulem,anyfontsize,pdflscape,calligra,niceframe}
\usepackage[T1]{fontenc}
\usepackage[object=vectorian]{pgfornament}
\usepackage{ragged2e,filecontents,tcolorbox}

\definecolor{mycolor}{rgb}{0, 0, 0}% Rule colour
\makeatletter
  \newcommand{\mybox}[1]{%
   \setbox0=\hbox{#1}%
   \setlength{\@tempdima}{\dimexpr\wd0+13pt}%
  \begin{tcolorbox}[colframe=mycolor,colback=mycolor,boxrule=0.5pt,arc=4pt,
      left=6pt,right=6pt,top=6pt,bottom=6pt,boxsep=0pt,width=\@tempdima]
      #1
    \end{tcolorbox}
    }
    \makeatother
    \usepackage{ifthen}
    \newboolean{long}

    \usepackage{fancyhdr}


    \renewcommand{\headrulewidth}{0pt}
    \fancypagestyle{plain}{%
    \fancyhf{}
    \fancyhead[R]{%
    \color{DarkRed}  \ifnum\value{page}<10\relax%
       000\arabic{page}%
       \else
       \ifnum\value{page}<100\relax%
       00\arabic{page}%
       \else
       0\arabic{page}
       \fi
       \fi
    }
    }
    %%==================================
    \usetikzlibrary{shapes.geometric,calc}  
    \definecolor{a}{rgb}{0,0.08,0.45}

    \definecolor{red}{rgb}{0.5,0,0}
    %---------------------------------------------------------------
    \newcommand\BackgroundPic{
    \put(0,0){
     \parbox[b][\paperheight]{\paperwidth}{%
    \vfill
    \centering
     \includegraphics[width=\paperwidth,height=\paperheight,
     keepaspectratio]{tiling.png}              % here include background image

     \vfill
     }}}
       %----------------------------------------------------------------
     %=============================
     \usepackage{datatool}  % This package is required to include database file as .csv 
                   % data.csv includes information from database
       %=============================

       \begin{filecontents}{scripture.csv}
        Condition, BibleVerse, BookName, Chapter, VerseNo
        false,Go therefore and make disciples in all the nation,Matthew,28,19
        \end{filecontents}
        \DTLloaddb{scripture}{scripture.csv} 
          %=============================
          %=============================

              %=============================
           \def\signature#1#2{\parbox[b]{1in}{\smash{#1}\vskip12pt}
            \hfill \parbox[t]{2.8in}{\shortstack{\vrule width 2.8in height 0.4pt\\\small#2}}}
             \def\sigskip{\vskip0.4in plus 0.1in}
             \def\beginskip{\vskip0.5875in plus 0.1in}
            %=============================


           %% Font styles start

            %\setcounter{page}{3000} %% set page numbering

            \input Elzevier.fd
            \newcommand*\initfamily{\usefont{U}{Elzevier}{xl}{n}}

             %% Font styles end


                \def\verrulefill#1{\leaders\hrule width 40pt height#1\hfill}

\pagestyle{plain}
\usepackage{pgffor}

\begin{document}
\foreach \index in {1, ..., 400} {
                 \vspace*{-28mm}


                    %% ====== Book Number coding starts here =======================
                  \vspace{-3.1mm}
                 {\flushleft \color{Black}\calligra Book No. \Large 01}\\
                  \hspace*{-1mm} {~}\\
                   %% ====== Book Number coding ends here ======================= 
                  \noindent
                   \hfill
                   %============================= 
                   \vspace*{-20mm}
                    \begin{minipage}[c]{8.3in}
                    {\centering
                    {\onehalfspacing
                     %\fontfamily{pzd}\selectfont

                      %\normalfont\initfamily
                      %  \hspace*{20mm} {\fontsize{30}{30}\bfseries\color{a} \underline{\it{CERTIFICATE OF BAPTISM}}}\\ 
                    \hspace*{50mm} {\fontsize{30}{30}\bfseries\color{black} \MakeUppercase{abc church}}\\
                    \vspace{2mm} 
                     \hspace*{50mm} {\fontsize{25}{25}\bfseries\color{black} {Love \& Service, Since 1920}}\\ 
                    \hspace*{48mm} {\fontsize{25}{25}\color{black} {Abc Road, P.O. Box-00, Ward No.00}}\\ 
                    \hspace*{48mm} {\fontsize{25}{25}\color{black} {ddd-123456, xyz, dyz.}}\\ 
                      \vspace{16mm}

                    }}
                  \end{minipage}

                  \vspace{25mm}
                \hspace*{80mm}\begin{minipage}[c]{6in}
                \mybox{\LARGE \bfseries \color{white} Baptism Certificate}
                 \end{minipage} 



                 \hfill

                 \noindent
                 \begin{minipage}[l]{1.5in}
                 \end{minipage}
                 \hfill

                %=============================
                \begin{minipage}[r]{1.0in}
                \end{minipage}
                 \hfill

                %=============================

                \vspace{0.5cm}
                \doublespacing

               %%============== Uncomment to get output as Black writing===========================
               {\fontsize{18}{18}{\it This is to certify that Mr./Mrs./Miss {{\rule[-0.5ex]{15.7cm}{1.0pt}}}\\ Son/Daughter/Wife of {\rule[-0.5ex]{17cm}{1pt}} inhabitant\\ of {\rule[-0.5ex]{10cm}{1.0pt}} in the ~District of {\rule[-0.5ex]{9.0cm}{1.0pt}}~ was baptised at Diphu Baptist Church and received into full membership on {\rule[-0.5ex]{7.0cm}{1.0pt}}.

                 }}
                 \vspace{6mm}
                 \noindent
                %\beginskip
                {\singlespacing 
                 \vfill
                \begin{minipage}[l]{2.8in}
                 \sigskip \signature{}{\bfseries\color{mycolor} Minister }
                \end{minipage}
                 \hfill
                 \hfill
                 \begin{minipage}[r]{2.8in}
                   \sigskip \signature{}{\bfseries\color{mycolor} Pastor \\ \small ABC Church }
                 \end{minipage}}

                 %=============================
               \vspace{2mm}
                 %\hrulefill\\
               \centering
               \noindent\rule[-1.0ex]{26cm}{1.0pt}\\
                 \hfill
      \DTLforeach{scripture}{\printverse=Condition, \bibleverse=BibleVerse,\bookname=BookName,\chapter=Chapter,\versen=VerseNo}{\setboolean{long}{\printverse}   
      \ifthenelse{\boolean{long}}{\justifying\fontsize{12}{12}\bfseries\it``\bibleverse''.~\textup{\bookname ~\chapter:\versen}}{} 
       \hfill
        \normalfont
        \pagebreak
        }
}
\end{document}

相关内容