GeneralAutomated documentation? Editing with tags.

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

Automated documentation? Editing with tags.

Post by matrixuser »

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.
Or some addon?


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

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

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

Automated documentation? Editing with tags.

Post by Ijon Tichy »

In LaTeX using macros is a basic feature, e.g.,

Code: Select all

\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:

Code: Select all

% 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. :cry:
matrixuser
Posts: 2
Joined: Tue Aug 03, 2021 2:51 am

Automated documentation? Editing with tags.

Post by matrixuser »

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