Carta masiva, "bucle" no funciona, "leer en" no funciona

Carta masiva, "bucle" no funciona, "leer en" no funciona

Texto original a continuación

Editar: lo resolví buscando en Google sin parar y con ayuda desde aquí. Aquí está mi teoría: los errores tipográficos provocaron expandafterun error, lo que provocó una discrepancia entre el choplinecomando y el resto de la línea cortada del bucle anterior. Otro error fue el ifeof. Latex intentó leer una línea después eof. Esto provocó que fallara la "lectura en"

Código de trabajo:

El formato del csv debe ser

academicTitle(might be empty);surname;prename;Street+Number;ZIP-code;city;addressExtension;postbox(0 or certainValue)\n

El archivo comienza aquí:

\documentclass[12pt,a4paper,landscape]{article}
\usepackage[utf8]{inputenc}
\usepackage[german]{babel}
\usepackage{graphicx}
\usepackage[verbose]{placeins}


%What do we do? Delete all the margins!!! How do we do it? By force!!!
\setlength{\leftmargin}{0pt}
\setlength{\rightmargin}{0pt}
\setlength{\topmargin}{0pt}
\setlength{\textheight}{845pt}
\setlength{\hoffset}{-3.3in}
\setlength{\voffset}{-1.5in}
\setlength{\textheight}{845pt}
\setlength{\textwidth}{597pt}


%Personal chopline command from https://de.wikibooks.org/wiki/LaTeX-W%C3%B6rterbuch:_Serienbrief_mit_externen_Daten
\def\chopline#1;#2;#3;#4;#5;#6;#7;#8 \\{
\def\Titel{#1}
\def\Name{#2}
\def\Vorname{#3}
\def\Strasse{#4}
\def\PLZ{#5}
\def\Ort{#6}
\def\Adresszusatz{#7}
\def\Postfach{#8}
}

\newif\ifmore \moretrue



\begin{document}
\pagenumbering{gobble}

\newread\quelle
\openin\quelle=Adressen.csv %Here we get the addresses from

\loop

\read\quelle to\zeile
\ifeof\quelle
\global\morefalse
\else{

%write you stuff here

\newpage %gets ignored on first page


\expandafter\chopline\zeile\\
\vspace*{-0.02\paperwidth} %due to my Brief.pdf
\hspace*{0.0\paperheight}  %same here
\includegraphics[width=\paperwidth]{./Brief.pdf}

\FloatBarrier
\vspace*{-0.23\paperheight} %shift the box where desired
\hspace*{0.65\paperwidth}   %same here
\parbox{0.4\textwidth}{
\Titel \ \Vorname \ \Name \ \\
\ifx\Adresszusatz\empty %if it isn't empty, it is printed
\else
\Adresszusatz \\
\fi
\ifnum\Postfach=0 %if the value is 0 in the .csv, it isn't printed
\else
Postfach \ \Postfach
\fi
\Strasse \ \\
\PLZ \ \Ort
}

%stop with you writing here

}
\fi

\ifmore\repeat

\closein\quelle


\end{document}

Pregunta original:

Esta es mi primera pregunta. Busqué mucho en Google, pero todavía no lo he logrado.

He hecho un generador automático de sobres de cartas. Esto se lee desde un archivo csv. Sigo las instrucciones dadas ende.wikibooks Serie breve. Pero lamentablemente no funcionará.

Utilizo Texmaker y MikTex en Windows 7, pero podría cambiar a Manjaro, si fuera necesario.

Este es mi código:

Former code

Se bloquea después de "leer en". Este parece ser el problema, pero no puedo entender por qué. Además, el bucle no funciona de NINGUNA forma. No importa qué tipo de bucle ( ,, loop) configure, solo se repite una vez. Incluso si configuro un bucle for en 30 repeticiones. En realidad debería producir 30 fotogramas.whiledofor

No me juzgues por usar el proyector para los sobres. Daría más etiquetas, pero no se me permite.

Respuesta1

Quizás no sea la mejor manera, pero algo 'a prueba de fallos' es usar las expl3funciones y \ior_map_inlineel comando que lee el archivo línea por línea y procesa la línea de entrada.

He usado una secuencia para dividir la línea en varias partes relevantes.

Tenga en cuenta que ese espacio en blanco debe ingresarse con foo\ some other stuff!

\documentclass[12pt,a4paper]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
%\usepackage{amsmath}
%\usepackage{amsfonts}
%\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{forloop}

\usepackage{xparse}

\begin{document}



\ExplSyntaxOn
\int_const:Nn \c_maestro_titel_int {1}
\int_const:Nn \c_maestro_vorname_int {2}
\int_const:Nn \c_maestro_name_int {3}
\int_const:Nn \c_maestro_strasse_int {4}
\int_const:Nn \c_maestro_plz_int {5}
\int_const:Nn \c_maestro_ort_int {6}
\int_const:Nn \c_maestro_zusatz_int {7}
\int_const:Nn \c_maestro_postfach_int {8}


\ior_new:N \l_maestro_quelle_stream

\ior_open:Nn  \l_maestro_quelle_stream  {Adressen.csv}

\ior_map_inline:Nn \l_maestro_quelle_stream {%
  \seq_set_split:Nnn \l_tmpa_seq {;} {#1}% Split the sequence
  \begin{frame}
    \includegraphics[scale=0.2]{beeduck.jpg}\par

%    \vspace{0.6\paperheight}
%    \hspace{0.6\paperheight}????
    \seq_item:Nn \l_tmpa_seq {\c_maestro_titel_int}~\seq_item:Nn \l_tmpa_seq {\c_maestro_vorname_int}~\seq_item:Nn \l_tmpa_seq {\c_maestro_name_int}\par
    \tl_set:Nx \l_tmpa_tl {\seq_item:Nn \l_tmpa_seq {\c_maestro_zusatz_int}}
    \tl_if_empty:NF \l_tmpa_tl {%
      \tl_use:N \l_tmpa_tl\par
    }
    \tl_set:Nx \l_tmpa_tl {\seq_item:Nn \l_tmpa_seq {\c_maestro_postfach_int}}
    \tl_if_empty:NF \l_tmpa_tl {%
      Postfach~\tl_use:N \l_tmpa_tl\par
    }
    \seq_item:Nn \l_tmpa_seq {\c_maestro_strasse_int}\par
    \seq_item:Nn \l_tmpa_seq {\c_maestro_plz_int}~\seq_item:Nn \l_tmpa_seq {\c_maestro_ort_int}
  \end{frame}
}
\ExplSyntaxOff


\end{document}

Y Adressen.csvestá aquí:

;Gandalf;Stormcrow;Shireroad;10000;Shire;bei\ Schmidt;11111
;Baggins;Bilbo;Shireroad;10000;Shire;bei\ Müller;22222
Dwarf-King;Thorin;Oak-Shield;Erebor\ Road;Middle\ Earth;Arkenstone;at\ Smaug's\ cave;33333

ingrese la descripción de la imagen aquí

información relacionada