Outils pour utilisateurs

Outils du site


issue103:tutoriel_3

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.

Pour cet article de la rubrique LaTeX, je vais vous parler un peu de BibTex, qui peut vous aider. Pour faciliter l'animation de ce sujet aride, je réaliserai un très court article en intégrant des informations sur le grand album des Beatles : « Sgt. Pepper », que vous ne connaissez probablement pas ! Mais d'abord… vous avez besoin de connaître un logiciel de bibliographie nommé Zotero.

Zotero est un module additionnel de Firefox. Pour bien le décrire, je reprendrai ici un extrait du site Internet de Zotero :

« Zotero est le seul outil de recherche qui détecte automatiquement le contenu de votre navigateur Internet, pour vous permettre de l'ajouter d'un seul clic à votre bibliothèque personnelle. Que vous cherchiez une pré-impression sur arXiv.org, un article de revue dans JSTOR, un reportage dans le New York Times ou un livre dans le catalogue de la bibliothèque de votre université, Zotero vous donne accès à des milliers de sites. »

Et, comme pour LaTeX, il y a des milliers de vidéos YouTube sur la prise en main de Zotero. Il y a aussi d'excellentes vidéos sur la manière de créer des citations et des 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.

Que vous apporte Zotero ? Supposez que vous fassiez une recherche pour une dissertation de fin de semestre. Vous recherchez en ligne des articles de revues. Quand vous en trouvez un qui est en lien avec votre travail, vous pouvez cliquer sur une petite icône de votre navigateur pour que toute l'information bibliographique dont vous avez besoin soit téléchargée dans votre propre base de données. Vous conservez aussi l'URL de l'article et une copie de cet article est enregistrée dans votre ordinateur. Zotero peut télécharger les données bibliographiques de n'importe quel livre que vous trouvez dans un catalogue de bibliothèque. Presque tout ce que vous trouvez sur l'Internet peut être catalogué par Zotero, par un simple clic de souris.

La magie vient de ces petites icônes qui travaillent pour vous :

« Z » ouvre la base de données de Zotero ; l'icône bleu d'un livre télécharge l'information bibliographique - à noter que diverses icônes apparaissent suivant les différents types de medias.

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”.

Bon ! Où est le rapport avec LaTeX ? Et BibTeX ?

Zotero exportera vos données sous de nombreuses formes, l'une d'entre elles étant le format BibTex qui ressemble à ceci :

@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}, }

Beaucoup d'éditeurs LaTeX créeront le modèle approprié pour l'élément que vous souhaitez enregistrer. C'est très simple à utiliser ; à l'intérieur des { } vous tapez juste l'information voulue. Le champ le plus important est celui de la première ligne. « ID » doit être un identifiant unique ou « clé ». Ainsi, pour un livre que j'aurais écrit, la clé pourrait être « 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.

La frappe de toutes ces informations serait fastidieuse, mais, au moins, de cette façon, vous ne devriez les saisir qu'une fois. Cependant, Zotero peut faire tout ça à votre place ; ici (page précédente, en bas à droite), vous voyez une citation que j'ai récupérée du catalogue de ma bibliothèque locale par un clic de souris sur l'icône bleue dans mon navigateur.

Toute cette saisie a été faite à votre place, grâce à un clic de souris, pendant que vous cherchiez dans le catalogue de la bibliothèque en ligne. Pour exporter l'enregistrement, surlignez-le (c'est possible pour plusieurs enregistrements en appuyant sur la touche Ctrl pendant que vous cliquez sur les autres enregistrements nécessaires à la bibliographie).

Faites un clic droit et choisissez Exporter les éléments (Export Items), recherchez BibTeX dans la fenêtre suivante, puis cliquez sur OK.

Parfois, vous pouvez vouloir ajuster les enregistrements. Si je change :

martin_little _1994

en

gmartin94.

@book{gmartin94,

  address = {Boston},
  edition = {1st U.S. ed},
  

Malheureusement, nous ne pouvons modifier la clé que dans le fichier BibTeX, pas dans le fichier Zotero. Donc, si vous voulez ajouter un enregistrement à un fichier BibTeX qui a déjà été modifié, vous devrez exporter cet enregistrement dans un autre fichier puis copier/coller ces mêmes données dans le fichier BibTeX principal.

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.

Parfois, nous devons entrer manuellement des enregistrements ; je trouve que pour l'enregistrement d'un site Web, Zotero fait du bon boulot, mais la sortie BibTeX crée des { } en excès qui doivent être éliminés. Juste un avertissement.

Voici un enregistrement que j'ai créé, pour conserver une conversation que j'ai eue avec un pionnier du rock en FM, David Marsden de la station de radio Internet https://www.nythespirit.com :

@misc{_interview_????,

title = {Interview : {David} {Marsden}}, [Titre]

url = {https://www.nythespirit.com/},

publisher = {unpublished}, [Éditeur : non-publié]

annote = {Quand j'ai entendu Sargent Pepper, j'ai su que la musique rock devait passer sur la bande FM parce que les ondes moyennes ne pouvaient retransmettre le son qu'obtenaient les musiciens de rock. À cet instant, la bande FM était le terrain sacré de la musique classique. Ce fut un rude combat et il a fallu un an pour y arriver.}

}

Le champ annote est un bon endroit pour entrer du texte que vous voulez citer dans votre article.

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.

Et comment faisons-nous fonctionner tout ça ?

Le fichier de bibliographie doit se terminer par les lettres bib (Zotero le fait pour vous) et doit aussi être dans le même répertoire que le fichier dans lequel se trouve votre document. (La création d'un répertoire pour votre document LaTeX est la première règle de LaTeX.)

Le fichier bibliographique dans ce projet s'appelle Pepper.bib.

Dans le préambule, ajoutez la ligne :

\bibliographystyle{plain}

À la fin du document, juste avant /end{document}, ajoutez cette ligne :

\bibliography{le nom de votre fichier.bib}

ou dans ce cas :

\bibliography{Pepper.bib}.

Le nom de ce fichier est sensible à la casse ; assurez-vous de taper le nom avec précision.

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.

Il y a un grand choix de styles bibliographiques, mais j'utiliserai simplement le texte brut dans mon papier ultra court. Voici quelques sites qui couvrent le style bibliographique plus en détail, avec des exemples : http://www.cs.stir.ac.uk/~kjt/software/latex/showbst.html http://www.reed.edu/cis/help/LaTeX/bibtexstyles.html#seven

Beaucoup d'écoles et d'universités ont des informations sur les styles bibliographiques, et aussi des modèles de thèse, sur leur site Internet ; demandez à l'institution dont vous dépendez.

Si vous voulez citer une source dans votre article, tapez \cite et votre éditeur LaTeX devrait vous lister les citations à insérer présentes dans votre fichier BibTeX :

La bibliographie est créée quand vous compilez votre document et l'ensemble ressemblera à ceci :

Parfois, vous devrez recompiler votre document pour que la bibliothèque soit compilée, ce qui peut être 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.

Cet article n'a qu'effleuré la surface du composant bibliographique de LaTeX. Il y a d'autres façons de procéder et aussi beaucoup d'autres options dans le sac à astuces de BibTeX. Un nouveau format appelé BibLaTeX existe, dans lequel Zotero sait aussi exporter. Cependant, je dois dire que - merci à la fonction d'export en BibTeX présente dans Zotero et à Zotero qui extrait si facilement les informations des bases de données - je suis pour la méthode du fichier BibTeX qui crée un fichier .bib de vos références, qui réside dans le répertoire du fichier que vous créez.

J'aurai aimé avoir LaTeX et BibTeX quand j'écrivais mes articles à l'université, quand la FM stéréo était la haute technologie de l'époque. Aujourd'hui, avec un peu d'aide de vos amis (tout ceux qui créent du Logiciel libre), c'est beaucoup plus facile d'écrire un article universitaire. Je suis vert d'envie.

Une publicité éhontée suit. Si vous avez envie d'écouter ce qu'étaient les radios FM de rock dans leurs premières années, quand le DJ pouvait pratiquer la radio FM de forme libre (c'était avant que les hommes d'affaires ne découvrent qu'on pouvait en tirer des revenus publicitaires), je vous encourage à explorer la propre émission de David Marsden, les samedi et dimanche soir, à 20 h, heure de la côte est des USA, sur le site : https://www.nythespirit.com/. Un mois d'essai gratuit vous est offert avec le code BEMX.

Au point où nous en sommes, je suppose que le suspense est intolérable et que vous voulez vraiment connaître l'identité du véritable Sgt. Pepper. Il était l'un des policiers de l'équipe de sécurité des Beatles quand ils ont visité Toronto. Ce bout d'information est à la dernière page du livre de Sir George Martin qui est plein d'anecdotes. C'est un plaisir de le lire ; je l'ai bien apprécié. Jusqu'à la prochaine fois, amusez-vous avec LaTeX.

issue103/tutoriel_3.txt · Dernière modification : 2015/12/12 16:39 de andre_domenech