Using LaTeX, Mendeley, and Bibtex in Windows

Most publications such as a Thesis, Dissertation, conference paper, Journal article, etc. have specific required formatting. We’ve all hit the point where we simply can’t get our word processor to format things the way we want, and we can’t figure out why. The way these apps work is to code in manipulations to raw text. It is kind of like HTML code in Micro$oft Word and LibreOffice formats. In fact if you have a .docx or .odt file, you an open them in an unzipping tool such as 7zip and see all the nitty gritty, including saved images, etc.

LaTeX is basically programming what a document should look like directly. You have to write code to tell the document where to create a subsection, bulleted list, insert images, even to italicize or bold something, but it (usually) gives you much more direct control over formatting.  All through college, I wrote only a few documents in LaTeX because honestly, it was a pain. It is not WYSIWYG editing at all. After you make changes to the code of your document, you have to compile it into a PDF document before you can see what the end result will look like. I avoided using it because I hadn’t found an editor I liked.  Now I have found a workable setup and I’ve solved a few problems for myself that I think might be helpful for others (as well as my future self).

Firstly, you must install an editor, as well as the compiler tools. There are many editors out there and two compilers.

Editor:

I tested several editors (namely Texmaker, TexWorks) but I settled on using TeXstudio.  Texmaker looks nice, but I had trouble getting it to display a recompiled version of my PDF. Texworks has a much more “Linuxy” feel, as it uses two separate windows to display the code and the resulting PDF.  Again, the winner for me was TeXstudio.

Compiler:

There are two LaTeX compiler setups. TexLive and Miktex. I had used Miktex in the past so I tested out TexLive with this installation.

Setup:

Open TeXstudio, then select “Options–>Configure TeXstudio”  then select the “commands” tab.  Here, we must tell TeXstudio where all the compiler programs live. The main thins to fill out are “LaTeX”, “PdfLaTeX”, “External PDF Viewer”, “BibTex”, and “Biber”.  Don’t worry about the other text in the file paths in my screenshot here, That’s automatically entered by TeXstudio when you select the path. Simply click on the file icon on the right hand side for each of these entries and drive to the compiler installation. Here you see that my texlive installation is directly on my C drive. Miktex can be installed the same way. Then wind your way through the fines until you find the “binaries” (which are the actual executable programs) in the “bin” folder.

texstudio

 

Templates:

Now you can start editing and compiling your paper. You can start from scratch, or if the conference or journal you are submitting your paper to has a template you can download, start there.  In my case, IEEE has templates available for download here. Now I recommend you go through a few tutorials  and play with some files like these before using a full-on journal template just to get your bearings with LaTeX. There are commented things in the template that you can add in (uncomment) and multiple ways of doing things you might want to do, so research is king.  Once you’ve written some of the paper and formatting code, compile it by clicking the “compile and View” button in TeXstudio.compile and display  You might need to compile the bibliography separately. For finer grain compiling options, click the “Tools”menu.

References:

You already know I love Mendeley, but you can actually get Mendeley to export a .bib file.  A .bib file is a list of all your references in a format called BibTex, which you can open in any text editor, even in TeXstudio.  The .bib file Mendeley exports is only as good as the data you entered in Mendeley, so make sure it is correct first! You can enter these reference entries directly into your .tex file (the code  you are writing describing your paper) or keep the references in the .bib file and import that file into your paper.   What is great is that you cite something using /cite{nameOfBibtexEntry} and LaTeX and BibTex do all the rest for you. It will enter the citation in the correct format, then it’ll generate your references section of your paper.  The format,  like MLA, APA, etc, is different for each conference, journal, and even discipline in which you are submitting. You can tell your document which format to use using some simple commands, however the template you download likely already sets you up for the correct format.  To get the name you must use in your /cite{} command, open the .bib file and find the entry you want to cite. The first name next to the @article{ tag is the name to use. for example:

In my bibtex file I have the following entry:

@inproceedings{Rao2003,
address = {New York, New York, USA},
author = {Rao, Ananth and Papadimitriou, Christos and Shenker, Scott and Stoica, Ion},
booktitle = {Proceedings of the 9th annual international conference on Mobile computing and networking – MobiCom ’03},
doi = {10.1145/938985.938996},
isbn = {1581137532},
keywords = {Vehicle,Wireless,ad-hoc,coordinate-based,detection,geographoc,routing,sensornets},
mendeley-tags = {Vehicle,Wireless,detection},
month = {sep},
pages = {96},
publisher = {ACM Press},
title = {{Geographic routing without location information}},
url = {http://dl.acm.org/citation.cfm?id=938985.938996},
year = {2003}
}

In my LaTex file, I might have the following line:

Ad hoc wireless sensor networks can be used to track vehicle locations as shown in /cite{Rao2003}.

Once I “compile and view” this document, it will generate a PDF with references automatically generated and in all it’s two-column perfectly formatted glory…. if all goes right.

Leave a Comment