General ⇒ Multiple instructions where only some data differs
Multiple instructions where only some data differs
I'm completely new on LaTeX and picked it up to try to solve a task.
I'm about to write multiple instructions for some articles. The instructions will almost be identical with only some numbers, names and sentences that differs between them.
I've tried to read about LaTeX to find out if it can solve that problem. It looks like it if you look at how it handles bibliographies but I haven't found any good examples how to do it.
I would imagine it would be is something like this:
This is a text about {file.brand} and it is {file.length} long.
And then there is another file where I declare all the variables like it does in the bib file.
I don't know if I make any sense, but if any of you could point me in the right direction it would be awesome.
Thanks a lot
Macki
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- Ijon Tichy
- Posts: 640
- Joined: Mon Dec 24, 2018 10:12 am
Multiple instructions where only some data differs
Code: Select all
% Note: The file test-template.tex can be a stand alone file.% I generate it here from the data file via filecontents% only to make it work in the online compiler.\begin{filecontents}[force]{test-template.tex}\documentclass{article}\usepackage{hyperref}\begin{document}\NAME{} is a \GENDER{}, who sometimes can be found on \PLACE{}.\end{document}\end{filecontents}\newcommand*{\NAME}{Ijon Tichy}\newcommand*{\GENDER}{man}\newcommand*{\PLACE}{\url{https://LaTeX.org}}\input{test-template.tex}\endinput
Code: Select all
% Note: This example will not work in the online compiler,% because it needs test-template.tex from the% previous example.\newcommand*{\NAME}{Stefan}\newcommand*{\GENDER}{man}\newcommand*{\PLACE}{several \LaTeX{} sites}\input{test-template.tex}
\newcommand
, \input and all the other commands and environments used in the example.
Multiple instructions where only some data differs
Thank you so much for the answer.