Is it possible to generate custom exams taken the student's names from a csv archive?
I'd like to generate a single PDF file containing multiple exams (template available below).
Each exam must have the field 'name' (see template) filled with the name of a student taken from a external list file (such as .csv).
Template:
documentclass[a4paper]{article}
usepackage[utf8]{inputenc}
usepackage[top=6mm,includehead,left=1.5cm,bottom=2cm,right=1.5cm,headsep=0.5cm]{geometry}
usepackage{tikz}
usepackage{multicol}
usepackage{xcolor}
usepackage{fancyhdr}
usepackage{lipsum}
renewcommand{footrulewidth}{1.2pt} % linha no footer
renewcommand{headrulewidth}{1.2pt}% linha no header
lfoot{ttfamily today}
rfoot{ttfamily 14 de dezembro de 2018}
pagestyle{fancy}
fancypagestyle{firststyle}{%
renewcommand{headrulewidth}{0pt}% Remove header rule
lhead{%
defscale{0.6}%
defroundc{scale*0.1cm}% rc = 10% de sc
raisebox{-2baselineskip}[0pt][0pt]{begin{tikzpicture}[scale=scale]
definecolor{tempcolor}{RGB}{200,25,30}
filldraw[tempcolor][rounded corners=roundc] (2cm,0cm) rectangle (1.2cm,-0.5cm);
filldraw[tempcolor][rounded corners=roundc] (2cm,-0.6cm) rectangle (1.1cm,-1.1cm);
filldraw[tempcolor][rounded corners=roundc] (2cm,-0.6cm) rectangle (1.5cm,-1.1cm);
filldraw[tempcolor][rounded corners=roundc] (1.7cm,-1.2cm) rectangle (1.2cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (0.6cm,-1.2cm) rectangle (1.1cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (1.6cm,-1.2cm) rectangle (1.8cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (1.7cm,-1.8cm) rectangle (1.2cm,-2.3cm);
node[scale=scale,fill=white] at (5.92,-0.85) {resizebox{6.7cm}{0.5cm}{sffamily textbf{ESCOLA}}};
node[scale=scale,fill=white] at (4.52,-1.55) {resizebox{5cm}{0.5cm}{sffamily {Construindo o Futuro}}};
end{tikzpicture}}
}
chead{raisebox{-2baselineskip}[0pt][0pt]{rule[-2.5baselineskip]{linewidth}{1.2pt}}}
rhead{raisebox{-2baselineskip}[0pt][0pt]{begin{tabular}{@{}r@{}}
tikz node at (0,0) {textbf{Final Exam}};\
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=8.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Name}:}] {phantom{ttfamily 15,0}};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=2cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Turma}:}] {phantom{ttfamily 15,0}};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=1.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Valor}:}] {ttfamily 15,0};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=1.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Nota}:}] {phantom{ttfamily 15,0}};}
end{tabular}}
}
lfoot{ttfamily Prof. Lucas}
rfoot{ttfamily today}
}
AtBeginDocument{
thispagestyle{firststyle}
vspace*{2baselineskip}
}
begin{document}
begin{multicols}{2}
begin{enumerate}
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
end{enumerate}
end{multicols}
end{document}
csvsimple
add a comment |
I'd like to generate a single PDF file containing multiple exams (template available below).
Each exam must have the field 'name' (see template) filled with the name of a student taken from a external list file (such as .csv).
Template:
documentclass[a4paper]{article}
usepackage[utf8]{inputenc}
usepackage[top=6mm,includehead,left=1.5cm,bottom=2cm,right=1.5cm,headsep=0.5cm]{geometry}
usepackage{tikz}
usepackage{multicol}
usepackage{xcolor}
usepackage{fancyhdr}
usepackage{lipsum}
renewcommand{footrulewidth}{1.2pt} % linha no footer
renewcommand{headrulewidth}{1.2pt}% linha no header
lfoot{ttfamily today}
rfoot{ttfamily 14 de dezembro de 2018}
pagestyle{fancy}
fancypagestyle{firststyle}{%
renewcommand{headrulewidth}{0pt}% Remove header rule
lhead{%
defscale{0.6}%
defroundc{scale*0.1cm}% rc = 10% de sc
raisebox{-2baselineskip}[0pt][0pt]{begin{tikzpicture}[scale=scale]
definecolor{tempcolor}{RGB}{200,25,30}
filldraw[tempcolor][rounded corners=roundc] (2cm,0cm) rectangle (1.2cm,-0.5cm);
filldraw[tempcolor][rounded corners=roundc] (2cm,-0.6cm) rectangle (1.1cm,-1.1cm);
filldraw[tempcolor][rounded corners=roundc] (2cm,-0.6cm) rectangle (1.5cm,-1.1cm);
filldraw[tempcolor][rounded corners=roundc] (1.7cm,-1.2cm) rectangle (1.2cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (0.6cm,-1.2cm) rectangle (1.1cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (1.6cm,-1.2cm) rectangle (1.8cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (1.7cm,-1.8cm) rectangle (1.2cm,-2.3cm);
node[scale=scale,fill=white] at (5.92,-0.85) {resizebox{6.7cm}{0.5cm}{sffamily textbf{ESCOLA}}};
node[scale=scale,fill=white] at (4.52,-1.55) {resizebox{5cm}{0.5cm}{sffamily {Construindo o Futuro}}};
end{tikzpicture}}
}
chead{raisebox{-2baselineskip}[0pt][0pt]{rule[-2.5baselineskip]{linewidth}{1.2pt}}}
rhead{raisebox{-2baselineskip}[0pt][0pt]{begin{tabular}{@{}r@{}}
tikz node at (0,0) {textbf{Final Exam}};\
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=8.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Name}:}] {phantom{ttfamily 15,0}};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=2cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Turma}:}] {phantom{ttfamily 15,0}};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=1.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Valor}:}] {ttfamily 15,0};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=1.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Nota}:}] {phantom{ttfamily 15,0}};}
end{tabular}}
}
lfoot{ttfamily Prof. Lucas}
rfoot{ttfamily today}
}
AtBeginDocument{
thispagestyle{firststyle}
vspace*{2baselineskip}
}
begin{document}
begin{multicols}{2}
begin{enumerate}
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
end{enumerate}
end{multicols}
end{document}
csvsimple
add a comment |
I'd like to generate a single PDF file containing multiple exams (template available below).
Each exam must have the field 'name' (see template) filled with the name of a student taken from a external list file (such as .csv).
Template:
documentclass[a4paper]{article}
usepackage[utf8]{inputenc}
usepackage[top=6mm,includehead,left=1.5cm,bottom=2cm,right=1.5cm,headsep=0.5cm]{geometry}
usepackage{tikz}
usepackage{multicol}
usepackage{xcolor}
usepackage{fancyhdr}
usepackage{lipsum}
renewcommand{footrulewidth}{1.2pt} % linha no footer
renewcommand{headrulewidth}{1.2pt}% linha no header
lfoot{ttfamily today}
rfoot{ttfamily 14 de dezembro de 2018}
pagestyle{fancy}
fancypagestyle{firststyle}{%
renewcommand{headrulewidth}{0pt}% Remove header rule
lhead{%
defscale{0.6}%
defroundc{scale*0.1cm}% rc = 10% de sc
raisebox{-2baselineskip}[0pt][0pt]{begin{tikzpicture}[scale=scale]
definecolor{tempcolor}{RGB}{200,25,30}
filldraw[tempcolor][rounded corners=roundc] (2cm,0cm) rectangle (1.2cm,-0.5cm);
filldraw[tempcolor][rounded corners=roundc] (2cm,-0.6cm) rectangle (1.1cm,-1.1cm);
filldraw[tempcolor][rounded corners=roundc] (2cm,-0.6cm) rectangle (1.5cm,-1.1cm);
filldraw[tempcolor][rounded corners=roundc] (1.7cm,-1.2cm) rectangle (1.2cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (0.6cm,-1.2cm) rectangle (1.1cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (1.6cm,-1.2cm) rectangle (1.8cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (1.7cm,-1.8cm) rectangle (1.2cm,-2.3cm);
node[scale=scale,fill=white] at (5.92,-0.85) {resizebox{6.7cm}{0.5cm}{sffamily textbf{ESCOLA}}};
node[scale=scale,fill=white] at (4.52,-1.55) {resizebox{5cm}{0.5cm}{sffamily {Construindo o Futuro}}};
end{tikzpicture}}
}
chead{raisebox{-2baselineskip}[0pt][0pt]{rule[-2.5baselineskip]{linewidth}{1.2pt}}}
rhead{raisebox{-2baselineskip}[0pt][0pt]{begin{tabular}{@{}r@{}}
tikz node at (0,0) {textbf{Final Exam}};\
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=8.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Name}:}] {phantom{ttfamily 15,0}};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=2cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Turma}:}] {phantom{ttfamily 15,0}};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=1.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Valor}:}] {ttfamily 15,0};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=1.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Nota}:}] {phantom{ttfamily 15,0}};}
end{tabular}}
}
lfoot{ttfamily Prof. Lucas}
rfoot{ttfamily today}
}
AtBeginDocument{
thispagestyle{firststyle}
vspace*{2baselineskip}
}
begin{document}
begin{multicols}{2}
begin{enumerate}
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
end{enumerate}
end{multicols}
end{document}
csvsimple
I'd like to generate a single PDF file containing multiple exams (template available below).
Each exam must have the field 'name' (see template) filled with the name of a student taken from a external list file (such as .csv).
Template:
documentclass[a4paper]{article}
usepackage[utf8]{inputenc}
usepackage[top=6mm,includehead,left=1.5cm,bottom=2cm,right=1.5cm,headsep=0.5cm]{geometry}
usepackage{tikz}
usepackage{multicol}
usepackage{xcolor}
usepackage{fancyhdr}
usepackage{lipsum}
renewcommand{footrulewidth}{1.2pt} % linha no footer
renewcommand{headrulewidth}{1.2pt}% linha no header
lfoot{ttfamily today}
rfoot{ttfamily 14 de dezembro de 2018}
pagestyle{fancy}
fancypagestyle{firststyle}{%
renewcommand{headrulewidth}{0pt}% Remove header rule
lhead{%
defscale{0.6}%
defroundc{scale*0.1cm}% rc = 10% de sc
raisebox{-2baselineskip}[0pt][0pt]{begin{tikzpicture}[scale=scale]
definecolor{tempcolor}{RGB}{200,25,30}
filldraw[tempcolor][rounded corners=roundc] (2cm,0cm) rectangle (1.2cm,-0.5cm);
filldraw[tempcolor][rounded corners=roundc] (2cm,-0.6cm) rectangle (1.1cm,-1.1cm);
filldraw[tempcolor][rounded corners=roundc] (2cm,-0.6cm) rectangle (1.5cm,-1.1cm);
filldraw[tempcolor][rounded corners=roundc] (1.7cm,-1.2cm) rectangle (1.2cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (0.6cm,-1.2cm) rectangle (1.1cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (1.6cm,-1.2cm) rectangle (1.8cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (1.7cm,-1.8cm) rectangle (1.2cm,-2.3cm);
node[scale=scale,fill=white] at (5.92,-0.85) {resizebox{6.7cm}{0.5cm}{sffamily textbf{ESCOLA}}};
node[scale=scale,fill=white] at (4.52,-1.55) {resizebox{5cm}{0.5cm}{sffamily {Construindo o Futuro}}};
end{tikzpicture}}
}
chead{raisebox{-2baselineskip}[0pt][0pt]{rule[-2.5baselineskip]{linewidth}{1.2pt}}}
rhead{raisebox{-2baselineskip}[0pt][0pt]{begin{tabular}{@{}r@{}}
tikz node at (0,0) {textbf{Final Exam}};\
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=8.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Name}:}] {phantom{ttfamily 15,0}};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=2cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Turma}:}] {phantom{ttfamily 15,0}};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=1.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Valor}:}] {ttfamily 15,0};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=1.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Nota}:}] {phantom{ttfamily 15,0}};}
end{tabular}}
}
lfoot{ttfamily Prof. Lucas}
rfoot{ttfamily today}
}
AtBeginDocument{
thispagestyle{firststyle}
vspace*{2baselineskip}
}
begin{document}
begin{multicols}{2}
begin{enumerate}
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
end{enumerate}
end{multicols}
end{document}
csvsimple
csvsimple
edited Dec 20 '18 at 9:03
asked Dec 19 '18 at 23:14
Lucas Martins
1067
1067
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Sure, it's possible. I focus on the loop that reads data from a csv file and builds a multipage document. I do not, at this point, change your TikZ code, which can be simplified. Anyway, this reads the names from a file and prints the "exams".
documentclass[a4paper]{article}
usepackage[utf8]{inputenc}
usepackage[top=6mm,includehead,left=1.5cm,bottom=2cm,right=1.5cm,headsep=0.5cm]{geometry}
usepackage{tikz}
usepackage{multicol}
usepackage{xcolor}
usepackage{fancyhdr}
usepackage{lipsum}
renewcommand{footrulewidth}{1.2pt} % linha no footer
renewcommand{headrulewidth}{1.2pt}% linha no header
lfoot{ttfamily today}
rfoot{ttfamily 14 de dezembro de 2018}
pagestyle{fancy}
fancypagestyle{firststyle}{%
renewcommand{headrulewidth}{0pt}% Remove header rule
lhead{%
defscale{0.6}%
defroundc{scale*0.1cm}% rc = 10% de sc
raisebox{-2baselineskip}[0pt][0pt]{begin{tikzpicture}[scale=scale]
definecolor{tempcolor}{RGB}{200,25,30}
filldraw[tempcolor][rounded corners=roundc] (2cm,0cm) rectangle (1.2cm,-0.5cm);
filldraw[tempcolor][rounded corners=roundc] (2cm,-0.6cm) rectangle (1.1cm,-1.1cm);
filldraw[tempcolor][rounded corners=roundc] (2cm,-0.6cm) rectangle (1.5cm,-1.1cm);
filldraw[tempcolor][rounded corners=roundc] (1.7cm,-1.2cm) rectangle (1.2cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (0.6cm,-1.2cm) rectangle (1.1cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (1.6cm,-1.2cm) rectangle (1.8cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (1.7cm,-1.8cm) rectangle (1.2cm,-2.3cm);
node[scale=scale,fill=white] at (5.92,-0.85) {resizebox{6.7cm}{0.5cm}{sffamily textbf{ESCOLA}}};
node[scale=scale,fill=white] at (4.52,-1.55) {resizebox{5cm}{0.5cm}{sffamily {Construindo o Futuro}}};
end{tikzpicture}}
}
chead{raisebox{-2baselineskip}[0pt][0pt]{rule[-2.5baselineskip]{linewidth}{1.2pt}}}
rhead{raisebox{-2baselineskip}[0pt][0pt]{begin{tabular}{@{}r@{}}
tikz node at (0,0) {textbf{Final Exam}};\
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=8.5cm,
minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label
distance=-2mm,inner xsep=2pt]90:{ttfamily Name}:}] {mynamephantom{ttfamily 15,0}};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=2cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Turma}:}] {phantom{ttfamily 15,0}};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=1.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Valor}:}] {ttfamily 15,0};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=1.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Nota}:}] {phantom{ttfamily 15,0}};}
end{tabular}}
}
lfoot{ttfamily Prof. Lucas}
rfoot{ttfamily today}
}
AtBeginDocument{
thispagestyle{firststyle}
vspace*{2baselineskip}
}
usepackage{xstring}
usepackage{pgfplotstable}
% from https://tex.stackexchange.com/a/445369/121799
newcommand*{ReadOutElement}[4]{%
pgfplotstablegetelem{#2}{#3}of{#1}%
let#4pgfplotsretval
}
usepackage{filecontents}
begin{filecontents*}{students.csv}
first last middle
Carla TeX nan
Karl Koala Konrad
TokZ Mouse {Topolino Jerry}
end{filecontents*}
begin{document}
pgfplotstableread{students.csv}loadedtable
pgfplotstablegetrowsof{loadedtable}
pgfmathtruncatemacro{rownum}{pgfplotsretval-1}
foreach X in {0,...,rownum}
{setcounter{page}{1}
ReadOutElement{loadedtable}{X}{first}{tmpfirst}
ReadOutElement{loadedtable}{X}{last}{tmplast}
ReadOutElement{loadedtable}{X}{middle}{tmpmiddle}
typeout{tmpmiddle}
IfStrEq{tmpmiddle}{nan}{xdefmyname{tmpfirst~tmplast}}{xdefmyname{tmpfirst~tmpmiddle~tmplast}}
thispagestyle{firststyle}
vspace*{2baselineskip}
begin{multicols}{2}
begin{enumerate}
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
end{enumerate}
end{multicols}
clearpage
}
end{document}
Great! Only a detail: From this suggested code the page numbering runs continually. How could I fix it?
– Lucas Martins
Dec 20 '18 at 1:14
I found other trouble: The code only supports two column entries (name + surname) at csv file. How it can be modified for a arbitrary number of midle names?
– Lucas Martins
Dec 20 '18 at 1:45
1
@LucasMartins Just add columnsmiddle1
,middle2
etc. and read them out withReadOutElement{loadedtable}{X}{middle1}{tmpfmidone}
etc. Page numbers can be reset e.g. withsetcounter{page}{0}
. I am not really online now, but if you continue having problems let me know, I will be online in a bit.
– marmot
Dec 20 '18 at 2:56
+1 for the students' names!
– CarLaTeX
Dec 20 '18 at 7:34
1
@LucasMartins I added a proposal to fix it. If the student has no middle name, put nan, if (s)he has several, put them in braces.
– marmot
Dec 20 '18 at 13:03
|
show 1 more comment
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f466630%2fis-it-possible-to-generate-custom-exams-taken-the-students-names-from-a-csv-arc%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sure, it's possible. I focus on the loop that reads data from a csv file and builds a multipage document. I do not, at this point, change your TikZ code, which can be simplified. Anyway, this reads the names from a file and prints the "exams".
documentclass[a4paper]{article}
usepackage[utf8]{inputenc}
usepackage[top=6mm,includehead,left=1.5cm,bottom=2cm,right=1.5cm,headsep=0.5cm]{geometry}
usepackage{tikz}
usepackage{multicol}
usepackage{xcolor}
usepackage{fancyhdr}
usepackage{lipsum}
renewcommand{footrulewidth}{1.2pt} % linha no footer
renewcommand{headrulewidth}{1.2pt}% linha no header
lfoot{ttfamily today}
rfoot{ttfamily 14 de dezembro de 2018}
pagestyle{fancy}
fancypagestyle{firststyle}{%
renewcommand{headrulewidth}{0pt}% Remove header rule
lhead{%
defscale{0.6}%
defroundc{scale*0.1cm}% rc = 10% de sc
raisebox{-2baselineskip}[0pt][0pt]{begin{tikzpicture}[scale=scale]
definecolor{tempcolor}{RGB}{200,25,30}
filldraw[tempcolor][rounded corners=roundc] (2cm,0cm) rectangle (1.2cm,-0.5cm);
filldraw[tempcolor][rounded corners=roundc] (2cm,-0.6cm) rectangle (1.1cm,-1.1cm);
filldraw[tempcolor][rounded corners=roundc] (2cm,-0.6cm) rectangle (1.5cm,-1.1cm);
filldraw[tempcolor][rounded corners=roundc] (1.7cm,-1.2cm) rectangle (1.2cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (0.6cm,-1.2cm) rectangle (1.1cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (1.6cm,-1.2cm) rectangle (1.8cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (1.7cm,-1.8cm) rectangle (1.2cm,-2.3cm);
node[scale=scale,fill=white] at (5.92,-0.85) {resizebox{6.7cm}{0.5cm}{sffamily textbf{ESCOLA}}};
node[scale=scale,fill=white] at (4.52,-1.55) {resizebox{5cm}{0.5cm}{sffamily {Construindo o Futuro}}};
end{tikzpicture}}
}
chead{raisebox{-2baselineskip}[0pt][0pt]{rule[-2.5baselineskip]{linewidth}{1.2pt}}}
rhead{raisebox{-2baselineskip}[0pt][0pt]{begin{tabular}{@{}r@{}}
tikz node at (0,0) {textbf{Final Exam}};\
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=8.5cm,
minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label
distance=-2mm,inner xsep=2pt]90:{ttfamily Name}:}] {mynamephantom{ttfamily 15,0}};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=2cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Turma}:}] {phantom{ttfamily 15,0}};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=1.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Valor}:}] {ttfamily 15,0};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=1.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Nota}:}] {phantom{ttfamily 15,0}};}
end{tabular}}
}
lfoot{ttfamily Prof. Lucas}
rfoot{ttfamily today}
}
AtBeginDocument{
thispagestyle{firststyle}
vspace*{2baselineskip}
}
usepackage{xstring}
usepackage{pgfplotstable}
% from https://tex.stackexchange.com/a/445369/121799
newcommand*{ReadOutElement}[4]{%
pgfplotstablegetelem{#2}{#3}of{#1}%
let#4pgfplotsretval
}
usepackage{filecontents}
begin{filecontents*}{students.csv}
first last middle
Carla TeX nan
Karl Koala Konrad
TokZ Mouse {Topolino Jerry}
end{filecontents*}
begin{document}
pgfplotstableread{students.csv}loadedtable
pgfplotstablegetrowsof{loadedtable}
pgfmathtruncatemacro{rownum}{pgfplotsretval-1}
foreach X in {0,...,rownum}
{setcounter{page}{1}
ReadOutElement{loadedtable}{X}{first}{tmpfirst}
ReadOutElement{loadedtable}{X}{last}{tmplast}
ReadOutElement{loadedtable}{X}{middle}{tmpmiddle}
typeout{tmpmiddle}
IfStrEq{tmpmiddle}{nan}{xdefmyname{tmpfirst~tmplast}}{xdefmyname{tmpfirst~tmpmiddle~tmplast}}
thispagestyle{firststyle}
vspace*{2baselineskip}
begin{multicols}{2}
begin{enumerate}
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
end{enumerate}
end{multicols}
clearpage
}
end{document}
Great! Only a detail: From this suggested code the page numbering runs continually. How could I fix it?
– Lucas Martins
Dec 20 '18 at 1:14
I found other trouble: The code only supports two column entries (name + surname) at csv file. How it can be modified for a arbitrary number of midle names?
– Lucas Martins
Dec 20 '18 at 1:45
1
@LucasMartins Just add columnsmiddle1
,middle2
etc. and read them out withReadOutElement{loadedtable}{X}{middle1}{tmpfmidone}
etc. Page numbers can be reset e.g. withsetcounter{page}{0}
. I am not really online now, but if you continue having problems let me know, I will be online in a bit.
– marmot
Dec 20 '18 at 2:56
+1 for the students' names!
– CarLaTeX
Dec 20 '18 at 7:34
1
@LucasMartins I added a proposal to fix it. If the student has no middle name, put nan, if (s)he has several, put them in braces.
– marmot
Dec 20 '18 at 13:03
|
show 1 more comment
Sure, it's possible. I focus on the loop that reads data from a csv file and builds a multipage document. I do not, at this point, change your TikZ code, which can be simplified. Anyway, this reads the names from a file and prints the "exams".
documentclass[a4paper]{article}
usepackage[utf8]{inputenc}
usepackage[top=6mm,includehead,left=1.5cm,bottom=2cm,right=1.5cm,headsep=0.5cm]{geometry}
usepackage{tikz}
usepackage{multicol}
usepackage{xcolor}
usepackage{fancyhdr}
usepackage{lipsum}
renewcommand{footrulewidth}{1.2pt} % linha no footer
renewcommand{headrulewidth}{1.2pt}% linha no header
lfoot{ttfamily today}
rfoot{ttfamily 14 de dezembro de 2018}
pagestyle{fancy}
fancypagestyle{firststyle}{%
renewcommand{headrulewidth}{0pt}% Remove header rule
lhead{%
defscale{0.6}%
defroundc{scale*0.1cm}% rc = 10% de sc
raisebox{-2baselineskip}[0pt][0pt]{begin{tikzpicture}[scale=scale]
definecolor{tempcolor}{RGB}{200,25,30}
filldraw[tempcolor][rounded corners=roundc] (2cm,0cm) rectangle (1.2cm,-0.5cm);
filldraw[tempcolor][rounded corners=roundc] (2cm,-0.6cm) rectangle (1.1cm,-1.1cm);
filldraw[tempcolor][rounded corners=roundc] (2cm,-0.6cm) rectangle (1.5cm,-1.1cm);
filldraw[tempcolor][rounded corners=roundc] (1.7cm,-1.2cm) rectangle (1.2cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (0.6cm,-1.2cm) rectangle (1.1cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (1.6cm,-1.2cm) rectangle (1.8cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (1.7cm,-1.8cm) rectangle (1.2cm,-2.3cm);
node[scale=scale,fill=white] at (5.92,-0.85) {resizebox{6.7cm}{0.5cm}{sffamily textbf{ESCOLA}}};
node[scale=scale,fill=white] at (4.52,-1.55) {resizebox{5cm}{0.5cm}{sffamily {Construindo o Futuro}}};
end{tikzpicture}}
}
chead{raisebox{-2baselineskip}[0pt][0pt]{rule[-2.5baselineskip]{linewidth}{1.2pt}}}
rhead{raisebox{-2baselineskip}[0pt][0pt]{begin{tabular}{@{}r@{}}
tikz node at (0,0) {textbf{Final Exam}};\
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=8.5cm,
minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label
distance=-2mm,inner xsep=2pt]90:{ttfamily Name}:}] {mynamephantom{ttfamily 15,0}};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=2cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Turma}:}] {phantom{ttfamily 15,0}};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=1.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Valor}:}] {ttfamily 15,0};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=1.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Nota}:}] {phantom{ttfamily 15,0}};}
end{tabular}}
}
lfoot{ttfamily Prof. Lucas}
rfoot{ttfamily today}
}
AtBeginDocument{
thispagestyle{firststyle}
vspace*{2baselineskip}
}
usepackage{xstring}
usepackage{pgfplotstable}
% from https://tex.stackexchange.com/a/445369/121799
newcommand*{ReadOutElement}[4]{%
pgfplotstablegetelem{#2}{#3}of{#1}%
let#4pgfplotsretval
}
usepackage{filecontents}
begin{filecontents*}{students.csv}
first last middle
Carla TeX nan
Karl Koala Konrad
TokZ Mouse {Topolino Jerry}
end{filecontents*}
begin{document}
pgfplotstableread{students.csv}loadedtable
pgfplotstablegetrowsof{loadedtable}
pgfmathtruncatemacro{rownum}{pgfplotsretval-1}
foreach X in {0,...,rownum}
{setcounter{page}{1}
ReadOutElement{loadedtable}{X}{first}{tmpfirst}
ReadOutElement{loadedtable}{X}{last}{tmplast}
ReadOutElement{loadedtable}{X}{middle}{tmpmiddle}
typeout{tmpmiddle}
IfStrEq{tmpmiddle}{nan}{xdefmyname{tmpfirst~tmplast}}{xdefmyname{tmpfirst~tmpmiddle~tmplast}}
thispagestyle{firststyle}
vspace*{2baselineskip}
begin{multicols}{2}
begin{enumerate}
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
end{enumerate}
end{multicols}
clearpage
}
end{document}
Great! Only a detail: From this suggested code the page numbering runs continually. How could I fix it?
– Lucas Martins
Dec 20 '18 at 1:14
I found other trouble: The code only supports two column entries (name + surname) at csv file. How it can be modified for a arbitrary number of midle names?
– Lucas Martins
Dec 20 '18 at 1:45
1
@LucasMartins Just add columnsmiddle1
,middle2
etc. and read them out withReadOutElement{loadedtable}{X}{middle1}{tmpfmidone}
etc. Page numbers can be reset e.g. withsetcounter{page}{0}
. I am not really online now, but if you continue having problems let me know, I will be online in a bit.
– marmot
Dec 20 '18 at 2:56
+1 for the students' names!
– CarLaTeX
Dec 20 '18 at 7:34
1
@LucasMartins I added a proposal to fix it. If the student has no middle name, put nan, if (s)he has several, put them in braces.
– marmot
Dec 20 '18 at 13:03
|
show 1 more comment
Sure, it's possible. I focus on the loop that reads data from a csv file and builds a multipage document. I do not, at this point, change your TikZ code, which can be simplified. Anyway, this reads the names from a file and prints the "exams".
documentclass[a4paper]{article}
usepackage[utf8]{inputenc}
usepackage[top=6mm,includehead,left=1.5cm,bottom=2cm,right=1.5cm,headsep=0.5cm]{geometry}
usepackage{tikz}
usepackage{multicol}
usepackage{xcolor}
usepackage{fancyhdr}
usepackage{lipsum}
renewcommand{footrulewidth}{1.2pt} % linha no footer
renewcommand{headrulewidth}{1.2pt}% linha no header
lfoot{ttfamily today}
rfoot{ttfamily 14 de dezembro de 2018}
pagestyle{fancy}
fancypagestyle{firststyle}{%
renewcommand{headrulewidth}{0pt}% Remove header rule
lhead{%
defscale{0.6}%
defroundc{scale*0.1cm}% rc = 10% de sc
raisebox{-2baselineskip}[0pt][0pt]{begin{tikzpicture}[scale=scale]
definecolor{tempcolor}{RGB}{200,25,30}
filldraw[tempcolor][rounded corners=roundc] (2cm,0cm) rectangle (1.2cm,-0.5cm);
filldraw[tempcolor][rounded corners=roundc] (2cm,-0.6cm) rectangle (1.1cm,-1.1cm);
filldraw[tempcolor][rounded corners=roundc] (2cm,-0.6cm) rectangle (1.5cm,-1.1cm);
filldraw[tempcolor][rounded corners=roundc] (1.7cm,-1.2cm) rectangle (1.2cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (0.6cm,-1.2cm) rectangle (1.1cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (1.6cm,-1.2cm) rectangle (1.8cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (1.7cm,-1.8cm) rectangle (1.2cm,-2.3cm);
node[scale=scale,fill=white] at (5.92,-0.85) {resizebox{6.7cm}{0.5cm}{sffamily textbf{ESCOLA}}};
node[scale=scale,fill=white] at (4.52,-1.55) {resizebox{5cm}{0.5cm}{sffamily {Construindo o Futuro}}};
end{tikzpicture}}
}
chead{raisebox{-2baselineskip}[0pt][0pt]{rule[-2.5baselineskip]{linewidth}{1.2pt}}}
rhead{raisebox{-2baselineskip}[0pt][0pt]{begin{tabular}{@{}r@{}}
tikz node at (0,0) {textbf{Final Exam}};\
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=8.5cm,
minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label
distance=-2mm,inner xsep=2pt]90:{ttfamily Name}:}] {mynamephantom{ttfamily 15,0}};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=2cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Turma}:}] {phantom{ttfamily 15,0}};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=1.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Valor}:}] {ttfamily 15,0};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=1.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Nota}:}] {phantom{ttfamily 15,0}};}
end{tabular}}
}
lfoot{ttfamily Prof. Lucas}
rfoot{ttfamily today}
}
AtBeginDocument{
thispagestyle{firststyle}
vspace*{2baselineskip}
}
usepackage{xstring}
usepackage{pgfplotstable}
% from https://tex.stackexchange.com/a/445369/121799
newcommand*{ReadOutElement}[4]{%
pgfplotstablegetelem{#2}{#3}of{#1}%
let#4pgfplotsretval
}
usepackage{filecontents}
begin{filecontents*}{students.csv}
first last middle
Carla TeX nan
Karl Koala Konrad
TokZ Mouse {Topolino Jerry}
end{filecontents*}
begin{document}
pgfplotstableread{students.csv}loadedtable
pgfplotstablegetrowsof{loadedtable}
pgfmathtruncatemacro{rownum}{pgfplotsretval-1}
foreach X in {0,...,rownum}
{setcounter{page}{1}
ReadOutElement{loadedtable}{X}{first}{tmpfirst}
ReadOutElement{loadedtable}{X}{last}{tmplast}
ReadOutElement{loadedtable}{X}{middle}{tmpmiddle}
typeout{tmpmiddle}
IfStrEq{tmpmiddle}{nan}{xdefmyname{tmpfirst~tmplast}}{xdefmyname{tmpfirst~tmpmiddle~tmplast}}
thispagestyle{firststyle}
vspace*{2baselineskip}
begin{multicols}{2}
begin{enumerate}
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
end{enumerate}
end{multicols}
clearpage
}
end{document}
Sure, it's possible. I focus on the loop that reads data from a csv file and builds a multipage document. I do not, at this point, change your TikZ code, which can be simplified. Anyway, this reads the names from a file and prints the "exams".
documentclass[a4paper]{article}
usepackage[utf8]{inputenc}
usepackage[top=6mm,includehead,left=1.5cm,bottom=2cm,right=1.5cm,headsep=0.5cm]{geometry}
usepackage{tikz}
usepackage{multicol}
usepackage{xcolor}
usepackage{fancyhdr}
usepackage{lipsum}
renewcommand{footrulewidth}{1.2pt} % linha no footer
renewcommand{headrulewidth}{1.2pt}% linha no header
lfoot{ttfamily today}
rfoot{ttfamily 14 de dezembro de 2018}
pagestyle{fancy}
fancypagestyle{firststyle}{%
renewcommand{headrulewidth}{0pt}% Remove header rule
lhead{%
defscale{0.6}%
defroundc{scale*0.1cm}% rc = 10% de sc
raisebox{-2baselineskip}[0pt][0pt]{begin{tikzpicture}[scale=scale]
definecolor{tempcolor}{RGB}{200,25,30}
filldraw[tempcolor][rounded corners=roundc] (2cm,0cm) rectangle (1.2cm,-0.5cm);
filldraw[tempcolor][rounded corners=roundc] (2cm,-0.6cm) rectangle (1.1cm,-1.1cm);
filldraw[tempcolor][rounded corners=roundc] (2cm,-0.6cm) rectangle (1.5cm,-1.1cm);
filldraw[tempcolor][rounded corners=roundc] (1.7cm,-1.2cm) rectangle (1.2cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (0.6cm,-1.2cm) rectangle (1.1cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (1.6cm,-1.2cm) rectangle (1.8cm,-1.7cm);
filldraw[tempcolor][rounded corners=roundc] (1.7cm,-1.8cm) rectangle (1.2cm,-2.3cm);
node[scale=scale,fill=white] at (5.92,-0.85) {resizebox{6.7cm}{0.5cm}{sffamily textbf{ESCOLA}}};
node[scale=scale,fill=white] at (4.52,-1.55) {resizebox{5cm}{0.5cm}{sffamily {Construindo o Futuro}}};
end{tikzpicture}}
}
chead{raisebox{-2baselineskip}[0pt][0pt]{rule[-2.5baselineskip]{linewidth}{1.2pt}}}
rhead{raisebox{-2baselineskip}[0pt][0pt]{begin{tabular}{@{}r@{}}
tikz node at (0,0) {textbf{Final Exam}};\
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=8.5cm,
minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label
distance=-2mm,inner xsep=2pt]90:{ttfamily Name}:}] {mynamephantom{ttfamily 15,0}};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=2cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Turma}:}] {phantom{ttfamily 15,0}};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=1.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Valor}:}] {ttfamily 15,0};}
tikz[baseline]{node[anchor=base, draw=black, thick, minimum width=1.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{ttfamily Nota}:}] {phantom{ttfamily 15,0}};}
end{tabular}}
}
lfoot{ttfamily Prof. Lucas}
rfoot{ttfamily today}
}
AtBeginDocument{
thispagestyle{firststyle}
vspace*{2baselineskip}
}
usepackage{xstring}
usepackage{pgfplotstable}
% from https://tex.stackexchange.com/a/445369/121799
newcommand*{ReadOutElement}[4]{%
pgfplotstablegetelem{#2}{#3}of{#1}%
let#4pgfplotsretval
}
usepackage{filecontents}
begin{filecontents*}{students.csv}
first last middle
Carla TeX nan
Karl Koala Konrad
TokZ Mouse {Topolino Jerry}
end{filecontents*}
begin{document}
pgfplotstableread{students.csv}loadedtable
pgfplotstablegetrowsof{loadedtable}
pgfmathtruncatemacro{rownum}{pgfplotsretval-1}
foreach X in {0,...,rownum}
{setcounter{page}{1}
ReadOutElement{loadedtable}{X}{first}{tmpfirst}
ReadOutElement{loadedtable}{X}{last}{tmplast}
ReadOutElement{loadedtable}{X}{middle}{tmpmiddle}
typeout{tmpmiddle}
IfStrEq{tmpmiddle}{nan}{xdefmyname{tmpfirst~tmplast}}{xdefmyname{tmpfirst~tmpmiddle~tmplast}}
thispagestyle{firststyle}
vspace*{2baselineskip}
begin{multicols}{2}
begin{enumerate}
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
item lipsum[1]
end{enumerate}
end{multicols}
clearpage
}
end{document}
edited Dec 20 '18 at 13:02
answered Dec 19 '18 at 23:44
marmot
87.8k4101189
87.8k4101189
Great! Only a detail: From this suggested code the page numbering runs continually. How could I fix it?
– Lucas Martins
Dec 20 '18 at 1:14
I found other trouble: The code only supports two column entries (name + surname) at csv file. How it can be modified for a arbitrary number of midle names?
– Lucas Martins
Dec 20 '18 at 1:45
1
@LucasMartins Just add columnsmiddle1
,middle2
etc. and read them out withReadOutElement{loadedtable}{X}{middle1}{tmpfmidone}
etc. Page numbers can be reset e.g. withsetcounter{page}{0}
. I am not really online now, but if you continue having problems let me know, I will be online in a bit.
– marmot
Dec 20 '18 at 2:56
+1 for the students' names!
– CarLaTeX
Dec 20 '18 at 7:34
1
@LucasMartins I added a proposal to fix it. If the student has no middle name, put nan, if (s)he has several, put them in braces.
– marmot
Dec 20 '18 at 13:03
|
show 1 more comment
Great! Only a detail: From this suggested code the page numbering runs continually. How could I fix it?
– Lucas Martins
Dec 20 '18 at 1:14
I found other trouble: The code only supports two column entries (name + surname) at csv file. How it can be modified for a arbitrary number of midle names?
– Lucas Martins
Dec 20 '18 at 1:45
1
@LucasMartins Just add columnsmiddle1
,middle2
etc. and read them out withReadOutElement{loadedtable}{X}{middle1}{tmpfmidone}
etc. Page numbers can be reset e.g. withsetcounter{page}{0}
. I am not really online now, but if you continue having problems let me know, I will be online in a bit.
– marmot
Dec 20 '18 at 2:56
+1 for the students' names!
– CarLaTeX
Dec 20 '18 at 7:34
1
@LucasMartins I added a proposal to fix it. If the student has no middle name, put nan, if (s)he has several, put them in braces.
– marmot
Dec 20 '18 at 13:03
Great! Only a detail: From this suggested code the page numbering runs continually. How could I fix it?
– Lucas Martins
Dec 20 '18 at 1:14
Great! Only a detail: From this suggested code the page numbering runs continually. How could I fix it?
– Lucas Martins
Dec 20 '18 at 1:14
I found other trouble: The code only supports two column entries (name + surname) at csv file. How it can be modified for a arbitrary number of midle names?
– Lucas Martins
Dec 20 '18 at 1:45
I found other trouble: The code only supports two column entries (name + surname) at csv file. How it can be modified for a arbitrary number of midle names?
– Lucas Martins
Dec 20 '18 at 1:45
1
1
@LucasMartins Just add columns
middle1
, middle2
etc. and read them out with ReadOutElement{loadedtable}{X}{middle1}{tmpfmidone}
etc. Page numbers can be reset e.g. with setcounter{page}{0}
. I am not really online now, but if you continue having problems let me know, I will be online in a bit.– marmot
Dec 20 '18 at 2:56
@LucasMartins Just add columns
middle1
, middle2
etc. and read them out with ReadOutElement{loadedtable}{X}{middle1}{tmpfmidone}
etc. Page numbers can be reset e.g. with setcounter{page}{0}
. I am not really online now, but if you continue having problems let me know, I will be online in a bit.– marmot
Dec 20 '18 at 2:56
+1 for the students' names!
– CarLaTeX
Dec 20 '18 at 7:34
+1 for the students' names!
– CarLaTeX
Dec 20 '18 at 7:34
1
1
@LucasMartins I added a proposal to fix it. If the student has no middle name, put nan, if (s)he has several, put them in braces.
– marmot
Dec 20 '18 at 13:03
@LucasMartins I added a proposal to fix it. If the student has no middle name, put nan, if (s)he has several, put them in braces.
– marmot
Dec 20 '18 at 13:03
|
show 1 more comment
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f466630%2fis-it-possible-to-generate-custom-exams-taken-the-students-names-from-a-csv-arc%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown