0

We have this latex file which we change frequently. What we usually do is:

  • go to line 51 and replace bio 101 with bio 102

  • go to line 103 and replace midterm with final

  • go to line 184 and replace summer 2016 with fall 2016

and etc. So, I was wondering, instead of doing that, is it possible to make an .exe file (possibly in c) asking:

  • Class?
  • Press M for midterm, F for final.
  • Year?
  • Semester? Press 1 for fall, 2 for spring, 3 for summer.

then creating a pdf output.

  • 4
    You don't need an exe-file, latex can also run interactively. But I would simply put a \newcommand\class{bio 102} in the preamble, and use \class in the document. Then all changes can be done in the preamble. – Ulrike Fischer Aug 8 '16 at 11:57
  • 1
    @UlrikeFischer can you please make an answer? – touhami Aug 8 '16 at 12:03
  • I would make those details change automatically as function of the compilation date (current date) as it seems there is a logic in the above stated mods that need to be made in the source file. – alwaysask Aug 8 '16 at 12:21
  • See Importing Parameters From a Separate File for a variety of ways to do this sort of thing. – Alan Munn Aug 8 '16 at 16:08
  • See also this answer using \typein to prompt the user for input during compilation – aehrm Aug 8 '16 at 18:36
2

You don't need an .exe or some external processor, latex can also run interactively.

But I would simply put a \newcommand\class{bio 102} in the preamble, and use \class in the document and so on. Then all changes can be done in the preamble.

  • a related approach, requiring some rewriting now, is to remove the \documentclass line, place it in a separate file, add the \class (and related) definition(s), followed by an \input of the file with the text. then only the small "driver" file needs to be touched unless there's a real change to the main text. – barbara beeton Aug 8 '16 at 13:26
  • @barbarabeeton: I can think of many approaches, one can also put the data in some csv-file, or calculate it, or ... But as the question is quite vage, I don't intent to elaborate. I wouldn't have answered anyway if touhami hadn't pinged me. – Ulrike Fischer Aug 8 '16 at 13:30

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.