Docs / LaTeX Equation Editor

How to Write a Piecewise Function in LaTeX Equation Editor

Use Miss Formula’s LaTeX Equation Editor

Open LaTeX Equation Editor and enter a cases environment. Use an ampersand between each expression and its condition, and two backslashes between branches. Check that zero belongs to exactly the intended branch before exporting.

Who it helps
Students and researchers preparing definitions with multiple conditions.
What you keep
The original LaTeX is the mathematical source; an SVG is a graphic representation.

Start with free credits

  • First-time sign-in includes initial free credits.
  • Earn more free credits through invitations or eligible tasks.
  • Full-access plans start at $8.30/month.

Credit use depends on the operation and selected model. The embedded workspace is a preview; open Studio to process your own input.

Try LaTeX Equation Editor for Free

Write and inspect a two-branch definition

This original teaching example defines f(x) as x squared for nonnegative x and minus x for negative x. It is a notation exercise, not a result from a research paper.

f(x)=\begin{cases}x^2 & x \ge 0 \\ -x & x < 0\end{cases}
PartExpected meaningCheck
casesOne left brace groups two branchesBoth branch rows are visible
x^2 and x ≥ 0Use the square for zero and positive inputsThe equality belongs only to this branch
−x and x < 0Negate negative inputsDo not change the minus sign or inequality
  1. Open the editor from the preview’s Studio link and paste the expression into the formula input.
  2. Inspect the rendered brace and both condition columns.
  3. If the environment is unsupported, check the AMS extension in Settings, then retry the minimal example.
  4. Change one condition and observe the preview before adding your full definition.
  5. Copy the source for later editing. Export a graphic only when the destination needs one.

Test the intended boundary independently: this definition gives f(0)=0 through the first branch. A renderer displays the notation; it does not prove that your piecewise definition is mathematically appropriate.

For alignment syntax, see Overleaf’s amsmath guide. The browser renderer’s AMS support is described in MathJax documentation.

Why Choose Miss Formula's LaTeX Equation Editor?

Source control

Keep the LaTeX expression for later mathematical edits.

Live preview

Compare symbols and grouping before export.

Graphic output

Download an SVG for a destination that accepts vector graphics.

Formula templates

Start with a supported notation pattern and adapt it.

Package settings

Enable relevant optional math extensions when needed.

Academic workspace

Continue to related document and research tools in Studio.

We care about your privacy

Any data you upload is processed only temporarily. We do not use your data to train our own models.

Academic workflows worldwide

An academic workspace

Miss Formula brings research, writing, and illustration tools into one workspace. The institution logos below are platform-level references, not endorsements of this workflow.

Princeton University logo University of Chicago logo Duke University logo University of Cape Town logo University of Edinburgh logo The Chinese University of Hong Kong logo Universidad de los Andes logo
Academic communities
around the world

Miss Formula platform feedback

Existing platform feedback summaries; these are not testimonials about this specific workflow.

Michael started with a reference figure and opened the generated version in his browser. The layout was already in place, so he could focus on correcting a few labels before moving on with his work.

Michael B. PhD candidate

Carlos brought his figure into PowerPoint for a presentation. Because the shapes and text were still editable, he could change the colors on the slide and keep the panel he had already put together.

Carlos Martínez Undergraduate student

YunKai uses the converter on dense mechanism diagrams that go through several rounds of revision. Keeping arrows, labels, and grouped elements editable makes those revisions easier when parts of the diagram need to change.

YunKai Zhao Research assistant

Anna starts with a description, generates a figure, and edits it in the browser before adding it to her thesis or slides. That sequence fits the way she already prepares figures for her academic work.

Anna S. Master's student

James used AI Source Finder to search for papers from a draft written in Chinese. The English queries were better than the keywords he would have entered himself, and he also runs Citation Checker before submitting.

James K. Research assistant

Maya used AI Source Finder to add references to a paragraph in her literature review. She then converted the equations in Miss Formula, which let her handle both steps in the same place.

Maya C. Master's student

Frequently Asked Questions

Practical answers for this workflow.

Why are the conditions on the same line?

Use two backslashes between branch rows. A single backslash is not the row separator.

Why is there no right brace?

A cases environment normally uses a left brace. Check the definition rather than adding a closing brace solely for symmetry.

Can the editor check whether my cases cover all values?

Rendering is not a proof or domain checker. Inspect overlaps, gaps and boundary points yourself.

How do I export the result?

Keep the source, then use Export Image for a graphic. SVG is not a native editable Word equation.

Related: Continue with the related guide. Product interface and source documentation checked November 20, 2026.

Continue in Miss Formula Studio

Use a cases environment to keep each branch expression next to its condition, then inspect the boundary and brace.

Open LaTeX Equation Editor