LaTeX forum ⇒ GeneralAutomated 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.

Postby matrixuser » Tue Aug 03, 2021 3:33 am

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

LaTeXguide.org • LaTeX-Cookbook.net
LaTeX Beginner's Guide LaTeX Cookbook
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Automated documentation? Editing with tags.

Postby Ijon Tichy » Tue Aug 03, 2021 11:32 am

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. :cry:

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

Automated documentation? Editing with tags.

Postby matrixuser » Tue Aug 03, 2021 3:22 pm

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

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

Automated documentation? Editing with tags.

Postby Ulric Wood » Sun May 08, 2022 7:11 pm

Great, thanks!


Return to “General”

Who is online

Users browsing this forum: No registered users and 7 guests