This commit is contained in:
2025-03-26 15:05:27 +08:00
parent 3ce099e454
commit 9fb503757a
10 changed files with 401 additions and 181 deletions

View File

@@ -19,8 +19,8 @@ const service = axios.create({
// baseURL: 'https://submission.tmrjournals.com/', //正式 记得切换
// baseURL: 'http://www.tougao.com/', //测试本地 记得切换
// baseURL: 'http://192.168.110.110/tougao/public/index.php/',
baseURL: '/api', //本地
// baseURL: '/', //正式
// baseURL: '/api', //本地
baseURL: '/', //正式
});

View File

@@ -1964,7 +1964,7 @@ export default {
const uid = 'wmath-' + Math.random().toString(36).substr(2, 9);
// 3. 创建一个 <wmath> 标签并插入到光标处
const wmathHtml = `<wmath contenteditable="false" data-id="${uid}" data-latex=""><Info >Insert formula here</Info></wmath>`;
const wmathHtml = `<wmath contenteditable="false" data-id="${uid}" data-latex=""></wmath>`;
ed.insertContent(wmathHtml); // 在光标位置插入 wmath 标签
// 4. 打开公式编辑器窗口,并传递光标位置、编辑器 ID 和 wmathId
@@ -1973,7 +1973,7 @@ export default {
// editorId:editorId,
// wmathId:uid,
// });
window.open(url, '_blank', 'width=600,height=460,scrollbars=no,resizable=no');
window.open(url, '_blank', 'width=1000,height=800,scrollbars=no,resizable=no');
}
});

View File

@@ -2,12 +2,12 @@
//记得切换
//正式
// const mediaUrl = '/public/';
// const baseUrl = '/';
const mediaUrl = '/public/';
const baseUrl = '/';
const mediaUrl = 'https://submission.tmrjournals.com/public/';
const baseUrl = '/api';
// const mediaUrl = 'https://submission.tmrjournals.com/public/';
// const baseUrl = '/api';

View File

@@ -412,6 +412,9 @@ Information:'Fill in information',
},
Formula:{
FormulaTemplate:'Formula Template'
}
}

View File

@@ -405,6 +405,9 @@ const zh = {
},
Formula:{
FormulaTemplate:'公式模版'
}
}

View File

@@ -2630,10 +2630,14 @@ export default {
// 点击进行下一步
onStep(e) {
console.log('this.majorValueList at line 2604:', this.majorValueList);
console.log('this.form at line 2622:', this.form);
console.log('this.form at line 2622:', this.form.abstrart);
this.$refs.articleform.validate((valid) => {
if (valid) {
if (this.isAbstractTooShort(this.form.abstrart)) {
this.$message.error('The abstract should not be less than 200 Chinese characters or English words!');
return false;
}
if (e == 1) {
if (this.form.journal == 0 || !this.form.journal) {
this.$message.error('Please select the Journal');
@@ -2752,13 +2756,17 @@ export default {
fstr += flist[fu].ke.trim() + ',';
}
}
console.log('this.form at line 2707:', this.form);
console.log('this.form at line 2707:', this.form.abstrart);
this.form.keyWords = fstr == '' ? '' : fstr.substring(0, fstr.length - 1);
this.form.major = this.majorValueList.map((item) => item.selectedValue[item.selectedValue.length - 1]).toString(',');
if (this.form.major == '') {
this.$message.error('Please select the Research areas');
return false;
}
if (this.isAbstractTooShort(this.form.abstrart)) {
this.$message.error('The abstract should not be less than 200 Chinese characters or English words!');
return false;
}
this.$api.post('api/Article/addArticlePart1', this.form).then((res) => {
if (res.code == 0) {
this.stagingID = res.data.article_id;
@@ -2875,7 +2883,14 @@ export default {
});
}
},
isAbstractTooShort(text) {
let chineseCount = (text.match(/[\u4e00-\u9fa5]/g) || []).length;
let englishCount = (text.match(/[A-Za-z0-9]/g) || []).length;
const total = chineseCount + englishCount;
return total < 200; // 不足 200说明太短
},
// 读取
Temporary() {
this.$api

View File

@@ -253,7 +253,7 @@ export default {
},
methods: {
openLatexEditor(data) {
this.$emit('openLatexEditor',data)
this.$emit('openLatexEditor', data);
console.log('at line 254:', '打开数字公式');
},
handleSubmit() {
@@ -377,78 +377,6 @@ export default {
}, 10);
},
// paste_preprocess: function (plugin, args) {
// let content = args.content;
// // 创建一个临时 div 元素来解析粘贴的 HTML
// let tempDiv = document.createElement('div');
// tempDiv.innerHTML = content;
// // 检查粘贴的内容是否包含 <table> 元素
// if (tempDiv.querySelector('table')) {
// console.log('粘贴的内容包含表格');
// if (_this.type == 'table') {
// _this.$commonJS.parseTableToArray(content, (tableList) => {
// console.log('res at line 104:', tableList);
// var contentHtml = `
// <div class="thumbnailTableBox wordTableHtml table_Box" style="">
// <table border="1" style="width: auto; border-collapse: collapse; text-align: center;">
// ${tableList
// .map((row) => {
// return `
// <tr>
// ${row
// .map((cell) => {
// return `
// <td colspan="${cell.colspan || 1}" rowspan="${cell.rowspan || 1}">
// <span>${cell.text || ''}</span>
// </td>
// `;
// })
// .join('')}
// </tr>
// `;
// })
// .join('')}
// </table>
// </div>
// `;
// const container = document.createElement('div');
// container.innerHTML = contentHtml;
// // _this.updateTableStyles(container); // 根据需要应用额外的样式
// args.content = container.innerHTML; // 更新处理后的内容
// });
// } else {
// }
// } else {
// const mathRegex = /\$\$([^$]+)\$\$/g;
// // 如果粘贴的内容包含 $$...$$ 格式的公式,进行处理
// content = content.replace(mathRegex, function (match, formula) {
// console.log('Matched formula:', formula); // 输出每个匹配的公式
// // 将公式包裹在 <wmath> 标签中,保留 $$...$$ 结构
// return `<wmath data-latex="${match}">${match}</wmath>`;
// });
// // 更新 args.content 为处理后的内容
// if (_this.isAutomaticUpdate) {
// args.content = _this.$commonJS.transformHtmlString(content); // 更新处理后的内容
// }
// setTimeout(() => {
// window.renderMathJax(_this.tinymceId);
// }, 50);
// console.log('粘贴的内容不包含表格');
// }
// // 阻止默认的粘贴行为
// if (args.event) {
// args.event.preventDefault(); // 阻止默认的粘贴处理
// args.event.stopPropagation(); // 阻止事件冒泡,确保自定义处理优先执行
// }
// },
content_style: `
${tableStyle}
${_this.wordStyle}
@@ -486,40 +414,39 @@ export default {
var currentWmathElement = null;
ed.on('click', function (e) {
const wmathElement = e.target.closest('wmath');
const wmathElement = e.target.closest('wmath');
if (wmathElement) {
currentWmathElement = wmathElement; // 👈 保存当前点击的元素
if (wmathElement) {
currentWmathElement = wmathElement; // 👈 保存当前点击的元素
const latexContentRaw = wmathElement.getAttribute('data-latex') || '';
console.log('at line 488: raw =', latexContentRaw);
const latexContentRaw = wmathElement.getAttribute('data-latex') || '';
console.log('at line 488: raw =', latexContentRaw);
// 去除所有 $ 符号
const latexContent = latexContentRaw.replace(/\$/g, '').trim();
console.log('at line 489: cleaned =', latexContent);
// 去除所有 $ 符号
const latexContent = latexContentRaw.replace(/\$/g, '').trim();
console.log('at line 489: cleaned =', latexContent);
// 编码后用于传递到弹窗
const encoded = encodeURIComponent(latexContent);
// 编码后用于传递到弹窗
const encoded = encodeURIComponent(latexContent);
// 给 wmath 添加唯一 data-id方便后续精准替换
let wmathId = wmathElement.getAttribute('data-id');
if (!wmathId) {
wmathId = 'wmath-' + Math.random().toString(36).substr(2, 9);
wmathElement.setAttribute('data-id', wmathId);
}
// 给 wmath 添加唯一 data-id方便后续精准替换
let wmathId = wmathElement.getAttribute('data-id');
if (!wmathId) {
wmathId = 'wmath-' + Math.random().toString(36).substr(2, 9);
wmathElement.setAttribute('data-id', wmathId);
}
// 当前编辑器 ID 也保存下来(如果你有多个编辑器)
const editorId = ed.id;
// 打开编辑窗口并传参(传递 data-id + 内容)
window.open(
`/LateX?id=${encoded}&wmathId=${wmathId}&editorId=${editorId}`,
'_blank',
'width=600,height=460,scrollbars=no,resizable=no'
);
}
});
// 当前编辑器 ID 也保存下来(如果你有多个编辑器)
const editorId = ed.id;
// 打开编辑窗口并传参(传递 data-id + 内容)
window.open(
`/LateX?id=${encoded}&wmathId=${wmathId}&editorId=${editorId}`,
'_blank',
'width=1000,height=800,scrollbars=no,resizable=no'
);
}
});
ed.ui.registry.addButton('uploadWord', {
text: 'Word',
@@ -651,7 +578,6 @@ export default {
window.addEventListener('message', function (event) {
const data = event.data;
console.log('data at line 648:', data);
// ✅ 编辑现有公式:替换或删除
if (data && data.type === 'update-wmath') {
const { editorId, wmathId, latex } = data;
@@ -680,38 +606,6 @@ export default {
}
}
}
// ✅ 插入新公式
// if (data && data.type === 'insert-new-wmath') {
// const latex = data.latex ? data.latex.trim() : '';
// // if (!activeEditorId || !latexEditorBookmark) return;
// const editor = window.tinymce.get(activeEditorId);
// if (!editor) return;
// // 恢复光标位置
// editor.focus();
// setTimeout(() => {
// editor.selection.moveToBookmark(latexEditorBookmark);
// const uid = 'wmath-' + Math.random().toString(36).substr(2, 9);
// const wmathHtml = `<wmath contenteditable="false" data-id="${uid}" data-latex="${latex}">${latex}</wmath>`;
// editor.insertContent(wmathHtml);
// // 清除焦点,防止影响渲染
// editor.focus(false); // 取消焦点
// // 清除
// latexEditorBookmark = null;
// activeEditorId = null;
// }, 20);
// setTimeout(() => {
// if (typeof renderMathJax === 'function') {
// _this.window.renderMathJax(_this.tinymceId);
// }
// }, 1000);
// }
});
// 🚩 标记为已注册,防止重复

View File

@@ -1,13 +1,9 @@
<template>
<div
style="
position: fixed;
top: 0;
left: 5px;
right: 5px;
background-color: #f8f8f8;
/* width: 400px; */
height: 300px;
height: 100vh;
overflow: hidden;
background: linear-gradient(to top, #fbfffe, #ebf9ff);
z-index: 9999;
@@ -23,27 +19,65 @@
</div>
</div>
</div>
<div class="commonWidth" style="padding: 40px 10px; box-sizing: border-box">
<div style="display: flex; align-items: center; justify-content: space-between">
<div style="height: calc(100vh - 50px); overflow: hidden; padding-top: 20px; box-sizing: border-box">
<div
class="commonWidth"
style="width: calc(100% - 380px); height: 100%; padding-left: 20px; box-sizing: border-box; float: left"
>
<p style="padding: 10px 0; color: rgb(51, 51, 51); box-sizing: border-box">Numerical formula:</p>
<div ref="mathField" class="math-container" style="width: calc(100%)"></div>
<el-button type="danger" @click="handleClear" plain style="float: right"> Clear</el-button>
</div>
<div style="margin-top: 40px; overflow: hidden">
<div style="float: left">
<span @click="copyLatex" style="font-size: 16px; cursor: pointer; opacity: 0.6" disabled v-if="!this.latex"
>📋 Copy
</span>
<span @click="copyLatex" style="font-size: 16px; cursor: pointer; opacity: 1" v-else>📋 Copy </span>
</div>
<el-button type="primary" @click="SaveyLatex" style="background-color: #1654f7 !important; float: right">Submit</el-button>
<el-button @click="handleCancel" style="float: right; margin-right: 10px">Cancel</el-button>
</div>
<!-- 公式显示框 -->
<div class="formula-box" :style="{ opacity: showLatex ? 1 : 0 }">
<p>LaTeX 代码:</p>
<textarea ref="latexBox" class="latex-text" readonly>$${{ latex }}$$</textarea>
<!-- 公式显示框 -->
<div class="formula-box" style="position: relative; margin-top: 20px">
<p style="padding: 10px 0; color: rgb(51, 51, 51); box-sizing: border-box">LaTeX Code:</p>
<div style="position: absolute; right: 10px; top: 45px">
<span @click="copyLatex" style="font-size: 16px; cursor: pointer; opacity: 0.6" disabled v-if="!this.latex"
>📋 Copy
</span>
<span @click="copyLatex" style="font-size: 16px; cursor: pointer; opacity: 1" v-else>📋 Copy </span>
<span style="margin: 0 10px; cursor: pointer">|</span>
<span style="color: red; cursor: pointer" @click="handleClear"
><i class="el-icon-delete-solid" style="color: red; margin-right: 4px"></i>Clear</span
>
</div>
<textarea ref="latexBox1" class="latexBox1" v-model="latex" @input="changeLatex"></textarea>
<textarea ref="latexBox" class="latex-text" readonly :style="{ opacity: showLatex ? 1 : 0 }" style="height: 0">
$${{ latex }}$$</textarea
>
</div>
<div style="margin-top: 10px; overflow: hidden">
<el-button type="primary" @click="SaveyLatex" style="background-color: #1654f7 !important; float: right"
>Submit</el-button
>
<el-button @click="handleCancel" style="float: right; margin-right: 10px">Cancel</el-button>
</div>
</div>
<div class="panel-default">
<p style="padding: 10px; color: #333; box-sizing: border-box">Formula Template</p>
<div class="panel-heading">
<div v-for="(item, index) in list" @click="changeSelectLateX(item, index)">
<p :class="currentSelect == index ? 'isSelect' : ''">
<span style="font-size: 12px; display: block; font-weight: bold">{{ item.titleEn }}</span>
<span style="font-size: 13px; display: block; font-weight: bold">{{ item.title }}</span>
</p>
</div>
</div>
<div
class="math-only"
v-for="(item, index) in list"
v-show="currentSelect == index"
style="height: calc(100% - 200px); overflow-y: auto"
>
<div
style="overflow-x: auto; overflow-y: hidden"
v-for="(v, i) in item.data"
:key="i"
class="math-block"
v-html="`$$${v}$$`"
@click="handleClick(v)"
></div>
</div>
</div>
</div>
</div>
@@ -51,11 +85,13 @@
<script>
import { MathfieldElement } from 'mathlive';
import formulaTemplates from './formulas.js';
export default {
props:['LateXInfo'],
props: ['LateXInfo'],
data() {
return {
currentSelect: 0,
list: formulaTemplates,
latex: '', // 默认公式
mathFieldInstance: null,
showLatex: false // 控制 LaTeX 代码框的显示与隐藏
@@ -69,6 +105,7 @@ export default {
if (this.$refs.mathField) {
const mf = new MathfieldElement();
mf.style.width = '100%';
mf.style.height = '100%';
mf.virtualKeyboardMode = 'manual'; // 显示虚拟键盘
mf.value = this.latex;
@@ -79,18 +116,57 @@ export default {
this.$refs.mathField.appendChild(mf);
this.mathFieldInstance = mf;
mf.executeCommand('showVirtualKeyboard');
this.keepKeyboardVisible(mf);
// mf.executeCommand('showVirtualKeyboard');
// this.keepKeyboardVisible(mf);
} else {
console.error('MathLive 未正确加载');
}
this.renderMathInScope(); // 首次挂载后也渲染
},
methods: {
keepKeyboardVisible(mf) {
setInterval(() => {
mf.executeCommand('showVirtualKeyboard');
}, 50); // 每秒确保键盘显示
handleClick(value) {
console.log('value at line 115:', this.mathFieldInstance);
if (this.$refs.mathField) {
this.mathFieldInstance.value = value;
}
this.latex = value;
this.$forceUpdate();
},
changeLatex() {
if (this.$refs.mathField) {
this.mathFieldInstance.value = this.latex;
}
},
changeSelectLateX(item, index) {
this.currentSelect = index;
this.renderMathInScope();
// this.mathFieldInstance.value = this.latex;
},
escapeLaTeX(input) {
// 将所有单斜线 \ 替换为双斜线 \\
return input.replace(/\\/g, '\\\\');
},
renderMathInScope() {
this.$nextTick(() => {
setTimeout(() => {
const el = document.querySelector('.math-only');
console.log('el at line 121:', el);
if (window.MathJax && el) {
// MathJax.typesetClear([el]); // 清除旧渲染
window.MathJax.typesetPromise([el]).catch((err) => {
console.warn('MathJax 渲染失败:', err);
});
}
}, 500);
});
},
// keepKeyboardVisible(mf) {
// setInterval(() => {
// mf.executeCommand('showVirtualKeyboard');
// }, 50); // 每秒确保键盘显示
// },
copyLatex() {
if (this.latex == '') {
return;
@@ -167,20 +243,20 @@ export default {
}
.math-container {
min-height: 40px;
padding: 5px;
height: 200px;
/* padding: 5px; */
font-size: 18px;
width: 100%;
}
.formula-box {
margin-top: 10px;
/* margin-top: 10px;
padding: 10px;
border: 1px solid #ccc;
background-color: #f9f9f9;
display: flex;
flex-direction: column;
align-items: flex-start;
align-items: flex-start; */
}
.latex-text {
@@ -195,4 +271,65 @@ export default {
::v-deep .ML__virtual-keyboard-toggle {
opacity: 1 !important;
}
li {
line-height: none;
}
.panel-default {
width: 360px;
height: 100%;
float: right;
border: 1px solid #ddd;
background-color: #fff;
}
.panel-heading {
color: #333;
font-weight: bold;
background-color: #f5f5f5;
border-color: #ddd;
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
}
.panel-heading div {
width: 25%;
padding: 5px 0px;
line-height: 20px;
border-radius: 4px;
text-align: center;
box-sizing: border-box;
}
.isSelect {
color: white !important;
background: #333;
border-radius: 4px;
}
.math-block {
background-color: #fff;
cursor: pointer;
background: #f0f0f0;
color: #000;
display: block;
margin: 10px;
padding: 6px;
/* min-height: 40px !important; */
border: 1px solid #ddd;
}
::v-deep .math-block mjx-container {
font-size: 18px !important;
margin: 0 !important;
text-align: left !important;
}
.latexBox1 {
width: 100%;
padding: 10px 140px 10px 10px;
box-sizing: border-box;
border: 1px solid #ccc;
background-color: #f9f9f9;
font-size: 18px;
resize: none;
height: 200px;
}
</style>

View File

@@ -16,7 +16,7 @@
:value="value"
:typesettingType="typesettingType"
class="paste-area text-container"
:toolbar="`['bold italic|customBlue removeBlue|${!isAutomaticUpdate?'LateX|':''}myuppercase myuppercasea Line|subscript superscript|searchreplace|clearButton']`"
:toolbar="`['bold italic|customBlue removeBlue|${!isAutomaticUpdate?'LateX|':''} myuppercase myuppercasea Line|subscript superscript|clearButton|searchreplace']`"
style="
/* white-space: pre-line; */
line-height: 12px;

View File

@@ -0,0 +1,168 @@
const algebraFormulas = [
'\\left(x - 1\\right)\\left(x + 3\\right)', '\\sqrt{a^2 + b^2}',
'\\frac{a}{b}',
'x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}',
'(a + b)^2 = a^2 + 2ab + b^2',
'a^n \\cdot a^m = a^{n + m}',
'a^0 = 1',
'\\left(a + b + c\\right)^2',
'\\left ( \\frac{a}{b}\\right )^{n}=\\frac{a^{n}}{b^{n}}',
'\\frac{a}{b}\\pm \\frac{c}{d}=\\frac{ad \\pm bc}{bd}',
'\\frac{1}{\\sqrt{a}}=\\frac{\\sqrt{a}}{a},a\\ge 0\\frac{1}{\\sqrt{a}}=\\frac{\\sqrt{a}}{a},a\\ge 0',
'\\sqrt[n]{a^{n}}=\\left ( \\sqrt[n]{a}\\right )^{n}',
'a\\geqslant 0,b\\geqslant 0 \\sqrt[n]{\\frac{a}{b}}=\\frac{\\sqrt[n]{a}}{\\sqrt[n]{a}}',
'x=a_0+\\frac{1}{\\displaystyle a_1+\\frac{1}{ \\displaystyle a_2+\\frac{ 1}{ \\displaystyle a_3+ a_4}}}',
];
//数列
const sequenceFormulas = [
'a_{n}=a_{1}q^{n-1}',
'S_{n}=\\frac{n \\left( a_{1}+a\\_{n}\\right)}{2}',
'S_{n}=na_{1}+\\frac{n \\left( n-1 \\right)}{{2}}d',
'a_{n}=a_{1}+\\left( n-1 \\left) d\\right. \\right.',
];
//矩阵
const matrixFormulas = [
`A=A^{T}\\
A=-A^{T}`
];
const otherFormulas = [
'\\bigcup_{i=1}^{n}{X_i}',
'\\bigcap_{i=1}^{n}{X_i}',
];
const geometryFormulas = [
'\\overrightarrow{AB}',
'\\overleftrightarrow{AB}',
'\\widehat{AB}',
'\\Delta A B C',
'l \\perp \\beta,l \\subset \\alpha \\Rightarrow \\alpha \\perp \\beta',
'P \\in \\alpha,P \\in \\beta,\\alpha \\cap \\beta=l \\Rightarrow P \\in l',
'\\alpha \\perp \\beta,\\alpha \\cap \\beta=l,a \\subset \\alpha,a \\perp l \\Rightarrow a \\perp \\beta',
'A \\in l,B \\in l,A \\in \\alpha,B \\in \\alpha \\Rightarrow l \\subset \\alpha',
'\\alpha \\parallel \\beta,\\gamma \\cap \\alpha=a,\\gamma \\cap \\beta=b \\Rightarrow a \\parallel b',
'A \\in l,B \\in l,A \\in \\alpha,B \\in \\alpha \\Rightarrow l \\subset \\alpha',
'A = \\pi r^2',
'C = 2\\pi r',
'a^2 + b^2 = c^2',
'\\angle ABC = 90^\\circ',
'\\triangle ABC \\cong \\triangle DEF',
'V = \\frac{4}{3}\\pi r^3',
'P = 4a',
'S = \\frac{1}{2}ab\\sin C'
];
const inequalityFormulas = [
'a > b',
'x \\leq y',
'|x| < 1',
'\\left|x + y\\right| \\leq \\left|x\\right| + \\left|y\\right|',
'\\forall x > 0,\\; x^2 > 0',
'\\exists x \\in \\mathbb{R},\\; x < 0',
'a^2 + b^2 \\geq 2ab'
];
const equationFormulas = [
'y = mx + b',
'x^2 - 4 = 0',
'x^2 + y^2 = 1',
'e^x = \\sum_{n=0}^{\\infty} \\frac{x^n}{n!}',
'\\log_b xy = \\log_b x + \\log_b y',
'x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}',
'a_n = a_1 + (n-1)d',
`a\\mathop{{x}}\\nolimits^{{2}}+bx+c=0\\
\\Delta=\\mathop{{b}}\\nolimits^{{2}}-4ac\\
\\mathop{{x}}\\nolimits_{{1,2}}=\\frac{{-b \\pm \\sqrt{{\\mathop{{b}}\\nolimits^{{2}}-4ac}}}}{{2a}}\\
\\mathop{{x}}\\nolimits_{{1}}+\\mathop{{x}}\\nolimits_{{2}}=-\\frac{{b}}{{a}}\\
\\mathop{{x}}\\nolimits_{{1}}\\mathop{{x}}\\nolimits_{{2}}=\\frac{{c}}{{a}}`,
`\\frac{x^{2}}{a^{2}}-\\frac{y^{2}}{b^{2}}=1`,
`y=kx+b`,
`y-y_{1}=k \\left( x-x_{1}\\right)`,
];
const trigonometryFormulas = [
'\\cos^{-1}\\theta',
'\\sin^{-1}\\theta',
'e^{i \\theta}',
'\\text{sin}^{2}\\frac{\\alpha}{2}=\\frac{1- \\text{cos}\\alpha}{2}',
'\\text{sin}^{2}\\frac{\\alpha}{2}=\\frac{1- \\text{cos}\\alpha}{2}',
'\\text{cos}^{2}\\frac{\\alpha}{2}=\\frac{1+\\text{cos}\\alpha}{2}',
'\\text{tan}\\frac{\\alpha}{2}=\\frac{\\text{sin}\\alpha}{1+\\text{cos}\\alpha}',
'\\sin^2\\theta + \\cos^2\\theta = 1',
'\\tan\\theta = \\frac{\\sin\\theta}{\\cos\\theta}',
'\\sin(2\\theta) = 2\\sin\\theta\\cos\\theta',
'\\cos(2\\theta) = \\cos^2\\theta - \\sin^2\\theta',
'\\cot\\theta = \\frac{1}{\\tan\\theta}',
'\\sec\\theta = \\frac{1}{\\cos\\theta}'
];
const calculusFormulas = [
'\\frac{dy}{dx}',
'\\int x^2 \\, dx',
'\\int_a^b f(x) \\, dx',
'\\lim_{x \\to 0} \\frac{\\sin x}{x} = 1',
'\\sum_{n=1}^{\\infty} \\frac{1}{n^2} = \\frac{\\pi^2}{6}',
'f\'(x) = \\lim_{h \\to 0} \\frac{f(x+h)-f(x)}{h}',
'e^x = \\sum_{n=0}^{\\infty} \\frac{x^n}{n!}'
];
const statisticsFormulas = [
'\\mu = \\frac{1}{n} \\sum_{i=1}^{n} x_i',
'\\sigma = \\sqrt{\\frac{1}{n} \\sum_{i=1}^{n} (x_i - \\mu)^2}',
'E(X) = \\sum x \\cdot P(x)',
'P(A \\cap B) = P(A)P(B \\mid A)',
'\\binom{n}{r} = \\frac{n!}{r!(n-r)!}',
'P(A \\cup B) = P(A) + P(B) - P(A \\cap B)'
];
const physicsFormulas = [
'\\vec{F}=m\\vec{a}',
'e=m c^2',
'\\vec{F}=m \\frac{d \\vec{v}}{dt}+\\vec{v}\\frac{dm}{dt}',
'\\oint \\vec{F}\\cdot d\\vec{s}=0',
'\\vec{F}_g=-F\\frac{m_1 m_2}{r^2}\\vec{e}_r',
'\\psi (t)=\\hat{\\psi}e^{i(\\omega t\\,\\pm\,\\theta)}',
'\\sum_i \\hat{\\psi_i}cos(\\alpha_i \\pm \\omega t)',
'E = mc^2',
'F = ma',
'v = u + at',
's = ut + \\frac{1}{2}at^2',
'V = IR',
'P = \\frac{W}{t}'
];
const chemistryFormulas = [
'_{10}^{5}C^{16}',
'2H_2+O_2 \\xrightarrow{n,m}2H_2O',
'A\\underset{b}{\\overset{a}{\\longleftrightarrow}}B',
'A\\underset{0}{\\overset{a}{\\rightleftarrows}}B',
'A\\underset{0^{\\circ}C}{\\overset{100^{\\circ}C}{\\rightleftarrows}}B',
'\\ce{H2 + O2 -> H2O}',
'\\ce{CO2 + H2O <=> H2CO3}',
'\\ce{Na+ + Cl- -> NaCl}',
'PV = nRT'
];
const formulaTemplates = [
{ title: '代数', data: algebraFormulas, titleEn: 'Algebra' },
{ title: '几何', data: geometryFormulas, titleEn: 'Geometry' },
{ title: '不等式', data: inequalityFormulas, titleEn: 'Inequalities' },
{ title: '方程', data: equationFormulas, titleEn: 'Equations' },
{ title: '数列', data: sequenceFormulas, titleEn: 'Sequences' },
{ title: '矩阵', data: matrixFormulas, titleEn: 'Matrices' },
{ title: '统计学', data: statisticsFormulas, titleEn: 'Statistics' },
{ title: '三角', data: trigonometryFormulas, titleEn: 'Trigonometry' },
{ title: '物理', data: physicsFormulas, titleEn: 'Physics' },
{ title: '化学', data: chemistryFormulas, titleEn: 'Chemistry' },
{ title: '微积分', data: calculusFormulas, titleEn: 'Calculus' },
{ title: '其他', data: otherFormulas, titleEn: 'Others' },
];
export default formulaTemplates;