2

Is it possible to create document classes for forms (e.g. "donation confirmation"), so that in the TEX file, one has to only include the document class and the commands provided by it, but not the \begin{document}...\end{document} part, e.g.:

\documentclass[monetarygrant]{donation-confirmation}

\donorname{The Generous Company} \donoraddress{% Donor Street 42\ 12345 Donor City\ GERMANY } \donorvalue{1,234.56 EUR}

Short reasoning: For self-contained documents like forms, which only accept customization to the extend defined by their "interface commands", having the user to define the document environment would suggest a degree of freedom (content of that environment) that isn't expected by the form. Therfore, avoiding the need to define that environmental would make the usage of such forms more obvious.

If not possible, alternative solutions in the spirit "what you have to define is what you are allowed to alter" are also acceptable.

Seradir
  • 21
  • 1
  • 2
    I suppose you can hack something with \everyeof, but note that some LaTeX editor requires a document to contain \begin{document}...\end{document} for it to be recognized as the main document. Might be a better idea to redefine the document environment to check if its body has a fixed format. – user202729 Feb 14 '24 at 20:12
  • Maybe \input{readonly-document-template.tex} at the end of your current snippet would work, or vice versa remove the documentclass in the snippet and within the readonly document add \input{donorinfo.tex}, depending on what the workflow is exactly. You can customize it by providing the argument for \input as a command line argument (of sorts), similar to https://tex.stackexchange.com/questions/1492/passing-parameters-to-a-document. – Marijn Feb 16 '24 at 10:19
  • Are you trying to build dynamic documents from a text database or so? Maybe is better to explain the issue showing a small set of raw dummy data and some example/s of the desired final goal. – Fran Feb 19 '24 at 12:32

0 Answers0