GeneralInclude items from file

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
jpadron

Include items from file

Post by jpadron »

Hello,

I am writing a document about laws and I wanted to have a file to keep all singular laws together in any way, such as:

Law-1-500{
Murder is forbidden.
}

So I could quote it later in any place in the document by writing a quotecommand that could work like:

\includeLaw{Law-1-500}

So I get:

Murder is forbidden.

That way I could change the law in just one file and have it updated through all the document. I've searched the forum and the internet but I can't find a way to do it. I think I can manage to define the new command, but I can't imagine how to retrieve the law item from a file.

Thank you.

Recommended reading 2024:

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

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

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Include items from file

Post by gmedina »

Hi,

you could create a .sty file and then store all the laws using commands; then you can load the file as usual in the preamble of your document and invoke the corresponding commands. A little schematic example:

the file MyLaws.sty:

Code: Select all

\newcommand\Lawid{Murder is forbidden.}

\newcommand\Lawiicvi{Theft is forbidden.}
the .tex document:

Code: Select all

\documentclass{article}
\usepackage{MyLaws}

\begin{document}

\Lawid

\Lawiicvi

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply