来源信息
- 仓库
- brycewang-stanford/Auto-Empirical-Research-Skills
- 最近来源活动
- 2026年4月3日 02:07
- 检测到的 SKILL.md 语言
- 英语
- 星标
- 3,291
- 分支
- 432
安装方式
默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。
检查来源文件
决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。
菜单
默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。
决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/brycewang-stanford/Auto-Empirical-Research-Skills --skill latex-ocr-guide命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Route empirical-research requests through the Auto-Empirical Research Skills catalog when this whole repository is installed as one skill in Codex, CodeBuddy, Claude Code, or another IDE. Use to choose and load the right vendored AERS skill for causal inference, econometrics, replication, data acquisition, manuscript writing, peer review and referee responses, citation checking, de-AIGC editing, or full empirical-paper workflows without reading the entire repository at once.
中英双语学术降 AIGC / bilingual academic de-AIGC skill. Removes AI-generated writing signatures from empirical papers in economics, management, and the social sciences — in both English and Chinese. Covers Turnitin AI, GPTZero, Originality.ai on the English side and 知网 AMLC, 万方, 维普 on the Chinese side. Uses a six-step loop (intake → audit → claim-evidence check → differentiated rewrite → five-dimension self-score → cold-reader recheck) with two pattern libraries (22 English + 17 Chinese patterns), section-by-section strategies for empirical papers, and hard protections that keep every number, coefficient, and citation intact.
Use when a research task needs reproducible Kaggle discovery, metadata inspection, bounded public-data downloads, competition or kernel discovery, model discovery, or an explicitly approved Kaggle write/delete operation through the official CLI.
基于 SOC 职业分类
正在显示 SKILL.md
| name | latex-ocr-guide |
| description | Extract and convert mathematical formulas from images and PDFs to LaTeX code |
| metadata | {"openclaw":{"emoji":"🔍","category":"tools","subcategory":"ocr-translate","keywords":["math OCR","formula recognition","LaTeX OCR","document OCR","equation extraction"],"source":"wentor"}} |
A skill for extracting mathematical formulas from images, PDFs, and handwritten notes and converting them to LaTeX code. Covers tool selection, batch processing workflows, and quality verification techniques.
| Tool | Type | Accuracy | Best For | License |
|---|---|---|---|---|
| Mathpix | Cloud API | Very high | All math, diagrams | Commercial ($) |
| LaTeX-OCR (Lukas Blecher) | Local model | High | Printed formulas | MIT |
| Pix2Tex | Local model | High | Single equations | MIT |
| Nougat (Meta) | Local model | High | Full papers with math | MIT |
| InftyReader | Desktop | High | Printed math, Japanese | Commercial |
| img2latex | Local model | Moderate | Simple equations | MIT |
# Install the open-source LaTeX-OCR package
pip install "pix2tex[gui]"
# Or install from GitHub for latest version
pip install git+https://github.com/lukas-blecher/LaTeX-OCR.git
from pix2tex.cli import LatexOCR
from PIL import Image
def recognize_formula(image_path: str) -> str:
"""
Convert a formula image to LaTeX code.
Args:
image_path: Path to image containing a mathematical formula
Returns:
LaTeX string representation of the formula
"""
model = LatexOCR()
img = Image.open(image_path)
latex_code = model(img)
return latex_code
# Single image
result = recognize_formula('formula.png')
print(result)
# Output: E = mc^{2}
import fitz # PyMuPDF
from PIL import Image
import io
def extract_formulas_from_pdf(pdf_path: str, output_dir: str,
min_height: int = 30) -> list[dict]:
"""
Extract formula regions from a PDF and convert to LaTeX.
Args:
pdf_path: Path to the PDF file
output_dir: Directory to save extracted formula images
min_height: Minimum height (px) to consider as formula region
"""
doc = fitz.open(pdf_path)
model = LatexOCR()
results = []
for page_num in range(len(doc)):
page = doc[page_num]
# Extract images from page
image_list = page.get_images(full=True)
for img_idx, img_info in enumerate(image_list):
xref = img_info[0]
pix = fitz.Pixmap(doc, xref)
if pix.height >= min_height:
img_data = pix.tobytes("png")
img = Image.open(io.BytesIO(img_data))
try:
latex = model(img)
results.append({
'page': page_num + 1,
'image_index': img_idx,
'latex': latex,
'confidence': 'high' if len(latex) > 3 else
})
Exception e:
results.append({
: page_num + ,
: img_idx,
: ,
: (e)
})
results
For handwritten mathematics, preprocessing improves accuracy significantly:
import cv2
import numpy as np
def preprocess_handwritten(image_path: str) -> Image.Image:
"""
Preprocess a handwritten formula image for better OCR accuracy.
"""
img = cv2.imread(image_path, cv2.IMREAD_GRAYSCALE)
# 1. Denoise
img = cv2.fastNlMeansDenoising(img, h=10)
# 2. Adaptive thresholding for varying illumination
img = cv2.adaptiveThreshold(
img, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C,
cv2.THRESH_BINARY, 15, 8
)
# 3. Dilation to connect broken strokes
kernel = np.ones((2, 2), np.uint8)
img = cv2.dilate(img, kernel, iterations=1)
# 4. Crop to content with padding
coords = cv2.findNonZero(255 - img)
x, y, w, h = cv2.boundingRect(coords)
pad = 20
img = img[max(0, y-pad):y+h+pad, max(0, x-pad):x+w+pad]
return Image.fromarray(img)
Pricing note: Mathpix is a paid service (starting at $5/month). For free open-source alternatives, use pix2tex/LaTeX-OCR or Nougat (Meta), both MIT-licensed and capable of running locally.
For production-quality results, the Mathpix API provides the highest accuracy:
import requests
import base64
def mathpix_ocr(image_path: str, app_id: str, app_key: str) -> dict:
"""
Use Mathpix API for high-accuracy math OCR.
"""
with open(image_path, 'rb') as f:
image_data = base64.b64encode(f.read()).decode()
response = requests.post(
'https://api.mathpix.com/v3/text',
headers={
'app_id': app_id,
'app_key': app_key,
'Content-type': 'application/json'
},
json={
'src': f'data:image/png;base64,{image_data}',
'formats': ['latex_styled', 'text'],
'data_options': {'include_asciimath': True}
}
)
return response.json()
Always verify OCR output by rendering the LaTeX:
import matplotlib.pyplot as plt
def verify_latex(latex_string: str, output_path: str = 'verify.png'):
"""Render LaTeX formula and save as image for visual verification."""
fig, ax = plt.subplots(figsize=(8, 2))
ax.text(0.5, 0.5, f'${latex_string}$', fontsize=20,
ha='center', va='center', transform=ax.transAxes)
ax.axis('off')
fig.savefig(output_path, dpi=150, bbox_inches='tight')
plt.close()
print(f"Verification image saved to {output_path}")
Common OCR errors to watch for: confusing l with 1, O with 0, missing superscripts/subscripts, incorrect fraction nesting, and misrecognized Greek letters. Always proofread critical equations before submission.