Editing CommunityData:Build papers

From CommunityData

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
When creating LaTeX documents, the final PDF output must be built from an input file. For many of our projects, this process is even more complicated and we use [https://en.wikipedia.org/wiki/Makefile Makefiles] to manage more complex workflows. This document is intended to give an overview of the basic process and to identify good practices for quantitative projects.
When creating LaTeX documents, the final PDF output must be built from an input file. For many of our projects, this process is even more complicated and we use [https://en.wikipedia.org/wiki/Makefile Makefiles] to manage more complex workflows. This document is intended to give an overview of the basic process and to identify good practices for quantitative projects.
This sketch illustrates an overall setup: [[File:Magic_or_Mostly_Magic_Updates.png|Magic or Mostly Magic Updates|800px]]
(a [https://wiki.communitydata.science/upload/6/63/Magic_or_Mostly_Magic_Updates.pdf PDF version] if you prefer) to see how these pieces can fit together.


== Project Creation ==
== Project Creation ==
Line 15: Line 11:


This project will include a Makefile and all of the pieces needed to create a document.
This project will include a Makefile and all of the pieces needed to create a document.
== Knitr ==
[[CommunityData:Knitr|Knitr has its own page, here]].


== Zotero ==
== Zotero ==
Line 27: Line 19:


# The first time you're building the paper, you can just run <code>make</code> or <code>make all</code>. After that, you probably want to run <code>make clean; make all</code>. This should work whether you're using an .Rtex (knitr) or .tex (LaTeX) file.
# The first time you're building the paper, you can just run <code>make</code> or <code>make all</code>. After that, you probably want to run <code>make clean; make all</code>. This should work whether you're using an .Rtex (knitr) or .tex (LaTeX) file.
If you need to output a Word document (e.g., for a journal submission), see the [[CommunityData:LaTeX to Word|LaTeX to Word]] page.


== Git ==
== Git ==
Line 35: Line 25:




== Overleaf ==
== Overleaf adaptation ==
 
If you're using Overleaf for your papers, that's great. Many of us use Overleaf at some point in our writing process. This section describes a reasonable workflow for putting papers on Overleaf.
 
=== Dropbox Sync ===
 
Overleaf is actually really good at allowing for a combination online/offline workflow, and keeping documents in sync. Most of us have this set up through Dropbox sync. In your Overleaf account settings you can set this up. Once you do that, all of your Overleaf projects will appear in <code>~/Dropbox/Apps/Overleaf/</code>.
 
If you don't want to fiddle with account settings on Overleaf, you can also simply:
 
* Get [https://retorque.re/zotero-better-bibtex/ Better Bibtex] on your Desktop Zotero app.
* Export your collection/library to "auto" update from Zotero (See [https://wiki.communitydata.science/CommunityData:Build_papers#The_bibliography_file this] below) to an auto-syncing Dropbox folder. You will probably need to have the DropBox Desktop app.
** To avoid exporting fields in Zotero that you don't want, like ISBN of a conference paper, go to Edit > Preference > Export > Fields, and type the fields you don't want in the appropriate box. Do this *before* you export your auto-updating collection/library.
* Follow the instructions here to link the .bib file that is auto-exported by Better Bibtex and synced to Dropbox to your Overleaf, but note the changes for Google Drive: https://www.overleaf.com/learn/how-to/How_can_I_upload_files_from_Google_Drive%3F
* For DropBox-synced files:
** On Overleaf, upload a new file by selecting "From external URL". Copy and paste the URL from the link to the file that DropBox gives you for the file you saved your collection/library as. It will look like <code>https://www.dropbox.com/s/[NUMBERS_AND_LETTERS]/[FILENAME].bib?dl=0</code>.
** Replace <code>dl=0</code> with <code>raw=1</code>
** Enter the "File Name In This Project" for the Overleaf project (e.g. refs.bib). This is what you'll refer to your bib file as in the TeX, and hit Create.
* When there are changes made on Zotero, note that you need to "refresh" the file on Overleaf to get the updated/synced file.
 
=== Creating a Project ===
 
Overleaf supports the entire pipeline that we typically use when building TeX papers from a local computer, including knitr and Makefiles. Therefore, the best way to put a complicated project onto Overleaf is to create it on your computer first. You can do this by going to the <code>Overleaf</code> directory in Dropbox and using the <code>new_knitr_document</code> command. This will both give you a new document with all of the needed resources and will create a new project on Overleaf
 
=== Data and Code ===
 
You should not put your entire project on Overleaf. If you follow the suggested directory structure below, then Overleaf should just contain the <code>paper/</code> directory. The code and data should live somewhere else, typically.
 
The one problem with this is that you likely want the whole project, including the paper, in the same place, and updated in a git repository. One approach to this is to include an option in the Makefile which will copy the Dropbox version into the canonical directory.
 
 
=== The bibliography file ===
 
The Best Practice is still to use Zotero to manage your bibliography. If you have installed Better Bibtex (and if you haven't, then you should!), then you can export your bibliography and keep it updated. You right-click on the collection you want to export, choose the format (likely Better BibTex), and select "keep updated"
 
[[File:better_bibtex_export.png|Example of exporting from Zotero]]


You should export it into the <code>refs.bib</code> file in your Dropbox Overleaf project, and then Better Bibtex and Dropbox will keep it updated on Overleaf for you.
If you're using Overleaf for your papers, that's great. The Best Practice is still to update the bibliography in Zotero, then export from there. Ideally, export into <code>refs.bib</code> and then upload that to Overleaf so that the paper directory in our shared git repositories are up-to-date!


== Style notes and more details (add as needed) ==
== Style notes and more details (add as needed) ==
Please note that all contributions to CommunityData are considered to be released under the Attribution-Share Alike 3.0 Unported (see CommunityData:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel Editing help (opens in new window)