Hello, how are you? :)
In this post I talk about
- The
\include
command
Introduction
The last posts of this blog have been aboutMacros we have checked some variants of macros and we have seen that these are declared in the preamble of our document, so, if we want to declare a new macros we must go to the preamble, declare them there and then go back to our document, everything is fine.
But what happens if we need to declare the same macros in another document, and in another and so on, it will be a headache because we need to declare them in each document that we create. There must be an easy way to do it, and this is the main topic, or purpose, of this post is to teach you a very useful instruction, the\include
command
Theinclude
command
Here we are going to use this command to include the macros and other environments that we will see in the following posts, but this command has another functionalities, which are not related with this topic
- This command is declared in the preamble
As its name suggest itincludes the content of other.tex
(The extension of theLaTeX
document) document into our current document, the command is simple
\include{pathOfFile/nameOfFile}
Including a file withinclude
Do not forget to add the extension of the file, in this case, it is
.tex
If you do not add it you will get an error
We have seen that the command to include a file is\include{}
but we need to give thepathOfFile
it is thelocation of our file that we want to import to our current file, and there are three possibilities
- File in the same location where we are working We just need to put the name of the file
\include{myFile.tex}
- File in the same location but inside another folder We need to put the route to the file, indicating the name of the folder in the path.
Let's suppose my folder's name ismyFolder
\include{myFolder/myFile.tex}
If it is inside multiple folders we just put the name of all the folders where it is and then the name of the file
\include{myFolder/.../myFile.tex}
Where the...
is the short for all the folders, but youmust put the name of all the folders
- File in a different location Here we need to put the specific route where the file is. In the last point we see that to godeeper we need to put the name of the folders, now to gobackward we need to use
..
\include{../myFolder/myFile.tex}
This is all for today, thanks
Do not forget to follow me on twitter@latexteada
Greetings :)
Top comments(0)
For further actions, you may consider blocking this person and/orreporting abuse