Outils pour utilisateurs

Outils du site


issue103:tutoriel_3

Ceci est une ancienne révision du document !


For this edition of the LaTeX segment, I will tell you a little bit about BibTeX and how it can help you. To help liven up a dry subject, I’ll compose an ultra-short paper, and I’ll include information about that great album by the Beatles: “Sgt. Pepper” – that you probably did not know about! But first… you need to know about a bibliographic software called Zotero. Zotero is a plug-in for Firefox. To describe it well, I will post a quote here from the Zotero website: “Zotero is the only research tool that automatically senses content in your web browser, allowing you to add it to your personal library with a single click. Whether you're searching for a pre-print on arXiv.org, a journal article from JSTOR, a news story from the New York Times, or a book from your university library catalog, Zotero has you covered with support for thousands of sites.” And, just like LaTeX, there are thousands of YouTube videos on how to use Zotero. There are also very good videos on how to create citations and bibliographies.

What does Zotero do for you? Suppose you are conducting research for a term paper. You are searching online for journal articles. When you find one that is on point for your paper, you can click a tiny icon on your browser and all of the bibliographic information that you need is downloaded to your own database. You also have the URL for the article, and a copy of the article is downloaded to your computer. Zotero can download bibliographic data for any book you find in a library catalogue. Almost anything that you find on the Internet can be catalogued by Zotero, all with a click of a mouse. It is these little icons that do all the magic for you: Z opens the Zotero database; the blue book icon downloads the bibliographic information – note that different icons appear for various types of media.

So where is the connection to LaTeX? And BibTeX? Zotero will export your data in many forms, one of them is the BibTeX format and it looks like this: @Book{ID, ALTauthor = {author}, ALTeditor = {editor}, title = {title}, publisher = {publisher}, year = {year}, OPTkey = {key}, OPTvolume = {volume}, OPTnumber = {number}, OPTseries = {series}, OPTaddress = {address}, OPTedition = {edition}, OPTmonth = {month}, OPTnote = {note}, OPTannote = {annote}, } Many LaTeX editors will create the appropriate template for the item you wish to record. Quite simple to use, inside the { } we just type in the information required. The most important field is the field on the first line. “ID” must be a unique identifier or “key”. So, for a book I would have written, the key could be “jek2015”.

It would be tedious to type in all of that information, but at least this way you have to type it only once. But Zotero can do all of that for you, here (previous page, bottom right) is a citation that I harvested from the catalogue at my local library with a click on the blue icon in my browser. All that typing was done for you with a click of a mouse way back when you were searching the library online catalogue. To export the record, highlight the record (multiple records can be done by holding down the ctrl-key while you click on other records required for the bibliography). Right click and choose Export Items, scroll in the next window to BibTeX, then click OK. Sometimes we may want to tweak the records. I would change: martin_little _1994 to gmartin94. @book{gmartin94, address = {Boston}, edition = {1st U.S. ed}, Unfortunately, we can edit the record key only in the BibTeX file, not the Zotero file. So if you have a BibTeX file that you have modified, and then you want to add another record, you will have to export that record to its own file and then copy and paste the data into the main BibTeX file.

Now, sometimes we have to manually enter records, I find that for recording websites, Zotero does a great job but the BibTeX output can enter many excess '{ }' that have to be edited out. Just a warning. Here is a record that I created, to record a conversation I had with one of the pioneers of FM rock, David Marsden of the Internet radio station https://www.nythespirit.com: @misc{_interview_????, title = {Interview : {David} {Marsden}}, url = {https://www.nythespirit.com/}, publisher = {unpublished}, annote = {When I heard Sargent Pepper I knew that rock music had to move to the FM band because AM just could not deliver the sound that the rock musicians were making. At that time, the FM band was the sacred ground of classical music. It was a tough fight and it took a year for it to happen.} } The annote field is a good place to enter any text that you want to quote in your paper.

So how do we get this all to work? The bibliography file must end with the letters bib (Zotero does that for you), and must also be in the same directory as the file that your document is in. (Creating a directory for your LaTeX document is the first rule of LaTeX). The bibliographic file in this project is called Pepper.bib. In the preamble add this line: \bibliographystyle{plain} To your document at the end, just before /end{document}, add this line: \bibliography{the name of your file.bib} or in this case: \bibliography{Pepper.bib}. The name of the file is case sensitive so make sure that you type the name of the file exactly.

There are many bibliography styles to choose from but I will just use the plain style in my ultra-short paper. Here are some sites that cover the bibliography style in more detail, with examples: http://www.cs.stir.ac.uk/~kjt/software/latex/showbst.html http://www.reed.edu/cis/help/LaTeX/bibtexstyles.html#seven Many colleges and universities have information regarding bibliographic styles, and also LaTeX templates for a thesis, on their websites; enquire at the institution you are attending. Whenever you want to cite a source in your paper, type \cite and your LaTeX editor should list the citations in your BibTeX file for you to insert: The bibliography is created when you compile your document and it all will look something like this: Sometimes you may have to compile your document more than once to get the bibliography to compile, that can be normal.

This article has just scraped the surface of the bibliography component of LaTeX. There are other ways of approaching this, and there are many other options in the BibTex bag of tricks. There is a new format called BibLateX, and Zotero will export bibliographies in this format as well. However I must say that – thanks to the BibTex export feature that we have in Zotero, and that Zotero makes data harvesting from databases so easy – I am in favour of the BibTex file method which is creating a .bib file of your references that resides in the directory of the document you are creating. I wish I had LaTeX and BibTeX way back in the days when I was writing my papers at University, back in the days when FM stereo was about as high tech as it got. Today, with a little help from your friends (all those people who have created the free software), writing a class paper is so much easier. I am green with envy. A shameless plug is in order. If you would like to hear what FM Rock radio was like in the early years when the DJ's could practise Free Form FM radio (that was before the suits discovered there was more advertising revenue to extract), I encourage you to explore David Marsden's own show on Saturday and Sunday nights 8:00 pm Eastern time at this site: https://www.nythespirit.com/. Code “BEMX” will give you a one-month free trial. By now I suppose the suspense is killing you, and you have to know the identity of the real Sgt. Pepper. He was a policeman who was on the security team when the Beatles visited Toronto. That morsel of information is on the last page of Sir George Martin's book which is full of interesting tidbits. It is a must read, I enjoyed it. Until next time, enjoy LaTeX.

issue103/tutoriel_3.1449735118.txt.gz · Dernière modification : 2015/12/10 09:11 de d52fr