admin-plugins author calendar category facebook post rss search twitter star star-half star-empty

Tidy Repo

The best & most reliable WordPress plugins

Free How to Add Words on an Equation in LaTeX as a Bubble

How to Add Words on an Equation in LaTeX as a Bubble

Plugin Author:

rizwan

February 13, 2025

Tutorials

LaTeX is one of the most powerful tools for formatting mathematical equations in research papers, presentations, and academic documents. While standard equation formatting is useful, adding annotative words inside bubbles can help clarify complex equations.

This guide will walk you through the best methods to add words in bubbles above or near an equation in LaTeX using TikZ, Overpic, and other techniques. Whether you’re preparing teaching materials or research documentation, these techniques will improve the readability of your equations.

Why Add Words in Bubbles on Equations?

Mathematical expressions often require explanatory notes to highlight specific terms. Instead of writing long descriptions separately, you can attach a text bubble to an equation, making it visually intuitive.

This method is particularly helpful in lecture notes, research papers, and books, where clarity is key. By adding text in a floating bubble or nearby box, you ensure that readers can quickly understand the purpose of each variable or operation.

Some of the most common use cases include:

  • Labeling key variables in physics and engineering equations.
  • Explaining transformation steps in algebra and calculus.
  • Marking critical points in a long mathematical derivation.

Now, let’s explore how to do this in LaTeX.

Methods to Add Text as Bubbles in Equations

Methods to Add Text as Bubbles in Equations

There are multiple ways to add words inside bubbles near an equation in LaTeX. The method you choose depends on your specific needs and complexity level.

  • Using TikZ → Best for precise control over positioning and design.
  • Using Overpic → Works well for overlaying annotations on images or PDFs.
  • Using Simple Text Commands → Quick and easy but lacks flexibility for shaped text bubbles.

Each method has its advantages and limitations, which we will explore below.

1. Using TikZ for Adding Text Bubbles

TikZ is a powerful package that allows users to draw annotations, shapes, and diagrams directly within LaTeX. It provides full control over positioning and styling of text bubbles.

Steps to Add Words in a Bubble with TikZ

  1. Load the TikZ package by adding the following to your LaTeX preamble:\usepackage{tikz}
  2. Write an equation inside the equation environment and define a TikZ node:\begin{equation}
    E = mc^2
    \tikz[baseline] \node[draw, cloud, anchor=west] at (1.5,0) {Energy};
    \end{equation}
  3. Customize the bubble appearance by modifying draw, cloud or using circle, rectangle, ellipse instead.
  4. Adjust the position of the bubble by changing (1.5,0) to move it horizontally or vertically.

This method allows you to precisely place words inside styled bubbles without overlapping with the equation.

2. Using Overpic for Overlaying Annotations

The overpic package allows users to place text over an existing equation or image. This is useful if you have pre-rendered equations or want to manually adjust positions.

How to Use Overpic in LaTeX

  • Load the package in the preamble:\usepackage[percent]{overpic}
  • Overlay text on an equation or image:\begin{overpic}[width=0.5\textwidth]{equation.png}
    \put(30,70){\textbf{Important term}}
    \end{overpic}
  • Adjust (30,70) to reposition the annotation.

3. Using Overbrace and Underbrace for Inline Labels

If you need to label specific parts of an equation, using \overbrace and \underbrace is an effective option.

Example:

\begin{equation}
F = \underbrace{ma}_{\text{Newton’s Second Law}}
\end{equation}

This keeps the annotation within the equation without requiring external text bubbles.

4. Using \text{} for Quick Inline Annotations

For short explanations inside an equation, the \text{} command works well.

Example:

\begin{equation}
\lambda = \frac{h}{mv} \quad \text{(De Broglie Wavelength)}
\end{equation}

This is the simplest method, but it lacks flexibility for complex annotations.

Fixing Common Issues in LaTeX Annotations

Sometimes, annotations and text bubbles may not align correctly or may overlap with the equation. Here are common issues and how to fix them.

1. Text Overlapping with Equation?

This happens when the annotation is placed too close to the equation. Try adjusting the positioning values in TikZ or Overpic.

  • In TikZ, use:

    at (x,y)

    to manually reposition the text bubble.

  • In Overpic, change the coordinates:\put(x,y){Text}

2. Bubble Not Displaying?

If TikZ text bubbles do not appear, ensure that you have included the \usepackage{tikz} in the preamble. Also, check that the coordinates do not place the bubble out of the visible range.

3. Equation Moves When Adding Annotations?

If adding annotations shifts your equation or changes spacing, wrap the equation inside a centered box to keep alignment intact:

\begin{center}
\begin{equation}
E = mc^2
\tikz[baseline] \node[draw, circle] at (1.5,0) {Energy};
\end{equation}
\end{center}

This ensures the equation stays properly aligned while allowing text bubbles to appear as needed.

Best Practices for Clear and Readable Annotations

Annotations should clarify an equation without making it cluttered. Follow these best practices:

  • Use contrasting colors if necessary for better visibility.
  • Keep bubbles small to avoid overcrowding the equation.
  • Position annotations strategically so they don’t cover important symbols.
  • Choose a simple style that blends well with the document.

By following these guidelines, you ensure that your equations remain clear and professional.

Conclusion

Adding words inside bubbles in LaTeX can enhance mathematical explanations, whether you’re teaching, writing research papers, or making technical presentations.

Have you tried adding text bubbles to your equations? Let us know in the comments!