I have a standardized LaTex document that contains two letters and several pages of documentation. This is to be sent to each and every customer we have, for every order we deliver. The document stays consistently the same, but the adresses, customer name, project names, contact person etc. may vary.
All of the elements that vary are referenced string variables throughout the document, so to change their respective values you just change them in the preamble of the main.tex document (I'm using the standalone package and have the two letters and the documentation in three separate tex files.) where they are defined. Works like a charm, all good and well.
main.tex:
\Documentclass{article}
\usepackage{filehook}
\usepackage{currfile}
\usepackage[subpreambles=true]{standalone}
\usepackage{import}
\newcommand{\Customer}{WeBoughtYourStuff Inc.}
\newcommand{\ContactPerson}{Whoever}
\newcommand{\Adress}{Whereever}
\begin{document}
\import{./Letters/}{Letter1.tex}
\newpage
\import{./Doc/}{Documentation.tex}
\newpage
\import{./Letters/}{Letter2.tex}
\end{document}
the sub documents:
\documentclass[float=false, crop=false, class=letter]{standalone}
\usepackage[subpreambles=true]{standalone}
\usepackage{import}
\begin{document}
\vspace*{26mm}
\hspace{2.5cm}
\parbox{0.25\textwidth}{\ContactPerson \ \Customer \ \Adress}\
Blahblahblah
Best regards\\
The People you bought the stuff from
\end{document}
What I need now is a simple program/frontend that essensially is a small window with five text fields and an OK-button that feeds the text fields to each respective string variable and compiles the tex-document without the user ever opening it. You just fill out the fields, click the button, and out comes the pdf.
How do I make this happen? Is there any existing solution available for these scenarios? I suppose a simple batch file or script that queries the user for the value of each variable, and then compiles the document also could work, but the finished product needs to be simple enough for any unexperienced idiot to be able to use it, or I'm stuck with this particular task forever...
\newcommandto a file. But PowerShell GUI programming is off-topic here … LaTeX itself has\typeinbut this is not very comfortable and nothing I would recommend. – cabohah Dec 07 '22 at 15:52