Publish AI, ML & data-science insights to a global community of data professionals.

How to Create Professional Articles with LaTeX in Cursor

Learn how to rapidly create professional articles and presentations with LaTeX in Cursor

In this article, I’ll take you through how to write LaTex code in Cursor, allowing you to write both technical articles, and create professional looking presentations.

LaTeX is a commonly used system for writing technical articles. I, for example, wrote my Master’s thesis through Overleaf with a LaTeX file. However, LaTeX is complicated to learn, and when dealing with it through Overleaf, you’ll encounter a lot of compiler errors and struggle to organize the file exactly how you want.

Luckily, there is a much faster and more effective way of writing LaTeX code now: Write it in Cursor, or any other IDE powered by AI.

You can still write the text like you always used to, but instead of spending time aligning figures, fixing citation issues, and solving compiler errors, you can now ask an LLM to fix these issues for you. Additionally, it is faster than using an online editor like Overleaf, since you can compile the PDF locally on your computer, which is usually faster, of course, depending on the power of your computer.

Cursor AI Agents
This infographic highlights the main contents of this article. I’ll show you how to save countless hours by writing LaTeX code in Cursor instead of Overleaf. This saves you both a lot of time and frustration from solving bugs that AI agents can solve instantly. Image by Gemini.

The goal of this article is simply to show you the possibilities of an IDE by highlighting that you can even create LaTeX files with it. Discovering this as an option was an eye-opening experience for me.

Note that I’m not suggesting outsourcing your writing to Cursor. You should naturally write your own words. I’m simply saying you can outsource all of the non-writing tasks to Cursor, so you can spend all your time writing instead. Also, I’m not sponsored by Cursor in the writing of this article.

You can access the eBook created through this article here.

Why write LaTeX code in Cursor

LaTeX is the go-to system for writing technical articles, so whenever you write a paper, a thesis, or similar, people usually resort to LaTeX. People use LaTeX because:

  • You get a professional look at your article
  • It’s very customizable. You essentially program the text, figures, and formatting into a .tex file
  • You have a solid, scalable system for citations and references

However, it’s quite common to write LaTeX in an online editor like Overleaf. I used Overleaf for my Master’s thesis in 2024, and it worked decently, though I did spend a lot of time on mundane tasks such as fixing compiler issues, and the formatting of my thesis, fixing issues like:

  • How wide should an image be
  • Compiler issues
  • Proper citations
Cursor IDE
This image shows how I work to create an eBook with LaTeX through Cursor. I have the code in the left pane, where I write my content. I sometimes turn off tab suggestions since they can be disruptive when writing. To the right of my code, I have my parsed PDF from the LaTeX code. This automatically updates whenever I save the code file. All the way to the right ,I have the Cursor agent, which I can prompt with CMD + L on Mac, to help me with formatting, add a new image, and so on. Image by the author.

This is made especially frustrating because Overleaf spends quite some time compiling, especially when you have a 100-page document with a lot of images. I have now discovered there is a much better way of writing these articles, which is through your IDE.

Below you can see an example of LaTeX code, including bullet point lists and a figure with a caption and label used to reference the figure

A powerful middle-ground approach:

\begin{enumerate}
    \item Apply OCR to extract document text
    \item Prompt an LLM to extract specific metadata
\end{enumerate}

This works incredibly well because LLMs can:

\begin{itemize}
    \item Understand context (which dates are relevant vs irrelevant)
    \item Parse different date formats automatically
    \item Handle both European (dd.mm.yyyy) and American (mm.dd.yyyy) standards
\end{itemize}

Figure~\ref{fig:ocr-llm-flow} illustrates this approach:

\begin{figure}[h]
\centering
\includegraphics[width=0.9\textwidth]{images/document-to-ocr-to-IE.png}
\caption{The OCR + LLM metadata extraction pipeline. A document is first processed through OCR to extract text, which is then combined with a prompt and fed to an LLM to extract structured metadata. This approach balances cost and capability, leveraging the LLM's contextual understanding while avoiding the higher token costs of processing images directly.}
\label{fig:ocr-llm-flow}
\end{figure}

I would also argue that you should write non-technical content through LaTeX. It’s a super organized way to create PDFs with proper formatting, figures, and references.

Furthermore, you can create presentations through Overleaf, which is essentially an article, but of course, using clearly separated slides.

Set up LaTeX in Cursor

Setting up LaTeX in Cursor is relatively simple: You ask the agent to set up the environment for you. I used the following prompt:

set up a file called ebook which is a latex file and help me parse it 
as a pdf. The layout should be that of a data science ebook

Cursor then created an ebook.tex file, and the commands I needed to parse it. After that, you can simply start writing your content. If you need a specific structure or want to follow a template, you can also prompt Cursor about this and have it design an outline for your article, where you can start working.

Writing your article and compiling

After setting up LaTeX in Cursor, I started writing my eBook. I asked Cursor to make an outline for me for a data science template, where it filled in the basics, leaving [TEXT PLACEHOLDER] around the file.

Cursor, for example, set up a title and subheader placeholder, the current date, a preface placeholder, and a chapter placeholder. I could then easily start filling out the content of my article.

Image formatting

Latext ebook image
In this image, you can see an example of a figure I use in my eBook, as well as text referring to the figure, and the figure description. To add this image, I simply provided Cursor the path to my local image, and it copied that image into the relevant workspace and added the reference to the image in my ebook.tex file. Image by the author,

At some points, I want to add pictures and figures to my article. I then provide Cursor the local path to the image on my computer, and the location to put the image in, and provide a field to fill in the image description text. If I want any special formatting for the image (width, opacity, two images beside each other, …) I also prompt Cursor to do that.

Code formatting

Code block
This image shows an example of a code block in my eBook. You can see the formatting in the code block with the color palette, and the numbered lines on the left side, which is exactly how I want to display code in my eBook. Adding this formatting with Cursor was super simple and was way faster than adding such formatting through Overleaf. Image by the author,

Adding code is also quite simple with Cursor. I have a certain code formatting style specified in my agents.md file, and I then simply provide Cursor the code to highlight, and it adds it to the file with the correct formatting. At some point, I also noticed that a line of code was going outside the PDF, and I told Cursor to wrap the line, and added that to agents.md (if a code line is too long, always wrap it). I’ll cover more about agents.md in the next section.

Box highlighting

Sometimes, I also want to preface points in my eBook. In these cases, I make use of box highlighting. I simply mark the relevant text in my code, press CMD + L to add it as context to the Cursor, and prompt the Cursor to add this as a key point box. Cursor then provides the box you see below, which helps make my point clearer.

This image highlights a key point in my article. I had the text and then asked Cursor to make this a key point in my article, with a box around it. I then got the result you see in the image. If I did this through Overleaf, it would take a lot longer, considering I would have to ask ChatGPT how to do it, copy and paste the code, and then adapt the code to my own LaTeX code. Image by the author.

Maintaining agents.md

When you start writing and prompting the Cursor to fix formatting, you’ll notice that the AI agent sometimes doesn’t do as you desire. In these cases, it’s very important to maintain an agents.md where you condense your preferences into a single file. For example:

  • If you want citations in a specific format
  • If you want a certain color scheme
  • How wide should your figures be

Whenever Cursor deviates from the desired behavior, for example, by using the incorrect color scheme, you should do two things:

  1. Tell Cursor the correct behavior (use a minimalistic black and white color scheme instead)
  2. Tell Cursor to add that behavior to agents.md (or .cursorrules). This will ensure the error does not happen again

Doing these two steps should essentially be muscle memory whenever an AI agent doesn’t do exactly what you want it to do. It is especially important when writing longer LaTeX files, where you’re dependent on consistent schemes and formatting, and you don’t want to always specify the type of color scheme you want whenever making an update.

Conclusion

In this article, I’ve taken you through how you can use Cursor to write your technical articles in LaTeX. For me, this is a revolutionary workflow, saving me countless hours every time I’m writing an article in LaTeX. I believe you should never be spending time manually solving compiler errors in Overleaf or copying and pasting code from ChatGPT to solve formatting errors. Writing LaTeX in Cursor essentially solves all your problems, except for the writing itself, which you naturally have to perform yourself.

👉 My Free Resources

🚀 10x Your Engineering with LLMs (Free 3-Day Email Course)

📚 Get my free Vision Language Models ebook

💻 My webinar on Vision Language Models

👉 Find me on socials:

📩 Subscribe to my newsletter

🧑‍💻 Get in touch

🔗 LinkedIn

🐦 X / Twitter

✍️ Medium


Towards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.

Write for TDS

Related Articles