## LaTeX forum ⇒ General ⇒ Automated documentation? Editing with tags.

LaTeX specific issues not fitting into one of the other forums of this category.
matrixuser
Posts: 2
Joined: Tue Aug 03, 2021 2:51 am

### Automated documentation? Editing with tags.

I once tried software whre you create template with tags like
<seller> <price> <date>

and assign
seller = John Smith
price = 90000 \$
date = current date

And generate text where tags are replaced with assigned values.

Is there a way to do something similar in Latex?
For example document type where you create tags at begining.

Is there a way to insert value from a file? So I can edit current date only once for all other documents.

LaTeXguide.org • LaTeX-Cookbook.net

Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

### Automated documentation? Editing with tags.

In LaTeX using macros is a basic feature, e.g.,
\documentclass{article}
\newcommand*{\TheNameOfTheGame}{Macro}
\begin{document}
The name of the game is: \TheNameOfTheGame.
\end{document}


And you can either write the \newcommand to a file foo.tex and load is using \input{foo.tex} or (and this is what I would do) do the opposite:
% Note: The filecontents environment is only used to make this example
% working in the only editor. Usually you will edit the template file as a
% standalone file.
\begin{filecontents}{example-template.tex}
\documentclass{article}
\providecommand*{\TheNameOfTheGame}{MISSING DEFINITION}
\begin{document}
The name of the game is: \TheNameOfTheGame.
\end{document}
\end{filecontents}
\newcommand*{\TheNameOfTheGame}{Macro}
\input{example-template.tex}


See a introduction to LaTeX for more information about \newcommand, \providecommand and \input.

As an alternative see packages like csvsimple or datatool that allow to use, e.g, CSV for a kind of serial documents.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms.

matrixuser
Posts: 2
Joined: Tue Aug 03, 2021 2:51 am

### Automated documentation? Editing with tags.

Thanks.
Commercial programs are expensive and I need only basic features.

Ulric Wood
Posts: 2
Joined: Wed Apr 13, 2022 9:24 pm

Great, thanks!