diff options
author | Karl Berry <karl@freefriends.org> | 2019-08-17 21:50:28 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-08-17 21:50:28 +0000 |
commit | 75ea8af969ed61b1f317bf97428d4dc273364b7e (patch) | |
tree | 2d0702caf36205e093d8e06009ecfc4bb5d3325d /Master/texmf-dist/tex | |
parent | 69fbc2b3e50af4fc1f26b5014c84a3142865c874 (diff) |
elzcards (17aug19)
git-svn-id: svn://tug.org/texlive/trunk@51894 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/elzcards/elzcards.sty | 561 |
1 files changed, 420 insertions, 141 deletions
diff --git a/Master/texmf-dist/tex/latex/elzcards/elzcards.sty b/Master/texmf-dist/tex/latex/elzcards/elzcards.sty index 4c44bbb4d28..26000422cab 100644 --- a/Master/texmf-dist/tex/latex/elzcards/elzcards.sty +++ b/Master/texmf-dist/tex/latex/elzcards/elzcards.sty @@ -6,7 +6,7 @@ %% %% elzcards.dtx (with options: `package') %% -%% Copyright 2017 Emilio Lazo Zaia <emiliolazozaia@gmail.com> +%% Copyright 2019 Emilio Augusto Lazo Zaia <emiliolazozaia@gmail.com> %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,30 +20,42 @@ %% %% This work has the LPPL maintenance status `maintained'. %% -%% The Current Maintainer of this work is Emilio Lazo Zaia. +%% The Current Maintainer of this work is Emilio Augusto Lazo Zaia. %% %% This work consists of the files README and elzcards.dtx with %% its derived files elzcards.ins, elzcards.sty and %% elzcards-examples.tex. %% \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesPackage{elzcards}[2017/07/09 v1.23 ELZ cards] +\ProvidesPackage{elzcards}[2019/08/16 v1.60 ELZ cards] \RequirePackage{calc} \RequirePackage{xparse} \RequirePackage{keyval} -\RequirePackage[usenames,dvipsnames]{xcolor} + +\AtBeginDocument{\@ifpackageloaded{xcolor}{}{\RequirePackage{xcolor}}} + +\newcommand{\PKGERROR}[1]{\PackageError{elzcards}{** #1. **}{}} +\newcommand{\PKGWARNING}[1]{\PackageWarning{elzcards}{** #1. **}{}} \newif\if@elzc@cruces \newif\if@elzc@segmentos \newif\if@elzc@puntos \newif\if@elzc@lineas \newif\if@elzc@sinmarcas -\newif\if@elzc@tarjeta +\newif\if@elzc@autosep +\newif\if@elzc@autosepinterno +\newif\if@elzc@autoseptotal +\newif\if@elzc@columnasfilas +\newif\if@elzc@fichas +\newif\if@elzc@inicio +\newif\if@elzc@orden +\newif\if@elzc@calculaorden +\newif\if@elzc@ordentransverso \newif\if@elzc@tarjetaconreverso \newif\if@elzc@fichaconreverso -\newif\if@elzc@conreverso -\newif\if@elzc@reverso +\newif\if@elzc@actualconreverso +\newif\if@elzc@procesareverso \newlength{\elzc@TarjXdim} \newlength{\elzc@TarjYdim} @@ -65,27 +77,35 @@ \newcounter{elzc@TarjYdim} \newcounter{elzc@PapelX} \newcounter{elzc@PapelY} +\newcounter{elzc@MatrizXo} +\newcounter{elzc@MatrizYo} \newcounter{elzc@NumX} \newcounter{elzc@NumY} \newcounter{elzc@NumXY} +\newcounter{elzc@NumForzadoX} +\newcounter{elzc@NumForzadoY} \newcounter{elzc@ContX} \newcounter{elzc@ContY} \newcounter{elzc@PosX} \newcounter{elzc@PosY} +\newcounter{elzc@PosMarcaX} +\newcounter{elzc@PosMarcaY} \newcounter{elzc@SeparaX} \newcounter{elzc@SeparaY} -\newcounter{elzc@XInicial} -\newcounter{elzc@RestoX} \newcounter{elzc@Punto} \newcounter{elzc@Arista} \newcounter{elzc@Fichas} +\newcounter{elzc@FichasEnOrden} \newcounter{elzc@FichaActual} +\newcounter{elzc@FichaActualOrdenada} +\newcounter{elzc@ElementosOrden} +\newcounter{elzc@OrdenCiclo} +\newcounter{elzc@OrdenResto} +\newcounter{elzc@OrdenCicloDos} \newcounter{elzc@TempNumX} \newcounter{elzc@TempNumY} -\newcounter{elzc@TempMarcaX} -\newcounter{elzc@TempMarcaY} -\newcounter{elzc@TempFichaActualRev} -\newcounter{elzc@TempInfo} +\newcounter{elzc@Temp} +\newcounter{elzc@TempDos} \def\elzc@aux@cruces{% \@elzc@crucestrue\@elzc@segmentostrue\@elzc@puntosfalse\@elzc@lineasfalse\@elzc@sinmarcasfalse} @@ -98,11 +118,34 @@ \def\elzc@aux@sinmarcas{% \@elzc@crucesfalse\@elzc@segmentosfalse\@elzc@puntosfalse\@elzc@lineasfalse\@elzc@sinmarcastrue} +\def\elzc@aux@autosep@interno{% + \@elzc@autoseptrue\@elzc@autosepinternotrue\@elzc@autoseptotalfalse} +\def\elzc@aux@autosep@total{% + \@elzc@autoseptrue\@elzc@autosepinternofalse\@elzc@autoseptotaltrue} +\def\elzc@aux@autosep@ninguno{% + \@elzc@autosepfalse\@elzc@autosepinternofalse\@elzc@autoseptotalfalse} + +\ExplSyntaxOn + \cs_new:Npn \elzc@aux@elementosorden{ + \seq_set_split:NnV \l_tmpa_seq {~} {\elzc@Orden} + \int_set:Nn \c@elzc@ElementosOrden {(\seq_count:N \l_tmpa_seq) -2}} + + \cs_new:Npn \elzc@aux@fichatransversa #1#2{ + \seq_set_split:NnV \l_tmpa_seq {~} {\elzc@Orden} + \tl_set:Nx \l_tmpa_tl {\seq_item:Nn \l_tmpa_seq {#1+1}} + \int_set:cn {c@#2} \l_tmpa_tl} +\ExplSyntaxOff + \define@key{ELZc}{hsize}{\setlength{\elzc@TarjXdim}{#1}} \define@key{ELZc}{vsize}{\setlength{\elzc@TarjYdim}{#1}} -\define@key{ELZc}{hgap}{\setlength{\elzc@SeparaX}{#1}} -\define@key{ELZc}{vgap}{\setlength{\elzc@SeparaY}{#1}} -\define@key{ELZc}{segment length}{% +\define@key{ELZc}{columns}{\@elzc@columnasfilastrue\setcounter{elzc@NumForzadoX}{#1}} +\define@key{ELZc}{rows}{\@elzc@columnasfilastrue\setcounter{elzc@NumForzadoY}{#1}} +\define@key{ELZc}{hgap}{\elzc@aux@autosep@ninguno\setlength{\elzc@SeparaX}{#1}} +\define@key{ELZc}{vgap}{\elzc@aux@autosep@ninguno\setlength{\elzc@SeparaY}{#1}} +\define@key{ELZc}{autogap inner}[true]{\elzc@aux@autosep@interno} +\define@key{ELZc}{autogap total}[true]{\elzc@aux@autosep@total} +\define@key{ELZc}{no autogap}[true]{\elzc@aux@autosep@ninguno} +\define@key{ELZc}{segment length}{ \setlength{\elzc@TempLen}{#1}\setcounter{elzc@Arista}{\elzc@TempLen}} \define@key{ELZc}{dot size}{\setlength{\elzc@TempLen}{#1}\setcounter{elzc@Punto}{\elzc@TempLen}} \define@key{ELZc}{line thickness}{\linethickness{#1}} @@ -110,12 +153,29 @@ \define@key{ELZc}{segments}[true]{\elzc@aux@segmentos} \define@key{ELZc}{dots}[true]{\elzc@aux@puntos} \define@key{ELZc}{lines}[true]{\elzc@aux@lineas} -\define@key{ELZc}{crop color}{\def\elzc@ColorMarcas{#1}} \define@key{ELZc}{no marks}[true]{\elzc@aux@sinmarcas} +\define@key{ELZc}{crop color}{\def\elzc@ColorMarcas{#1}} +\define@key{ELZc}{order}{ + \if@elzc@ordentransverso + \PKGWARNING{Transverse ordering not available when order pattern is given} + \@elzc@ordentransversofalse + \fi + \@elzc@ordentrue\@elzc@calculaordentrue\def\elzc@Orden{ #1 }\elzc@aux@elementosorden} +\define@key{ELZc}{transverse}[true]{ + \if@elzc@orden + \PKGWARNING{Transverse ordering not available when order pattern is given} + \else + \@elzc@ordentransversotrue\@elzc@calculaordentrue + \fi} +\define@key{ELZc}{no transverse}[true]{ + \@elzc@ordentransversofalse + \if@elzc@orden\else\@elzc@calculaordenfalse\fi} -\newcommand*{\CurrentIC}{\arabic{elzc@FichaActual}} -\newcommand*{\TotalIC}{\arabic{elzc@Fichas}} +\NewDocumentCommand{\CurrentIC}{s}{% + \IfBooleanTF{#1}{\arabic{elzc@FichaActual}}{\arabic{elzc@FichaActualOrdenada}}} \let\CurrentFC\CurrentIC + +\newcommand*{\TotalIC}{\arabic{elzc@Fichas}} \let\TotalFC\TotalIC \newcommand*{\BCdim}[2]{\setlength{\elzc@DefTPXdim}{#1}\setlength{\elzc@DefTPYdim}{#2}} @@ -123,6 +183,7 @@ \let\FCdim\ICdim \NewDocumentCommand{\CardGap}{m g}{% + \def\elzc@DefAutoSep{\elzc@aux@autosep@ninguno}% \setlength{\elzc@DefSeparaX}{#1}% \IfValueTF{#2}{\setlength{\elzc@DefSeparaY}{#2}}{\setlength{\elzc@DefSeparaY}{#1}}} @@ -137,31 +198,36 @@ \newcommand*{\CropColor}[1]{\def\elzc@DefColorMarcas{#1}} \newcommand*{\NoCropMarks}{\def\elzc@DefMarcasCorte{\elzc@aux@sinmarcas}} +\newcommand*{\AutoGapInner}{\def\elzc@DefAutoSep{\elzc@aux@autosep@interno}} +\newcommand*{\AutoGapTotal}{\def\elzc@DefAutoSep{\elzc@aux@autosep@total}} +\newcommand*{\NoAutoGap}{\def\elzc@DefAutoSep{\elzc@aux@autosep@ninguno}} + +\newcommand*{\Transverse}{% + \def\elzc@DefTrasverso{\@elzc@ordentransversotrue\@elzc@calculaordentrue}} +\newcommand*{\NoTransverse}{% + \def\elzc@DefTrasverso{\@elzc@ordentransversofalse\@elzc@calculaordenfalse}} + \NewDocumentCommand{\MakeBC}{s o}{% \ifx\undefined\@elzc@TarjetaAnverso - \PackageError{elzcards}{There are no business cards defined}{}% + \PKGERROR{There are no business cards defined}% \else - \@elzc@tarjetatrue - \if@elzc@tarjetaconreverso \@elzc@conreversotrue \else \@elzc@conreversofalse \fi + \@elzc@fichasfalse + \if@elzc@tarjetaconreverso\@elzc@actualconreversotrue\else\@elzc@actualconreversofalse\fi \elzc@Predeterminados - \setlength{\elzc@TarjXdim}{\elzc@DefTPXdim}% - \setlength{\elzc@TarjYdim}{\elzc@DefTPYdim}% \IfValueT{#2}{\setkeys{ELZc}{#2}}% - \elzc@Tarjetas + \elzc@CicloCompleto \IfBooleanF{#1}{\elzc@TodoCero}% \fi} \NewDocumentCommand{\MakeIC}{s o}{% \ifnum \value{elzc@Fichas} = 0% - \PackageError{elzcards}{There are no index/flash cards in stack}{}% + \PKGERROR{There are no index/flash cards in the stack}% \else - \@elzc@tarjetafalse - \if@elzc@fichaconreverso \@elzc@conreversotrue \else \@elzc@conreversofalse \fi - \elzc@Predeterminados - \setlength{\elzc@TarjXdim}{\elzc@DefFichaXdim}% - \setlength{\elzc@TarjYdim}{\elzc@DefFichaYdim}% + \@elzc@fichastrue + \if@elzc@fichaconreverso\@elzc@actualconreversotrue\else\@elzc@actualconreversofalse\fi + \elzc@Predeterminados* \IfValueT{#2}{\setkeys{ELZc}{#2}}% - \elzc@Tarjetas + \elzc@CicloCompleto \IfBooleanF{#1}{\elzc@TodoCero*}% \fi} \let\MakeFC\MakeIC @@ -173,7 +239,7 @@ \@elzc@tarjetaconreversotrue \def\@elzc@TarjetaReverso{#2}% \immediate\write\@auxout{\string\@twosidetrue\string\@mparswitchtrue}} - {\def\@elzc@TarjetaReverso{}} + {\def\@elzc@TarjetaReverso{}}% \else \PackageError{elzcards}{There are business cards already defined}{}% \fi} @@ -188,157 +254,348 @@ {\expandafter\def\csname @elzc@FichaReverso\romannumeral\value{elzc@Fichas}\endcsname{}}} \let\FlashCard\IndexCard -\newcommand*{\elzc@Cuadricula}{% - \setlength{\elzc@TempUnitLength}{\unitlength}% - \setlength{\unitlength}{1sp}% - \setlength{\parindent}{0pt}% - \thispagestyle{empty}% - \setcounter{elzc@NumX}{0}% - \setcounter{elzc@NumY}{0}% - \setcounter{elzc@TempNumX}{0}% - \setcounter{elzc@TempNumY}{0}% - \setcounter{elzc@TarjXdim}{\elzc@TarjXdim}% - \setcounter{elzc@TarjYdim}{\elzc@TarjYdim}% - \setcounter{elzc@SeparaX}{\elzc@SeparaX}% - \setcounter{elzc@SeparaY}{\elzc@SeparaY}% - \setcounter{elzc@PapelX}{\textwidth}% - \setcounter{elzc@PapelY}{\textheight}% +\NewDocumentCommand{\elzc@TodoCero}{s}{% + \IfBooleanTF{#1}{% + \setcounter{elzc@Fichas}{0}% + \setcounter{elzc@FichasEnOrden}{0}% + \@elzc@fichaconreversofalse} + {\let\@elzc@TarjetaAnverso\undefined + \let\@elzc@TarjetaReverso\undefined + \@elzc@tarjetaconreversofalse}} + +\NewDocumentCommand{\elzc@Predeterminados}{s}{% + \elzc@DefAutoSep + \elzc@DefMarcasCorte + \let\elzc@ColorMarcas\elzc@DefColorMarcas + \linethickness{\elzc@DefLinea}% + \setlength{\elzc@SeparaX}{\elzc@DefSeparaX}% + \setlength{\elzc@SeparaY}{\elzc@DefSeparaY}% + \setlength{\elzc@TempLen}{\elzc@DefArista}\setcounter{elzc@Arista}{\elzc@TempLen}% + \setlength{\elzc@TempLen}{\elzc@DefPunto}\setcounter{elzc@Punto}{\elzc@TempLen}% + \IfBooleanTF{#1} + {\elzc@DefTrasverso + \setlength{\elzc@TarjXdim}{\elzc@DefFichaXdim}\setlength{\elzc@TarjYdim}{\elzc@DefFichaYdim}}% + {\setlength{\elzc@TarjXdim}{\elzc@DefTPXdim}\setlength{\elzc@TarjYdim}{\elzc@DefTPYdim}}} + +\newcommand*{\elzc@CalculaMatriz}{% \loop \ifnum\value{elzc@TempNumX} < \value{elzc@PapelX}% - \advance\value{elzc@TempNumX} by \value{elzc@TarjXdim}{% - \addtocounter{elzc@NumX}{1}% - \addtocounter{elzc@TempNumX}{\value{elzc@SeparaX}}}% + \advance\value{elzc@TempNumX} by \value{elzc@TarjXdim}{% + \addtocounter{elzc@NumX}{1}% + \addtocounter{elzc@TempNumX}{\value{elzc@SeparaX}}}% \repeat \loop \ifnum\value{elzc@TempNumY} < \value{elzc@PapelY}% - \advance\value{elzc@TempNumY} by \value{elzc@TarjYdim}{% - \addtocounter{elzc@NumY}{1}% - \addtocounter{elzc@TempNumY}{\value{elzc@SeparaY}}}% + \advance\value{elzc@TempNumY} by \value{elzc@TarjYdim}{% + \addtocounter{elzc@NumY}{1}% + \addtocounter{elzc@TempNumY}{\value{elzc@SeparaY}}}% \repeat \addtocounter{elzc@TempNumX}{-\value{elzc@SeparaX}}% \addtocounter{elzc@TempNumY}{-\value{elzc@SeparaY}}% \ifnum\value{elzc@TempNumX} > \value{elzc@PapelX}% + \addtocounter{elzc@TempNumX}{-\value{elzc@TarjXdim}}% \addtocounter{elzc@NumX}{-1}% \fi \ifnum\value{elzc@TempNumY} > \value{elzc@PapelY}% + \addtocounter{elzc@TempNumY}{-\value{elzc@TarjYdim}}% \addtocounter{elzc@NumY}{-1}% \fi - \setcounter{elzc@NumXY}{\value{elzc@NumX} * \value{elzc@NumY}}% - \setcounter{elzc@ContX}{-1}% - \setcounter{elzc@ContY}{-1}% - \setcounter{elzc@RestoX}{- \value{elzc@PapelX} + \value{elzc@NumX} *% - (\value{elzc@TarjXdim} + \value{elzc@SeparaX}) - \value{elzc@SeparaX}}% + \ifnum\value{elzc@NumX} = 0 + \PKGERROR{No space to print at least one card. Check dimensions}\stop + \fi + \ifnum\value{elzc@NumY} = 0 + \PKGERROR{No space to print at least one card. Check dimensions}\stop + \fi} + +\newcommand*{\elzc@ColumnasFilas}{% + \ifnum\value{elzc@NumForzadoX} > \value{elzc@NumX}% + \PKGWARNING{No space to print \arabic{elzc@NumForzadoX} columns; + printing \arabic{elzc@NumX} columns instead}% + \setcounter{elzc@NumForzadoX}{0}% + \else + \ifnum\value{elzc@NumForzadoX} > 0 + \addtocounter{elzc@TempNumX}{-\value{elzc@NumX} * \value{elzc@TarjXdim} + + \value{elzc@NumForzadoX} * \value{elzc@TarjXdim}}% + \setcounter{elzc@NumX}{\arabic{elzc@NumForzadoX}}% + \fi + \fi + \ifnum\value{elzc@NumForzadoY} > \value{elzc@NumY}% + \PKGWARNING{No space to print \arabic{elzc@NumForzadoY} rows; + printing \arabic{elzc@NumY} rows instead}% + \setcounter{elzc@NumForzadoY}{0}% + \else + \ifnum\value{elzc@NumForzadoY} > 0 + \addtocounter{elzc@TempNumY}{-\value{elzc@NumY} * \value{elzc@TarjYdim} + + \value{elzc@NumForzadoY} * \value{elzc@TarjYdim}}% + \setcounter{elzc@NumY}{\arabic{elzc@NumForzadoY}}% + \fi + \fi} + +\newcommand*{\elzc@Cuadricula}{% + \setlength{\elzc@TempUnitLength}{\unitlength}% + \setlength{\unitlength}{1sp}% + \setlength{\parindent}{0pt}% + \thispagestyle{empty}% \elzc@Informacion - \begin{picture}(\value{elzc@PapelX}, \value{elzc@PapelY})(\value{elzc@XInicial}, 0)% - \loop \ifnum\value{elzc@ContY} < \value{elzc@NumY} \advance\value{elzc@ContY} by 1{% - \loop \ifnum\value{elzc@ContX} < \value{elzc@NumX} \advance\value{elzc@ContX} by 1{% - \if@elzc@reverso - \setcounter{elzc@PosX}{(\value{elzc@NumX} - \value{elzc@ContX} - 1) * \value{elzc@TarjXdim}% + \setcounter{elzc@MatrizXo}{ + (\value{elzc@PapelX} - \value{elzc@NumX} * (\value{elzc@TarjXdim} + \value{elzc@SeparaX}) + + \value{elzc@SeparaX}) / 2}% + \setcounter{elzc@MatrizYo} + {(\value{elzc@PapelY} - \value{elzc@NumY} * (\value{elzc@TarjYdim} + \value{elzc@SeparaY}) + + \value{elzc@SeparaY}) / 2}% + \begin{picture} + (\value{elzc@PapelX}, \value{elzc@PapelY}) + (-\value{elzc@MatrizXo}, -\value{elzc@MatrizYo})% + \loop \ifnum\value{elzc@ContY} < \value{elzc@NumY}\advance\value{elzc@ContY} by 1{% + \loop \ifnum\value{elzc@ContX} < \value{elzc@NumX}\advance\value{elzc@ContX} by 1{% + \if@elzc@procesareverso + \setcounter{elzc@PosX}{(\value{elzc@NumX} - \value{elzc@ContX} - 1) * \value{elzc@TarjXdim} + (\value{elzc@NumX} - \value{elzc@ContX} - 1) * \value{elzc@SeparaX}}% \else \setcounter{elzc@PosX}{\value{elzc@ContX} * (\value{elzc@TarjXdim} + \value{elzc@SeparaX})}% \fi - \setcounter{elzc@PosY}{\value{elzc@ContY} * (\value{elzc@TarjYdim} + \value{elzc@SeparaY})}% + \setcounter{elzc@PosY}{\value{elzc@PapelY} - + (\value{elzc@ContY} * (\value{elzc@TarjYdim} + \value{elzc@SeparaY})) + - \value{elzc@TarjYdim} - 2 * \value{elzc@MatrizYo}}% \ifnum \value{elzc@ContX} < \value{elzc@NumX}% \ifnum \value{elzc@ContY} < \value{elzc@NumY}% \put(\value{elzc@PosX}, \value{elzc@PosY}){% \makebox(\value{elzc@TarjXdim}, \value{elzc@TarjYdim}){% \setlength{\unitlength}{\elzc@TempUnitLength}% \parbox[t][\elzc@TarjYdim]{\elzc@TarjXdim}{% - \if@elzc@tarjeta - \if@elzc@reverso \@elzc@TarjetaReverso \else \@elzc@TarjetaAnverso \fi - \else - \ifnum\value{elzc@FichaActual} < \value{elzc@Fichas}% + \if@elzc@fichas + \ifnum\value{elzc@FichaActual} < \value{elzc@FichasEnOrden}% \addtocounter{elzc@FichaActual}{1}% - \addtocounter{elzc@TempFichaActualRev}{1}% - \if@elzc@reverso - \expandafter\csname @elzc@FichaReverso\romannumeral\value{elzc@FichaActual}\endcsname + \if@elzc@calculaorden + \elzc@CalculaOrden \else - \expandafter\csname @elzc@FichaAnverso\romannumeral\value{elzc@FichaActual}\endcsname + \setcounter{elzc@FichaActualOrdenada}{\value{elzc@FichaActual}}% + \fi + \if@elzc@procesareverso + \expandafter + \csname @elzc@FichaReverso\romannumeral\value{elzc@FichaActualOrdenada}\endcsname + \else + \expandafter + \csname @elzc@FichaAnverso\romannumeral\value{elzc@FichaActualOrdenada}\endcsname \fi \fi + \else + \if@elzc@procesareverso\@elzc@TarjetaReverso\else\@elzc@TarjetaAnverso\fi \fi}}}% \fi \fi - \if@elzc@reverso \else \elzc@CalculaMarcas \fi + \if@elzc@procesareverso\else\elzc@CalculaMarcas\fi }\repeat }\repeat - \end{picture}} + \end{picture}\global\@elzc@iniciofalse} -\newcommand*{\elzc@Tarjetas}{% - {\pagestyle{empty}\cleardoublepage}% - \elzc@Cuadricula - \if@elzc@conreverso - \@elzc@reversotrue - \if@elzc@tarjeta \else \addtocounter{elzc@FichaActual}{-\value{elzc@TempFichaActualRev}}\fi - \setcounter{elzc@XInicial}{\value{elzc@RestoX}}% - \clearpage - \elzc@Cuadricula - \setcounter{elzc@XInicial}{0}% - \@elzc@reversofalse +\newcommand*{\elzc@Inicializa}{% + \setcounter{elzc@NumX}{0}% + \setcounter{elzc@NumY}{0}% + \setcounter{elzc@TempNumX}{0}% + \setcounter{elzc@TempNumY}{0}% + \if@elzc@inicio + \setcounter{elzc@PapelX}{\textwidth}% + \setcounter{elzc@PapelY}{\textheight}% + \setcounter{elzc@TarjXdim}{\elzc@TarjXdim}% + \setcounter{elzc@TarjYdim}{\elzc@TarjYdim}% + \fi + \if@elzc@autosep + \setlength{\elzc@SeparaX}{0pt}\setlength{\elzc@SeparaY}{0pt}% + \fi + \setcounter{elzc@SeparaX}{\elzc@SeparaX}% + \setcounter{elzc@SeparaY}{\elzc@SeparaY}% + \elzc@CalculaMatriz + \if@elzc@columnasfilas\elzc@ColumnasFilas\fi + \if@elzc@autosep + \if@elzc@autoseptotal + \setcounter{elzc@SeparaX}{ + (\value{elzc@PapelX} - \value{elzc@TempNumX}) / (\value{elzc@NumX} + 1)}% + \setcounter{elzc@SeparaY}{ + (\value{elzc@PapelY} - \value{elzc@TempNumY}) / (\value{elzc@NumY} + 1)}% + \else + \ifnum\value{elzc@NumX} > 1 + \setcounter{elzc@SeparaX}{ + (\value{elzc@PapelX} - \value{elzc@TempNumX}) / (\value{elzc@NumX} - 1)}% + \fi + \ifnum\value{elzc@NumY} > 1 + \setcounter{elzc@SeparaY}{ + (\value{elzc@PapelY} - \value{elzc@TempNumY}) / (\value{elzc@NumY} - 1)}% + \fi + \fi + \setlength{\elzc@SeparaX}{\value{elzc@SeparaX}sp}% + \setlength{\elzc@SeparaY}{\value{elzc@SeparaY}sp}% \fi - \if@elzc@tarjeta + \setcounter{elzc@NumXY}{\value{elzc@NumX} * \value{elzc@NumY}}% + \if@elzc@orden + \setcounter{elzc@FichasEnOrden} + {\value{elzc@Fichas} / \value{elzc@ElementosOrden} * \value{elzc@ElementosOrden}} + \ifnum\value{elzc@FichasEnOrden} < \value{elzc@Fichas}% + \addtocounter{elzc@FichasEnOrden}{\value{elzc@ElementosOrden}}% + \fi \else - \setcounter{elzc@TempFichaActualRev}{0}% - \ifnum\value{elzc@FichaActual} < \value{elzc@Fichas}% - \elzc@Tarjetas + \setcounter{elzc@FichasEnOrden}{\value{elzc@Fichas} / \value{elzc@NumXY} * \value{elzc@NumXY}}% + \ifnum\value{elzc@FichasEnOrden} < \value{elzc@Fichas}% + \addtocounter{elzc@FichasEnOrden}{\value{elzc@NumXY}}% \fi + \fi + \setcounter{elzc@ContX}{-1}% + \setcounter{elzc@ContY}{-1}% + \if@elzc@inicio + \if@elzc@ordentransverso + \elzc@CalculaOrdenTrasverso + \else + \if@elzc@orden\elzc@VerificaOrden\fi + \fi + \fi} + +\newcommand*{\elzc@CicloCompleto}{% + \@elzc@iniciotrue + \elzc@Inicializa + \if@elzc@fichas + \loop\ifnum\value{elzc@FichaActual} < \value{elzc@FichasEnOrden}% + {\elzc@CicloPagina}\repeat \setcounter{elzc@FichaActual}{0}% + \@elzc@ordenfalse + \@elzc@ordentransversofalse + \@elzc@calculaordenfalse + \else + \elzc@CicloPagina \fi + \@elzc@columnasfilasfalse + \setcounter{elzc@NumForzadoX}{0}% + \setcounter{elzc@NumForzadoY}{0}% \clearpage} -\NewDocumentCommand{\elzc@TodoCero}{s}{% - \IfBooleanTF{#1}{% - \setcounter{elzc@Fichas}{0}% - \@elzc@fichaconreversofalse} - {\let\@elzc@TarjetaAnverso\undefined - \let\@elzc@TarjetaReverso\undefined - \@elzc@tarjetaconreversofalse}} +\newcommand*{\elzc@CicloPagina}{% + {\pagestyle{empty}\cleardoublepage}% + \elzc@Cuadricula + \if@elzc@actualconreverso + \@elzc@procesareversotrue + \if@elzc@fichas\addtocounter{elzc@FichaActual}{-\value{elzc@NumXY}}\fi + \clearpage + \elzc@Cuadricula + \@elzc@procesareversofalse + \fi} -\newcommand*{\elzc@Predeterminados}{% - \elzc@DefMarcasCorte - \setlength{\elzc@SeparaX}{\elzc@DefSeparaX}% - \setlength{\elzc@SeparaY}{\elzc@DefSeparaY}% - \setlength{\elzc@TempLen}{\elzc@DefArista}\setcounter{elzc@Arista}{\elzc@TempLen}% - \setlength{\elzc@TempLen}{\elzc@DefPunto}\setcounter{elzc@Punto}{\elzc@TempLen}% - \linethickness{\elzc@DefLinea}% - \let\elzc@ColorMarcas\elzc@DefColorMarcas} +\newcommand*{\elzc@CalculaOrdenTrasverso}{% + \setcounter{elzc@OrdenCiclo}{0}% + \setcounter{elzc@OrdenCicloDos}{0}% + \if@elzc@fichas + \def\elzc@Orden{ }% + \setcounter{elzc@Temp}{\value{elzc@Fichas} / \value{elzc@NumXY}}% + \setcounter{elzc@TempDos}{\value{elzc@Temp} * \value{elzc@NumXY}}% + \ifnum\value{elzc@TempDos} = \value{elzc@Fichas}% + \else + \addtocounter{elzc@Temp}{1}% + \fi + \loop \ifnum\value{elzc@OrdenCiclo} < \value{elzc@Temp}% + \advance \value{elzc@OrdenCiclo} by 1{% + \setcounter{elzc@TempDos}{\value{elzc@OrdenCiclo}}% + \addtocounter{elzc@TempDos}{-\value{elzc@Temp}}% + \loop \ifnum\value{elzc@OrdenCicloDos} < \value{elzc@NumXY}% + \advance \value{elzc@OrdenCicloDos} by 1{% + \addtocounter{elzc@TempDos}{\value{elzc@Temp}}% + \global\edef\elzc@Orden{\elzc@Orden \arabic{elzc@TempDos} }% + }\repeat + }\repeat + \elzc@aux@elementosorden + \else + \PKGWARNING{Transverse ordering not available on business cards}% + \global\@elzc@ordentransversofalse + \global\@elzc@calculaordenfalse + \fi} + +\newcommand*{\elzc@ErrorEnPatronOrden}{% + \PKGWARNING{Ordering pattern incorrectly given. Ignoring it}% + \global\@elzc@ordenfalse + \global\@elzc@calculaordenfalse} + +\newcommand*{\elzc@VerificaOrden}{% + \if@elzc@fichas + \setcounter{elzc@Temp}{\value{elzc@ElementosOrden} - \value{elzc@ElementosOrden} / + \value{elzc@NumXY} * \value{elzc@NumXY}}% + \ifnum\value{elzc@Temp} = 0 + \else + \ifnum\value{elzc@Temp} = \value{elzc@Fichas}% + \else + \ifnum\value{elzc@ElementosOrden} = \value{elzc@Fichas}% + \else + \elzc@ErrorEnPatronOrden + \fi + \fi + \fi + \if@elzc@orden + \setcounter{elzc@OrdenCiclo}{0}% + \loop \ifnum\value{elzc@OrdenCiclo} < \value{elzc@ElementosOrden}% + \advance \value{elzc@OrdenCiclo} by 1{% + \setcounter{elzc@OrdenCicloDos}{0}% + \loop \ifnum\value{elzc@OrdenCicloDos} < \value{elzc@ElementosOrden}% + \advance \value{elzc@OrdenCicloDos} by 1{% + \elzc@aux@fichatransversa{\value{elzc@OrdenCicloDos}}{elzc@Temp}% + \ifnum\value{elzc@OrdenCiclo} = \value{elzc@Temp}% + \setcounter{elzc@OrdenCicloDos}{\value{elzc@ElementosOrden}}% + \else + \ifnum\value{elzc@OrdenCicloDos} = \value{elzc@ElementosOrden}% + \elzc@ErrorEnPatronOrden + \setcounter{elzc@OrdenCiclo}{\value{elzc@ElementosOrden}}% + \fi + \fi + }\repeat + }\repeat + \fi + \else + \PKGWARNING{Ordering pattern not available on business cards}% + \global\@elzc@ordenfalse + \global\@elzc@calculaordenfalse + \fi} + +\newcommand*{\elzc@CalculaOrden}{% + \setcounter{elzc@OrdenCiclo}{\value{elzc@FichaActual} / \value{elzc@ElementosOrden}}% + \setcounter{elzc@OrdenResto}{\value{elzc@FichaActual} - \value{elzc@FichaActual} / + \value{elzc@ElementosOrden} * \value{elzc@ElementosOrden}}% + \ifnum\value{elzc@OrdenResto} = 0 + \addtocounter{elzc@OrdenCiclo}{-1}% + \setcounter{elzc@OrdenResto}{\value{elzc@ElementosOrden}}% + \fi + \elzc@aux@fichatransversa{\value{elzc@OrdenResto}}{elzc@FichaActualOrdenada}% + \addtocounter{elzc@FichaActualOrdenada}{\value{elzc@OrdenCiclo} * \value{elzc@ElementosOrden}}} \newcommand*{\elzc@CalculaMarcas}{% - \setcounter{elzc@TempMarcaX}{\value{elzc@PosX}}% - \setcounter{elzc@TempMarcaY}{\value{elzc@PosY}}% + \setcounter{elzc@PosMarcaX}{\value{elzc@PosX}}% + \setcounter{elzc@PosMarcaY}{\value{elzc@PosY} + \value{elzc@TarjYdim}}% \ifnum \value{elzc@ContX} = \value{elzc@NumX}% \else \ifnum \value{elzc@ContY} = \value{elzc@NumY}% \else - \elzc@DibujaMarcas{\value{elzc@TempMarcaX}}{\value{elzc@TempMarcaY}}% + \elzc@DibujaMarcas{\value{elzc@PosMarcaX}}{\value{elzc@PosMarcaY}}% \fi \fi - \addtocounter{elzc@TempMarcaX}{-\value{elzc@SeparaX}}% - \ifnum \value{elzc@ContX} = 0% + \addtocounter{elzc@PosMarcaX}{-\value{elzc@SeparaX}}% + \ifnum \value{elzc@ContX} = 0 \else \ifnum \value{elzc@ContY} = \value{elzc@NumY}% \else - \elzc@DibujaMarcas{\value{elzc@TempMarcaX}}{\value{elzc@TempMarcaY}}% + \elzc@DibujaMarcas{\value{elzc@PosMarcaX}}{\value{elzc@PosMarcaY}}% \fi \fi - \addtocounter{elzc@TempMarcaY}{-\value{elzc@SeparaY}}% - \ifnum \value{elzc@ContX} = 0% + \addtocounter{elzc@PosMarcaY}{\value{elzc@SeparaY}}% + \ifnum \value{elzc@ContX} = 0 \else - \ifnum \value{elzc@ContY} = 0% + \ifnum \value{elzc@ContY} = 0 \else - \elzc@DibujaMarcas{\value{elzc@TempMarcaX}}{\value{elzc@TempMarcaY}}% + \elzc@DibujaMarcas{\value{elzc@PosMarcaX}}{\value{elzc@PosMarcaY}}% \fi \fi - \addtocounter{elzc@TempMarcaX}{\value{elzc@SeparaX}}% - \ifnum \value{elzc@ContY} = 0% + \addtocounter{elzc@PosMarcaX}{\value{elzc@SeparaX}}% + \ifnum \value{elzc@ContY} = 0 \else \ifnum \value{elzc@ContX} = \value{elzc@NumX}% \else - \elzc@DibujaMarcas{\value{elzc@TempMarcaX}}{\value{elzc@TempMarcaY}}% + \elzc@DibujaMarcas{\value{elzc@PosMarcaX}}{\value{elzc@PosMarcaY}}% \fi \fi} \newcommand*{\elzc@DibujaMarcas}[2]{% - \ifnum \value{elzc@ContX} = 0% + \ifnum \value{elzc@ContX} = 0 \if@elzc@segmentos\put(#1,#2){\color{\elzc@ColorMarcas}\line(-1,0){\value{elzc@Arista}}}\fi \if@elzc@puntos\put(#1,#2){\color{\elzc@ColorMarcas}\circle*{\value{elzc@Punto}}}\fi \else @@ -357,12 +614,12 @@ \fi \fi \fi - \ifnum \value{elzc@ContY} = 0% - \if@elzc@segmentos\put(#1,#2){\color{\elzc@ColorMarcas}\line(0,-1){\value{elzc@Arista}}}\fi + \ifnum \value{elzc@ContY} = 0 + \if@elzc@segmentos\put(#1,#2){\color{\elzc@ColorMarcas}\line(0,0){\value{elzc@Arista}}}\fi \if@elzc@puntos\put(#1,#2){\color{\elzc@ColorMarcas}\circle*{\value{elzc@Punto}}}\fi \else \ifnum \value{elzc@ContY} = \value{elzc@NumY}% - \if@elzc@segmentos\put(#1,#2){\color{\elzc@ColorMarcas}\line(0,0){\value{elzc@Arista}}}\fi + \if@elzc@segmentos\put(#1,#2){\color{\elzc@ColorMarcas}\line(0,-1){\value{elzc@Arista}}}\fi \if@elzc@puntos\put(#1,#2){\color{\elzc@ColorMarcas}\circle*{\value{elzc@Punto}}}\fi \else \if@elzc@cruces @@ -379,32 +636,52 @@ \newcommand*{\elzc@Informacion}{% \message{^^JProcessing}% - \if@elzc@tarjeta - \message{business cards,}% + \if@elzc@fichas\message{index/flash cards,}\else\message{business cards,}\fi + \if@elzc@procesareverso + \message{back side,^^J}% \else - \message{index/flash cards,}% - \setcounter{elzc@TempInfo}{\value{elzc@NumXY} + \value{elzc@FichaActual}}% - \ifnum \value{elzc@TempInfo} > \value{elzc@Fichas}% - \setcounter{elzc@TempInfo}{\value{elzc@Fichas}}% - \fi + \if@elzc@actualconreverso\else\message{only}\fi + \message{front side,^^J}% + \fi + \if@elzc@fichas + \setcounter{elzc@Temp}{\value{elzc@NumXY} + \value{elzc@FichaActual}}% \addtocounter{elzc@FichaActual}{1}% - \message{current=\arabic{elzc@FichaActual}-\arabic{elzc@TempInfo}, - total=\arabic{elzc@Fichas},}% + \message{ current=\arabic{elzc@FichaActual}-\arabic{elzc@Temp}}% + \message{of \arabic{elzc@FichasEnOrden},}% + \message{total cards=\arabic{elzc@Fichas},}% + \if@elzc@calculaorden + \if@elzc@ordentransverso \message{transverse order,}\fi + \if@elzc@orden \message{reordered,}\fi + \fi \addtocounter{elzc@FichaActual}{-1}% + \message{^^J}% \fi - \if@elzc@reverso\message{back side,^^J}\else\message{front side,^^J}\fi - \message{ per page: \arabic{elzc@NumXY} (\arabic{elzc@NumX}x\arabic{elzc@NumY}),}% - \message{ hsize=\the\elzc@TarjXdim, vsize=\the\elzc@TarjYdim, - hgap=\the\elzc@SeparaX, vgap=\the\elzc@SeparaY,^^J}% + \message{ per page: + \ifnum\value{elzc@NumForzadoX} > 0 + forced + \else + \ifnum\value{elzc@NumForzadoY} > 0 + forced + \fi + \fi + \arabic{elzc@NumXY} (\arabic{elzc@NumX}x\arabic{elzc@NumY}),}% + \message{hsize=\the\elzc@TarjXdim, vsize=\the\elzc@TarjYdim,^^J}% + \message{ hgap=\the\elzc@SeparaX, vgap=\the\elzc@SeparaY, + \if@elzc@autosep + \if@elzc@autosepinterno auto gap inner,\fi + \if@elzc@autoseptotal auto gap total,\fi + \else no auto gap, + \fi^^J}% \if@elzc@cruces \message{ with crosses,}% \setlength{\elzc@TempLen}{\value{elzc@Arista}sp}% \message{segment length=\the\elzc@TempLen, line thickness=\the\@wholewidth.^^J}% - \fi - \if@elzc@segmentos - \message{ with segments,}% - \setlength{\elzc@TempLen}{\value{elzc@Arista}sp}% - \message{segment length=\the\elzc@TempLen, line thickness=\the\@wholewidth.^^J}% + \else + \if@elzc@segmentos + \message{ with segments,}% + \setlength{\elzc@TempLen}{\value{elzc@Arista}sp}% + \message{segment length=\the\elzc@TempLen, line thickness=\the\@wholewidth.^^J}% + \fi \fi \if@elzc@puntos \message{ with dots,}% @@ -427,8 +704,10 @@ \setlength{\elzc@DefArista}{1mm} \setlength{\elzc@DefPunto}{1pt} \setlength{\elzc@DefLinea}{0.1mm} -\CropColor{Red!90!Black} +\CropColor{red!90!black} \CropCrosses +\NoAutoGap +\NoTransverse \InputIfFileExists{\jobname.aux}{}\relax |