Skip to content

Instantly share code, notes, and snippets.

@mikonapoli
Created January 15, 2025 16:37
Show Gist options
  • Save mikonapoli/7c4fa8528357be994157c236b0a1dee0 to your computer and use it in GitHub Desktop.
Save mikonapoli/7c4fa8528357be994157c236b0a1dee0 to your computer and use it in GitHub Desktop.
An experiment in using Gemini to turn instructional videos into written form

NOTICE! I AM NOT THE AUTHOR OF THIS CONTENT! Go watch Jeremy's video

A Comprehensive Overleaf Tutorial for LaTeX Newcomers

Alright, let's get you started with writing your scientific papers using Overleaf and LaTeX! It might seem a bit daunting at first, especially when you see all that code, but trust me, it's much easier than it looks. By the end of this guide, you'll be navigating Overleaf like a pro.

Introduction to Overleaf and LaTeX

So, what exactly are we dealing with here? Well, LaTeX is basically a document preparation system. It's widely used for technical and scientific documentation because it handles complex formatting, like equations and citations, really well. Overleaf is an online platform that makes using LaTeX a breeze. Think of it as a user-friendly interface for writing LaTeX documents, with the added bonus of real-time collaboration.

Now, when you first look at LaTeX code, it's easy to get intimidated. It's full of backslashes and curly braces. But here's the secret: you can ignore most of it! Overleaf does all the heavy lifting behind the scenes, so you don't have to worry about the nitty-gritty details of formatting. You just type your content, and Overleaf takes care of the rest, automatically formatting your document to look professional. Plus, it handles things like citation styles and reference numbers automatically, which is a huge time-saver.

Getting Started with Overleaf

First things first, let's get you into Overleaf. If you don't have an account yet, head over to overleaf.com and create one. It's pretty straightforward. If you've received an email invitation to collaborate on a project, just click the link in the email, and you'll be taken directly to the document.

Once you're logged in, you'll see the Overleaf dashboard.

<screenshot ts="00:00:22" id="overleaf-home">Overleaf's landing page when logged in.</screenshot>

This is your home base, where you can see all your projects. If you followed a link from an email, you'll see a screen that looks something like this:

<screenshot ts="00:00:39" id="paper-view">How a paper looks in Overleaf.</screenshot>

Don't panic! On the left, you have the LaTeX code, which we'll mostly ignore for now. On the right is a preview of your beautifully formatted document.

Creating and Managing Your First Document

Alright, let's create your own paper from scratch. My advice? Start with a template. Go to your favorite search engine and type in "overleaf preprint template." The first result should be a gallery of Overleaf templates. Click on that.

<screenshot ts="00:00:54" id="template-gallery">The Overleaf template gallery offers a wide variety of templates for different types of documents.</screenshot>

Here, you'll find a bunch of different templates for various types of documents. Browse through and pick one that suits your needs. Once you've found a template you like, simply click on the "Open as Template" button.

Now you've got your own copy of the template to work with!

In Overleaf, you structure your document using sections and subsections. To create a new section, you use the command \section{}. Inside the curly braces, you put the title of your section. So, for example, if you want to create a section called "Introduction", you would write \section{Introduction}.

Typing and Editing Your Document

Let's start typing! Look for the part of the code that says \begin{document}. Just after that is where your content goes. You'll see \begin{abstract} and \end{abstract}. That's where you put your abstract. Just type between those two commands.

Now, you'll notice two views at the top: "Source" and "Rich Text."

<screenshot ts="00:02:50" id="source-rich-text-toggle">You can switch between 'Source' and 'Rich Text' view by clicking on the corresponding buttons in the top left corner of the editor.</screenshot>

"Source" view is where you see the raw LaTeX code. It might look a bit messy, but it gives you the most control.

"Rich Text" view is more like a regular word processor. It hides most of the code and shows you a more visual representation of your document.

<screenshot ts="00:02:54" id="rich-text-view">The "Rich Text" view has a more user-friendly interface.</screenshot>

Honestly, most people stick with "Source" view.

To see how your document is shaping up, click the green "Recompile" button. This tells Overleaf to process your code and generate an updated PDF preview.

<screenshot ts="00:02:04" id="recompile-abstract">The changes in the abstract are visible on the right side of the screen.</screenshot>

If you are using the "Rich Text" view, there are a few helpful formatting tools at the top of the editor:

  • You can make text bold or italic.
  • You can create numbered lists or bullet point lists.

To make a bullet list, just click where you want to insert it and then click on the "Insert Bullet Point List" button:

<screenshot ts="00:03:57" id="bullet-list-button">The "Insert Bullet Point List" button is located on the top left side of the screen.</screenshot>

And voilà, you have a bullet list!

<screenshot ts="00:04:29" id="bullet-list-creation">The bullet list created in "Rich Text" view.</screenshot>

If you want to achieve the same in "Source" view, the easiest way is to copy and paste an example of code that does what you want. For example, to create a bullet point list, you could copy a code like this:

\begin{itemize}
    \item First
    \item Second
\end{itemize}

And then modify the text to match your needs.

Managing Citations

Now, let's talk about citations. This is where LaTeX really shines. Every command in LaTeX starts with a backslash (\). To cite something, you use the command \cite{}.

There are two main ways to do this:

  1. In-text citation: Use \cite{} within the body of your paragraph. For example, "Havervall et al. (2021) estimated..."
  2. Parenthetical citation: Use \citep{} at the end of a sentence. For example, "...throughout 2022 (Havervall et al., 2021)."

In either case, when you start typing \cite or \citep, a list of your references will pop up.

<screenshot ts="00:04:45" id="cite-example">An example of a citation in "Source" mode.</screenshot>

Just select the one you want to insert. You can even add multiple citations by separating them with commas inside the curly braces.

But where does this list of citations come from? It comes from a separate file called a .bib file. In your project, you'll see two main files:

  • Your .tex file is where you write the main content of your paper.
  • Your .bib file is your bibliography database. It contains all your references in a special format called BibTeX.

If you click on your .bib file (in this example, it is called "references.bib"), you'll see something like this:

<screenshot ts="00:06:28" id="bib-file">The .bib file contains all the citations.</screenshot>

Each entry in this file represents a single reference. You can see it has fields for the author, title, journal, year, and so on. Each citation also has a unique name, which usually follows the format: "Author's surname" + "Year" + "First word of the title." For instance, in the example, you can see a citation named alwan2020doctors.

Now, if you need to cite a paper that's not already in your bibliography, here's what I recommend: use Google Scholar. It's a fantastic resource for finding and managing references.

First, go to the settings in Google Scholar (those three little lines on the top left side of the screen) and make sure the option "Show links to import citations into BibTeX" is turned on.

<screenshot ts="00:10:07" id="google-scholar-settings">How to turn on links to import citations into BibTex.</screenshot>

Now, when you search for a paper in Google Scholar, you'll see a little link that says "Import into BibTeX" under each result.

<screenshot ts="00:10:29" id="import-into-bibtex">The "Import into BibTex" button is located under the paper title.</screenshot>

Click that link, and you'll get the BibTeX entry for that paper. Copy the entire entry, go back to your .bib file in Overleaf, and paste it at the end. Now, when you use the \cite command, that new reference will show up in the list!

Collaboration and Review Features

One of the best things about Overleaf is that it makes collaboration super easy. To share your paper with collaborators, just click the "Share" button at the top right.

<screenshot ts="00:12:05" id="share-button">Click on the 'Share' button to collaborate with others on your Overleaf project.</screenshot>

You can invite people by email or create a shareable link. And the cool part is, you can all work on the document simultaneously! You'll see each other's changes in real-time.

If you want to track changes or add comments, click on the "Review" button.

<screenshot ts="00:12:16" id="review-button">Click on the 'Review' button to access features like track changes and comments.</screenshot>

Here you can turn on "Track Changes" for everyone. Now, any changes made will be highlighted, and you can see who made them.

<screenshot ts="00:12:34" id="track-changes">The changes will appear highlighted and can be accepted or rejected.</screenshot>

You can accept or reject each change individually. To leave a comment, just double-click on a word or highlight some text, and click "Add Comment." Your collaborators can then reply to your comments, and you can have a discussion right there in the document.

Downloading and Submitting Your Paper

Once your paper is ready to go, you can download it by going to the "Menu" on the top left side of the screen and selecting "PDF". Overleaf will generate a nicely formatted PDF of your paper.

<screenshot ts="00:11:48" id="download-buttons">You can download your compiled paper as a PDF or as a source file by clicking on "Menu" and selecting the corresponding option.</screenshot>

If you need to submit your paper as LaTeX source files (some journals require this), just click on "Source" instead of "PDF". This will download a zip file containing all your LaTeX files.

And that's it! You've now got the basics of using Overleaf and LaTeX down. I know it might seem like a lot at first, but it gets easier with practice. Personally, I think it is a great way to write papers and it has saved me a lot of time, so hopefully it helps you too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment