General ⇒ Include items from file
Include items from file
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.
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
Include items from file
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.}
Code: Select all
\documentclass{article}
\usepackage{MyLaws}
\begin{document}
\Lawid
\Lawiicvi
\end{document}