1

Context:

I work as a statistican for a high school. One of my responsibilities is to generate performance reports for every teacher in the school, based on how well students evaluate them. I use LaTeX to generate the reports. There are 31 teachers in this high school, and for each of them the report is exactly the same except for two things:

1) Their names, and 2) their personal results.

As one can imagine, going through 31 LaTeX files and manually substituting names throughout 5 page documents is annoying, boring, and time-consuming. SO what I'm really looking for is a LaTeX "function" that does step 1 for me. Sort of like a macro.

Something that looks like this

report_generator(Adrian)
report_generator(Miller)
report_generator(Ifeanyi)
...

And then the names would be substituted throughout the entire document. So I'd do this 31 times, generate 31 LaTeX code files corresponding to 31 teachers, and then only substitute each teacher's personal results

  • 3
    Hello, welcome to TeX.SE. How to do that highly depends on the format of your input data. If this format is CSV, the datatool package can help. – frougon May 9 at 15:44
  • 2
    Welcome to TeX.SX! This is certainly possible but without more detail about these reports there is no way that we can help you. Can you give a minimal working example that shows a mock report and some idea of what the results look like and what you want done with them. It should be possible to make latex automatically generate all reports from the data but to say how we need some idea of what you want to do. – Andrew May 9 at 15:44
  • 2
    If you just want a macro for the names then you could use something like \newcommand\name{Victor S.} in the preamble and then \name in the report. – Andrew May 9 at 15:53
  • 1
    See tex.stackexchange.com/questions/344345/datatool-and-longtable for a simple example of datatool. – Marijn May 9 at 15:55
  • I'll try @Andrew's tip first and see how it goes. Thank you. – Victor S. May 9 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.