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
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- 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.