You are an AI assistant equipped with the Fword skill for bidirectional Word ↔ LaTeX conversion.
Activate this skill when the user:
.docx / Word file to LaTeX.tex / LaTeX file back to WordBefore first use, ensure dependencies are installed:
bash {SKILL_DIR}/scripts/setup.sh
Check if setup is needed by testing: python3 -c "import pypandoc, anthropic, openai, docx". If this fails, run setup.
| Provider | Env Variable | Default Model | Flag |
|---|---|---|---|
| ---------- | ------------- | --------------- | ------ |
| Anthropic (Claude) | ANTHROPIC_API_KEY | claude-sonnet-4-20250514 | -p anthropic |
| OpenAI | OPENAI_API_KEY | gpt-4o | -p openai |
| Qwen (Alibaba) | DASHSCOPE_API_KEY | qwen-plus | -p qwen |
| Kimi (Moonshot) | MOONSHOT_API_KEY | moonshot-v1-8k | -p kimi |
| MiniMax | MINIMAX_API_KEY | MiniMax-Text-01 | -p minimax |
| DeepSeek | DEEPSEEK_API_KEY | deepseek-chat | -p deepseek |
| Zhipu (GLM) | ZHIPU_API_KEY | glm-4-plus | -p zhipu |
Any OpenAI-compatible API can also be used via --base-url.
cd {SKILL_DIR}/scripts && python3 convert.py /absolute/path/to/document.docx /absolute/path/to/output.tex
Options:
-p, --provider PROVIDER — AI provider (default: anthropic)--model MODEL — AI model (default: provider's default)--api-key KEY — API key (or set provider's env var)--base-url URL — Custom API base URL--raw — Pandoc-only conversion, no AI refinement (no API key needed)--keep-intermediate — Save Pandoc's raw output as .raw.texExamples:
# Default (Anthropic Claude)
cd {SKILL_DIR}/scripts && python3 convert.py /path/to/doc.docx
# Use Qwen
cd {SKILL_DIR}/scripts && python3 convert.py /path/to/doc.docx -p qwen
# Use DeepSeek with specific model
cd {SKILL_DIR}/scripts && python3 convert.py /path/to/doc.docx -p deepseek --model deepseek-chat
# Pandoc only (no AI)
cd {SKILL_DIR}/scripts && python3 convert.py /path/to/doc.docx --raw
cd {SKILL_DIR}/scripts && python3 back.py /absolute/path/to/document.tex /absolute/path/to/output.docx
Options:
--reference-doc PATH — Use a specific Word template for styles (overrides workspace)convert.py on the .docx file — this creates a .fword/ workspace and outputs .tex.fword/ workspace stores the original document as a style referenceback.py to convert back — it automatically finds the workspace and recovers stylesWhen the user wants to edit a Word document with AI help:
convert.py document.docx → produces document.tex.tex file and make the requested edits directly in LaTeXback.py document.tex → produces document.docx with original styles| User wants... | Action |
|---|---|
| --- | --- |
| Convert Word to LaTeX | convert.py input.docx |
| Convert with Qwen | convert.py input.docx -p qwen |
| Convert with DeepSeek | convert.py input.docx -p deepseek |
| Convert without AI | convert.py input.docx --raw |
| Convert LaTeX to Word | back.py input.tex |
| Edit Word doc with AI | convert → edit .tex → back |
cd {SKILL_DIR}/scripts before running scripts (they import each other)--raw flag for Pandoc-only conversion.fword/ workspace is created next to the output file共 1 个版本