I am not sure if you mean LyX macros or not. But if they are standard LaTeX macros, you can make your own style file, say "rachum.sty". Put all of your macros in there, and then have it included in the preamble by default.
This is useful for (La)TeX users in general. I have a lot of common things in my own file, such as \newcommand{\Integers}{\mathbb{Z}}
and such.
This is what I will do. Hence it is only relative.
I will have a folder for my project (say thesis): D:\my-thesis
where everything related to my thesis will be stored. Further, I will have subfolders like D:\my-thesis\images
, D:\my-thesis\presentations
, D:\my-thesis\thesis
, D:\my-thesis\codes
, ......... etc. Now as we are concentrating on images, I will not worry about how other folders will be but each of these folders will have sub folders depending upon the need.
Let us assume that my thesis will have six different topics (chapters). I will create six folders inside images
folder and name them: topic-1
, topic-2
,... etc. topic-1
folder will have two subfolders: pdf
and source
. The folder pdf
will have all pdf files of my images (I prefer pdf over png) and the source
folder will have tikz
sources of my images (as almost every diagram I use, will be written using tikz). If I have to use some other kind of file (say .jpg), I will have another folder inside topic-1
and call it jpg
. Same is true for topic-2
,... etc.
With this folder structure, it is easy to re-use the code for inserting the pictures. I will use \includegraphics[...]{D:/my-thesis/images/topic-1/pdf/de}
where de
is the picture. Hence the snippet can be used in all places like presentation or thesis.
A MWE will be
\documentclass{article}
\usepackage{graphicx,epstopdf}
\begin{document}
\includegraphics[width=\textwidth]{D:/Harish/TeX/paper-1/figures/eps/figure-5}
\end{document}
Best Answer
The simplest way would be to just place your common macro definitions into a separate
.tex
file an\input
1 this in the preamble of all documents.You can also just make your own package. The only differences (if you don't want to use package options with it) are to name it
somename.sty
and to add\ProvidesPackage{somename}
as first macro. Then load it using\usepackage{somename}
instead of\input.
Note that you can place you common file into your own TEXMF tree where it is then found by LaTeX, so that the file does not need to be in the same directory any more.
1) no, do not use
\include
for this