Feeds:
Posts

## Organization of LaTeX documents

When I started to write documents in $\LaTeX$, I found myself diving into .tex, .out, .aux, .pdf, .jpg files and so on. Thus I developed a system for organizing the files.

(If you are starting with $\LaTeX$ might find useful my previous post here)

## The Basic

First, I create a LaTeX folder in my personal Documents directory,

$mkdir ~/Documents/LaTeX where all my $\LaTeX$ related files have to be moved. Since I used to write a lot of reports, articles and letters, the next step is to write a template for each of them (Of course, you could use pre-defined templates, from your LaTeX editor, borrowed from a friend or downloaded from internet). As an example, I’ve defined • base-art.tex • base-rep.tex • base-PRD.tex: for articles to be send to Physical Review journal. • base-book.tex • base-beamer.tex • base-lett.tex ### More Folders Now, more folder should be created to keep files ordered. $ cd LaTeX
$mkdir Docs Pics Finished Here I’m describing just three, Docs contains the .tex files other than the base-*.tex, Pics contains all figures, and Finished is a place where you can move the PDF files when they are finished. NOTE: Clearly, you could create folders inside Docs and Pics… say, one for Geography-hw and other for Zen-Martial-arts, and so on. ### The base-*.tex File This is the file which contains the structure of the document, that is: • the class • the preamble packages, definitions and so on… • the begin and end document. but not the body content… except for the maketitle, tableofcontents, and similars. So, Where is the content? The content is written is separated tex files saved in the Docs folder. None of this files have class definitions or, package calls, or begin and end document… they have the written part, example: %%% UFO saved as UFO.tex %%% in the ~/Documents/LaTeX/Docs folder \chapter*{Introduction} In the last years, UFO activity has been increased due to the lack of faith in the world. Do you believe? \chapter{What is UFO?} UFO stands for Unidentified Flying Object \section{UFO activity} blah blah blah and this should be included into the base-rep.tex file, with the input command, \documentclass{report} \begin{document} \input{Docs/UFO.tex} \end{document} NOTE: When you want to insert a file, which is not in the same folder than the base-*.tex one, the directory to that file must be given. #### And the figures? Now, figures are part of the body, thus they are included in the UFO.tex file, suppose we want to add the figure1.jpg, then our UFO.tex should contain a line like, \includegraphics{Pics/figure1.jpg} NOTE: although UFO.tex is located in Docs folder, the figure file is referred as Pics/figure1.jpg because the compiler starts looking at the “mother” folder, a.k.a., LaTeX. ## Compiling the Thing Of course, for compiling you should type in the terminal, $ pdflatex base-rep.tex

however, the PDF document will have the same name as their parent tex file, i.e., base-rep.pdf

If you’d like to have a final PDF file with a different name, use instead,

$pdflatex -jobname UFO base-rep.tex to get a UFO.pdf file. Enjoy! DOX Advertisements Read Full Post » ## Increase TeX’s main memory I was looking the last version of the book “Algorithmic Graph Theory”, and one of the comments was about an error in the compilation… due to a lack of TeX memory. I’ve not heard of that problem before, so… just in case some of you is puzzled with this, here is the solution (thx. to mvngu) To increase TeX’s main memory, you need to locate the active texmf.cnf file for your TeX/LaTeX distribution. For example, on Ubuntu you can do so via the command $ kpsewhich texmf.cnf
Then open the file as root with the command

$sudo emacs /usr/share/texmf/web2c/texmf.cnf which will most likely prompt you for an administrator password. Enter the password and search for the line that begins with something such as main_memory = 3000000 % words of inimemory available; also applies to inimf&mp Change the value “3000000″ to “10000000″, i.e. change from 3 million to 10 million. Save your edit and quit your editor. Then issue the command $ sudo fmtutil-sys --all
and compile the book again.

Enjoy!

Dox