# Academic Formula Parser (`constant_quadruped/academic-formula-parser`) Actor

Scrapes papers from academic databases and extracts math notation, equations, and solver definitions.

- **URL**: https://apify.com/constant\_quadruped/academic-formula-parser.md
- **Developed by:** [CQ](https://apify.com/constant_quadruped) (community)
- **Categories:** Developer tools, AI
- **Stats:** 2 total users, 1 monthly users, 75.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-usage

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Academic Formula Parser

Search [arXiv](https://arxiv.org) for academic papers on any topic and extract the **mathematical formulas and equations** from each paper — pulling the **real LaTeX** out of arXiv's HTML5 full-text build when one exists, and falling back to scanning the abstract otherwise.

No API key, login, or credentials are required. The actor uses only arXiv's free, public [Atom query API](https://info.arxiv.org/help/api/index.html) and the public `arxiv.org/html/<id>` full-text pages.

---

### What it does

For a given search query the actor:

1. Calls the public **arXiv query API** (`export.arxiv.org/api/query`) and retrieves up to `maxResults` papers, sorted by relevance.
2. For each paper, extracts the title, authors, abstract, arXiv ID, publication date and abstract URL.
3. Extracts equations:
   - If **Parse Full Text** is enabled (default), it fetches the paper's HTML5 build at `arxiv.org/html/<arxivId>` and pulls the **genuine LaTeX** out of the MathML `<annotation encoding="application/x-tex">` blocks that arXiv embeds for every rendered equation. Older papers often have no HTML build — in that case the actor falls back to the abstract.
   - It also scans the title + abstract free text for inline/display LaTeX (`$...$`, `$$...$$`, `\[...\]`, `\(...\)`, `\begin{equation}...`), symbolic relations in prose (e.g. `E = mc^2`, `dS/dt >= 0`), and standalone math tokens (subscripts/superscripts, Greek letters, scientific notation).
4. De-duplicates the detected expressions (HTML LaTeX takes priority over abstract heuristics) and pushes one record per paper to the dataset.

The `formulaSource` field on every record tells you whether the equations came from the paper's full text (`html-fulltext`) or only the abstract (`abstract`).

---

### Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `query` | string | `"thermodynamics"` | Topic or keyword to search arXiv for. Matched against all fields (`all:<query>`). |
| `maxResults` | integer | `10` | Number of arXiv papers to fetch and parse. Clamped to the range **1–100**. |
| `parseFullText` | boolean | `true` | When `true`, fetch each paper's HTML full text to extract real LaTeX equations. When `false`, only the abstract is scanned (faster, one request per run instead of one per paper). |

#### Example input

```json
{
  "query": "Schwarzschild black hole entropy",
  "maxResults": 5,
  "parseFullText": true
}
````

***

### Output

One dataset record is pushed per paper. Example (truncated):

```json
{
  "query": "attention is all you need transformer",
  "title": "Energy-Gated Attention and Wavelet Positional Encoding",
  "author": "Jane Doe, John Smith",
  "authors": ["Jane Doe", "John Smith"],
  "abstract": "We introduce ...",
  "equations": ["\\leq 6", "\\omega_{i}", "\\sigma_{i}"],
  "equationDetails": [
    { "expr": "\\leq 6", "type": "latex-html" },
    { "expr": "\\omega_{i}", "type": "latex-html" }
  ],
  "equationCount": 83,
  "formulaSource": "html-fulltext",
  "url": "http://arxiv.org/abs/2510.12345v1",
  "arxivId": "2510.12345v1",
  "published": "2025-10-15T12:00:00Z",
  "source": "arXiv"
}
```

#### Output fields

| Field | Type | Description |
|-------|------|-------------|
| `query` | string | The search query that produced this record. |
| `title` | string | Paper title. |
| `author` | string | Authors joined into a single comma-separated string (`"Unknown"` if none listed). |
| `authors` | string\[] | Authors as an array. |
| `abstract` | string | Paper abstract. |
| `equations` | string\[] | De-duplicated list of extracted formula/equation strings (LaTeX or symbolic). |
| `equationDetails` | object\[] | Same expressions with a `type` tag: `latex-html`, `latex-display`, `latex-inline`, `latex-env`, `relation`, or `expression`. |
| `equationCount` | integer | Number of equations in `equations`. |
| `formulaSource` | string | `html-fulltext` if equations came from the paper's HTML full text, otherwise `abstract`. |
| `url` | string | arXiv abstract page URL. |
| `arxivId` | string | Bare arXiv identifier (e.g. `2510.12345v1` or `hep-th/9901001`). |
| `published` | string | Publication timestamp (ISO 8601). |
| `source` | string | Always `"arXiv"`. |

If the query returns no papers, a single marker record is pushed with `equationCount: 0` and a `note` field explaining that arXiv returned no results.

***

### Authentication & setup

None. The actor requires no API keys, tokens, or accounts. It uses only arXiv's public endpoints.

***

### Limitations

- **arXiv only.** This actor searches arXiv exclusively. It does not query other databases (PubMed, IEEE, Semantic Scholar, etc.).
- **Full-text LaTeX requires an HTML build.** arXiv only generates HTML5 (with embedded LaTeX) for many — not all — papers, mostly more recent ones. Papers without an HTML build fall back to abstract-only extraction, which usually yields few or zero equations because abstracts rarely contain typeset math. This is expected; check `formulaSource` to see which path was used.
- **Heuristic abstract extraction.** Formula detection in plain abstract prose is regex/heuristic based, so it can miss unusual notation or occasionally include a near-miss expression. The `html-fulltext` path (real MathML LaTeX) is the high-fidelity source.
- **Equations are returned as raw LaTeX/symbol strings.** They are not rendered to images or evaluated. No solving, simplification, or symbolic computation is performed.
- **Rate limits.** With `parseFullText` enabled the actor makes one extra HTTP request per paper to `arxiv.org`. Large `maxResults` values mean more requests; arXiv may throttle very aggressive use.

***

### How equations are typed

| `type` | Meaning |
|--------|---------|
| `latex-html` | Real LaTeX extracted from the paper's HTML5 MathML annotations (highest fidelity). |
| `latex-display` | Display-math LaTeX found in text (`$$...$$`, `\[...\]`). |
| `latex-inline` | Inline LaTeX found in text (`$...$`, `\(...\)`). |
| `latex-env` | LaTeX environment (`\begin{equation}...\end{equation}`, `align`, etc.). |
| `relation` | A symbolic relation detected in prose (e.g. `E = mc^2`, `dS/dt >= 0`). |
| `expression` | A standalone math token (subscript/superscript, Greek letter, scientific notation). |

# Actor input Schema

## `query` (type: `string`):

Topic or keyword to search arXiv for, then scan papers for mathematical formulas.

## `maxResults` (type: `integer`):

Maximum number of arXiv papers to fetch and parse (1-100).

## `parseFullText` (type: `boolean`):

Fetch each paper's HTML full text to extract the real LaTeX of every equation. Disable to scan only the abstract (faster, fewer requests).

## Actor input object example

```json
{
  "query": "thermodynamics",
  "maxResults": 10,
  "parseFullText": true
}
```

# Actor output Schema

## `dataset` (type: `string`):

Papers with title, author, extracted equations, and source URL.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("constant_quadruped/academic-formula-parser").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("constant_quadruped/academic-formula-parser").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call constant_quadruped/academic-formula-parser --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=constant_quadruped/academic-formula-parser",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Academic Formula Parser",
        "description": "Scrapes papers from academic databases and extracts math notation, equations, and solver definitions.",
        "version": "2.2",
        "x-build-id": "rZcFS8dftotSPpnTn"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/constant_quadruped~academic-formula-parser/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-constant_quadruped-academic-formula-parser",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/constant_quadruped~academic-formula-parser/runs": {
            "post": {
                "operationId": "runs-sync-constant_quadruped-academic-formula-parser",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/constant_quadruped~academic-formula-parser/run-sync": {
            "post": {
                "operationId": "run-sync-constant_quadruped-academic-formula-parser",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "query": {
                        "title": "Search Query",
                        "type": "string",
                        "description": "Topic or keyword to search arXiv for, then scan papers for mathematical formulas.",
                        "default": "thermodynamics"
                    },
                    "maxResults": {
                        "title": "Max Results",
                        "minimum": 1,
                        "maximum": 100,
                        "type": "integer",
                        "description": "Maximum number of arXiv papers to fetch and parse (1-100).",
                        "default": 10
                    },
                    "parseFullText": {
                        "title": "Parse Full Text",
                        "type": "boolean",
                        "description": "Fetch each paper's HTML full text to extract the real LaTeX of every equation. Disable to scan only the abstract (faster, fewer requests).",
                        "default": true
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
