"
196 | ],
197 | "text/html": [
198 | "\n",
199 | " \n",
200 | " \n",
201 | "
\n",
202 | " [ 165/29436 01:47 < 5:21:08, 1.52 it/s, Epoch 0.02/3]\n",
203 | "
\n",
204 | " \n",
205 | " \n",
206 | " \n",
207 | " Step | \n",
208 | " Training Loss | \n",
209 | "
\n",
210 | " \n",
211 | " \n",
212 | " \n",
213 | " 100 | \n",
214 | " 0.195300 | \n",
215 | "
\n",
216 | " \n",
217 | "
"
218 | ]
219 | },
220 | "metadata": {}
221 | }
222 | ]
223 | }
224 | ]
225 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 | # MixTeX - Multimodal LaTeX OCR with CPU Inference
3 | [](https://arxiv.org/abs/2406.17148)
4 |
5 | [](https://huggingface.co/MixTex/ZhEn-Latex-OCR)
6 | [](https://www.youtube.com/watch?v=PqQdQ5xT-vk)
7 | 
8 |
9 | ## Online Demo: https://mineai.top/
10 |
11 | MixTeX is an innovative multimodal LaTeX recognition mini-program, independently developed by our team. It performs efficient CPU-based inference in a local offline environment. Whether it's LaTeX formulas, tables, or mixed text, MixTeX can easily recognize them all, supporting both Chinese and English processing. Thanks to powerful technical support and optimized design, MixTeX can run efficiently without GPU resources, suitable for any Windows computer, greatly facilitating user experience.
12 | 
13 |
14 | ## Source code setup:
15 | *Make sure that you have read the user agreement before starting.*
16 |
17 | 1. Navigate to the `mixtexgui` directory: `cd mixtexgui`
18 | 2. Create a new Conda environment: `conda create -n mixtex python=3.10.14`
19 | 3. Activate the environment: `conda activate mixtex`
20 | 4. Run `pip install -r requirements.txt`
21 | 5. Build the application with PyInstaller: `pyinstaller mixtex_ui.spec`
22 | 6. If possible, could everyone please submit the packaged programs from other platforms to GitHub? Thank you for your support!
23 |
24 | ## Key Features
25 |
26 | - **LaTeX Formula Recognition**: Accurately recognizes complex LaTeX mathematical formulas, ensuring mathematical expression accuracy.
27 | - **Table Recognition**: Efficiently processes and recognizes various tables, generating corresponding LaTeX table code.
28 | - **Mixed Text Recognition**: Simultaneously processes text containing words, formulas, and tables, guaranteeing completeness and accuracy of recognition results.
29 | - **Bilingual Support**: Whether Chinese or English, MixTeX achieves high-precision recognition, meeting needs in different language environments.
30 |
31 | ## Technical Characteristics
32 |
33 | - **Local Offline Inference**: No internet connection required, ensuring data privacy and security, suitable for high-confidentiality user scenarios.
34 | - **Lightweight Design**: The program startup file is only about 50 MB, facilitating quick deployment and startup.
35 | - **Efficient Operation**: Although the model file size is 300 MB, causing a slightly slower startup, once loaded, it runs extremely fast, ensuring a smooth user experience.
36 | - **No GPU Required**: Runs efficiently on CPU, suitable for all Windows computers without the need for high-end hardware support.
37 |
38 | ## User Guide
39 |
40 | 1. **Clipboard Image Recognition**: Users can enable the clipboard function by pressing `Win+V` and copy the image to be recognized to the clipboard.
41 | 2. **Screenshot Recognition**: Use the built-in Windows screenshot tool or the screenshot key on the keyboard to capture and directly recognize the screenshot content.
42 |
43 | ## User
44 |
45 | As a permanently free software, MixTeX promises continuous optimization while maintaining local offline operation, with no advertisements, providing the best user experience.
46 |
47 | ## Demo
48 |
49 | MixTeX excels in recognizing complex text, with particularly good performance in English recognition and comparable results for Chinese. The following image demonstrates MixTeX's recognition capabilities for complex text: (Recommended Image size: 400 x 500)
50 |
51 | 
52 |
53 | 
54 |
55 | 
56 |
57 | ## Environment Requirements
58 |
59 | MixTeX uses LaTeX environment for code conversion. We recommend the following LaTeX configuration:
60 |
61 | ```latex
62 | \documentclass{ctexart}
63 | \usepackage{amssymb}
64 | \usepackage{amsmath}
65 | \usepackage{stmaryrd}
66 | \usepackage{color}
67 | ```
68 |
69 | ## Changelog
70 |
71 | ~~During usage, you may encounter the following warning message: `Error during OCR: Invalid image type. Expected either PIL.Image.Image, numpy.ndarray, torch.Tensor, tf.Tensor or jax.ndarray, but got .`~~
72 |
73 | v1.0.1 [Resolved] **Critical**: Unable to copy files while running the software, and copying files caused warnings.
74 |
75 | ~~Consistent warning message: `Error during OCR: Unable to infer channel dimension format.`~~
76 |
77 | v1.0.2 [Resolved] **Extreme**: Some users' monitors are too advanced, with non-RGB colors, causing the software to be unusable.
78 |
79 | v1.1.2 [Optimization] Added data collection function, fine-tuned 300 real small samples, optimized curly bracket and table recognition. More tables and formulas have been added for pre-training, including the formulas provided by @github.com/ZLab511
80 |
81 | v2.1.2 [Upgrade] Synthesized handwriting dataset, fine-tuned 100 real manuscripts, retrained the model, and partially supported handwritten text mixed formula.
82 |
83 | v2.2.3 [Upgrade] Fine-tuned 150 real manuscripts + 300, and supported handwritten text mixed formula and black background.
84 |
85 | v3.2.4 [Upgrade] Fine-tuned 500 real, and supported multiple choice questions ocr, In terms of software, we support pressing F2 after clicking the icon to pause recognition, and pressing F2 again to start recognition. Improved the escaping of multi-line formulas and in-text formulas into $$ wrappers, and improved data collection.
86 |
87 | ## Limitations
88 |
89 | Currently, MixTeX only supports recognition of clear printed fonts for Chinese and English mixed formulas and relatively simple tables. We plan to expand our capabilities in future updates:
90 |
91 | - Support for handwritten formulas and text recognition
92 | - Multi-language support
93 | - Complex table recognition
94 |
95 | It's important to note that our model's training dataset is largely synthetic and generated, which results in somewhat rough, uniform, and limited data. In future iterations, we will gradually enhance and expand our training dataset with real-world scenarios. This improvement will lead to better recognition accuracy and increased robustness of the system.
96 |
97 | We appreciate your understanding as we continue to develop and refine MixTeX. Your feedback and patience are invaluable as we work towards creating a more comprehensive and versatile tool.
98 |
99 | ## Conclusion
100 |
101 | MixTeX is committed to providing users with the most convenient and efficient multimodal LaTeX recognition tool. We look forward to your use and feedback. If you have any suggestions or encounter any issues with MixTeX, please feel free to contact us. Let's work together to create the best LaTeX recognition tool!
102 |
103 | 
104 |
105 |
--------------------------------------------------------------------------------
/READMEzh.md:
--------------------------------------------------------------------------------
1 |
2 | 
3 | # MixTeX - 多模态 LaTeX-ocr CPU推理
4 |
5 | MixTeX 是一款多模态 LaTeX 识别小程序,由我们自主研发,能够在本地离线环境下进行高效的 CPU 推理。无论是 LaTeX 公式、表格,还是混合文字,MixTeX 都能轻松识别,并且支持中英文双语处理。得益于强大的技术支持和优化设计,MixTeX 可以在没有 GPU 资源的情况下高效运行,适用于任何 Windows 电脑,极大地方便了用户的使用。
6 | [](https://arxiv.org/abs/2406.17148)
7 |
8 | [](https://huggingface.co/MixTex/ZhEn-Latex-OCR)
9 | [](https://www.bilibili.com/video/BV1hS42197Vp/)
10 |
11 | ## 主要功能
12 |
13 | - **LaTeX 公式识别**:精准识别复杂的 LaTeX 数学公式,确保数学表达的准确性。
14 | - **表格识别**:高效处理并识别各类表格,生成对应的 LaTeX 表格代码。
15 | - **混合文字识别**:同时处理包含文字、公式和表格的混合文本,保证识别结果的完整性和准确性。
16 | - **中英文双语支持**:无论是中文还是英文,MixTeX 都能做到高精度识别,满足不同语言环境下的需求。
17 |
18 | ## 技术特点
19 |
20 | - **本地离线推理**:无需联网,保证数据隐私安全,适合需要高保密性的用户场景。
21 | - **轻量化设计**:启动程序文件仅 50 多 MB,便于快速部署和启动使用。
22 | - **高效运行**:虽然模型文件大小为 300 MB,启动速度稍慢,但一旦加载后,运行速度极快,保证用户流畅的使用体验。
23 | - **无需 GPU 资源**:在 CPU 上高效运行,适合所有 Windows 电脑,无需高配置硬件支持。
24 |
25 | ## 使用指南
26 |
27 | 1. **剪切板图片识别**:用户可以通过按下 `win+v` 开启剪切板功能,将需要识别的图片复制到剪切板。
28 | 2. **截图识别**:使用 Windows 自带的截图工具,通过键盘上的截屏按键进行截图,直接识别截图内容。
29 |
30 | ## 局限性
31 |
32 | 目前 MixTeX 只支持清晰打印字体下的中文和英文混合公式以及较为简单的表格识别。我们计划在后续版本中开放更多功能,包括支持手写公式和文字识别、多语言识别及复杂表格处理。
33 |
34 | 由于我们的模型训练数据集多为伪造生成,数据较为粗糙、单一且稀缺,识别效果和鲁棒性可能受到一定影响。我们将在后续逐步增加并完善在真实场景下的数据集训练,以获得更好的识别效果和鲁棒性。
35 |
36 | ## 用户
37 |
38 | MixTeX 作为一款永久免费软件,承诺持续优化并保持本地离线运行,无任何广告干扰,为用户提供最优质的使用体验。用户可以加入我们的 QQ 群获取更多帮助和支持,与我们一起讨论和改进产品。
39 |
40 | ## 效果展示
41 |
42 | MixTeX 在识别复杂文本方面表现出色,尤其是英文识别效果非常好,中文识别效果也不逊色。以下图片展示了 MixTeX 对复杂文本的识别效果:
43 |
44 | 
45 |
46 | 
47 |
48 | 
49 |
50 |
51 | ## 环境要求
52 |
53 | MixTeX 使用 LaTeX 环境进行代码转换,建议使用以下 LaTeX 配置:
54 |
55 | ```latex
56 | \documentclass{ctexart}
57 | \usepackage{amssymb}
58 | \usepackage{amsmath}
59 | \usepackage{stmaryrd}
60 | \usepackage{color}
61 | ```
62 |
63 | ## 更新日志
64 |
65 | ~~在使用过程中,您可能会遇到以下警告信息:`Error during OCR: Invalid image type. Expected either PIL.Image.Image, numpy.ndarray, torch.Tensor, tf.Tensor or jax.ndarray, but got .`~~
66 | v1.0.1【已解决】**严重**:在运行软件时,无法复制文件,及其复制文件导致警告。
67 |
68 | ~~一直警告信息:`Error during OCR: Unable to infer channel dimension format.`~~
69 | v1.0.2【已解决】**极端**:个别用户显示器太高级,色彩不是RGB,导致无法使用。
70 |
71 | ## 结语
72 |
73 | MixTeX 致力于为用户提供最便捷、高效的多模态 LaTeX 识别工具,期待您的使用和反馈。如果您对 MixTeX 有任何建议或遇到问题,欢迎随时与我们联系。让我们一起努力,打造最优质的 LaTeX 识别工具!
74 |
75 | 
76 |
77 |
--------------------------------------------------------------------------------
/User Manual&Terms of Service.md:
--------------------------------------------------------------------------------
1 | ## 使用说明
2 |
3 | 1. **剪切板开启**:使用前请按 `Win + V` 打开剪切板功能。
4 | 2. **无需安装**:直接运行 `exe` 文件,无需安装。
5 | 3. **离线推理**:该程序无需联网,无需 GPU,模型可在 CPU 上进行推理。
6 | 4. **系统兼容性**:目前仅支持 Windows 10 和 11 系统。
7 | - 对于其他操作系统用户,可访问在线网页版: [mineai.top](http://mineai.top)
8 |
9 | ## 使用注意事项
10 |
11 | - **截图尺寸**:请确保截图尺寸不超过 448×448,超出部分将会被等比压缩处理。
12 | - **支持内容**:目前仅支持中英文混合手写公式和简单表格的识别。
13 | - **右键菜单功能**:右键点击图标,可选择关闭、最小化、数据标注、文内公式转义等功能。
14 | - **开源免费**:本程序完全开源免费,我们欢迎大家提供真实使用反馈,以帮助优化模型。
15 |
16 | ## 常见错误
17 |
18 | 1. ONNX 文件与 `exe` 文件未放置在同一目录下。
19 | 2. 未按 `Win + V` 打开剪切板功能。
20 | 3. 若出现 `tk` 错误,请下载无图形界面的版本。
21 |
22 | ## 用户协议
23 |
24 | - 本程序遵循 AGPL-3.0 许可证。
25 | - 基于该模型的任何衍生品均不得用于商业用途。
26 | - 使用者需自行承担因非法使用本软件所产生的一切后果。
27 |
28 | # User Guide
29 |
30 | 1. **Clipboard Activation**: Before using the program, press `Win + V` to enable the clipboard feature.
31 | 2. **No Installation Required**: Simply run the `exe` file; no installation is necessary.
32 | 3. **Offline Inference**: The program operates without an internet connection and does not require a GPU. The model runs inference on the CPU.
33 | 4. **System Compatibility**: Currently, only Windows 10 & 11 systems are supported.
34 | - For users on other operating systems, please use the online version: [mineai.top](http://mineai.top)
35 |
36 | ## Usage Notes
37 |
38 | - **Screenshot Size**: Ensure that the screenshot size does not exceed 448×448 pixels. Larger dimensions will be proportionally compressed.
39 | - **Supported Content**: The program currently supports mixed Chinese and English handwritten formulas and tables.
40 | - **Right-Click Menu**: Right-click on the icon to access features such as close, minimize, data annotation, and in-text formula escaping.
41 | - **Open Source & Free**: This program is fully open source and free. We encourage users to provide real-world feedback to help optimize the model.
42 |
43 | ## Common Errors
44 |
45 | 1. The ONNX file and the `exe` file are not placed in the same directory.
46 | 2. The clipboard feature is not activated with `Win + V`.
47 | 3. If a `tk` error occurs, download the version without a graphical interface.
48 |
49 | ## User Agreement
50 |
51 | - The program is licensed under AGPL-3.0.
52 | - Derivatives of this model are not allowed for commercial use.
53 | - Users are fully responsible for any consequences arising from the illegal use of this software.
54 |
--------------------------------------------------------------------------------
/demo/1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RQLuo/MixTeX-Latex-OCR/845d0d75b5f55185ee088cf68dc57d5eb3d0f10b/demo/1.gif
--------------------------------------------------------------------------------
/demo/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RQLuo/MixTeX-Latex-OCR/845d0d75b5f55185ee088cf68dc57d5eb3d0f10b/demo/2.png
--------------------------------------------------------------------------------
/demo/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RQLuo/MixTeX-Latex-OCR/845d0d75b5f55185ee088cf68dc57d5eb3d0f10b/demo/3.png
--------------------------------------------------------------------------------
/demo/donate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RQLuo/MixTeX-Latex-OCR/845d0d75b5f55185ee088cf68dc57d5eb3d0f10b/demo/donate.png
--------------------------------------------------------------------------------
/demo/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RQLuo/MixTeX-Latex-OCR/845d0d75b5f55185ee088cf68dc57d5eb3d0f10b/demo/icon.png
--------------------------------------------------------------------------------
/demo/qq.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RQLuo/MixTeX-Latex-OCR/845d0d75b5f55185ee088cf68dc57d5eb3d0f10b/demo/qq.png
--------------------------------------------------------------------------------
/mixtex_data_gen/endata1.txt:
--------------------------------------------------------------------------------
1 | Introduction What do we index?
2 | MEDLINE indexers describe the content of biomedical articles by assigning subject terms to them. These subject terms are selected from the controlled vocabulary, Medical Subject Headings (MeSH). The MeSH terms assigned to an article appear on the bibliographic citation in PUBMED. They can be used in PUBMED searches and retrieval .
3 | The MeSH controlled vocabulary, developed at NLM, contains over 27,000 terms covering life sciences, medicine, as well as many other areas. MeSH vocabulary reflects the progress in biomedical sciences. Every year, several hundred new terms are added to the MeSH vocabulary, and some existing terms are modified. In addition to the MeSH descriptors, MEDLINE indexers also use 79 topical subheadings or qualifiers.
4 | A typical MeSH record (for MYOCARDIAL INFARCTION) is displayed below.
5 | A detailed explanation of MeSH records will follow later in this course.
6 | It is important to understand that ONLY terms listed in the MeSH vocabulary can be used for indexing. For example, an article about myocardial infarction is indexed with a single MeSH term MYOCARDIAL INFARCTION. However, an article about Mauriac syndrome cannot be indexed with the exact term, because Mauriac syndrome is not listed in the MeSH vocabulary. The indexer would need to find the closest MeSH term(s), which best describe this syndrome. It may be necessary to consult the Dorlands Medical Dictionary or another source.
7 | Last Reviewed January 17, 2020
8 | I have the honour of making this intervention on behalf of Denmark, Finland, Iceland, Norway and Sweden.
9 | Gender equality is sometimes perceived to be a soft optional extra A womens issue to be treated in separation from other more pressing and strategic concerns.
10 | It is not.
11 | Evidence shows that gender equality and empowerment of women are among the most effective ways of achieving sustainable peace and economic development.
12 | Gender equality is both the smart thing and the right thing to do.
13 | The human rights of women are indivisible.
14 | To attain gender equality, womens increased participation and influence in political, economic and social decisionmaking is fundamental.
15 | Gender based and sexual violence remains a very real obstacle to womens empowerment. Domestic violence is not a private issue but a block to societal development.
16 | The way to fully integrate a gender perspective in the work of the UN and of the Human Rights Council is to become detailed and operational.
17 | The Nordic countries believe there is a need for appointing more women as Special Rapporteurs and Independent Experts. We call for gender informed mandates and terms of reference. Reporting and analysis will be strengthened by disaggregation by gender. Where you get information from is key. Women as rights holders need to be systematically consulted. To track progress on, for instance, womens right to own property, to inherit, and to decent paid jobs we also need monitoring and evaluation. In this Council we should aim to have at least one representative of the underrepresented sex as speaker in panel discussions and events.
18 | The Human Rights Council and its Special Procedures cannot be treated in isolation.
19 | The entire UN system needs to intensify its efforts on gender equality. Men need to actively participate.
20 | For this to happen, training on gender should be mandatory for all UN staff, including specialized training for senior management. UN leaders and managers in the field should be required to meet with women's groups and civil society regularly and within the first weeks of their posting.
21 | Ultimately, gender equality means freedom for women and men. Because it allows the overall fulfillment of human potential beyond restricted and predetermined social roles.
22 | I thank you, Mr. President.
23 | Innovative Solutions To Challenges Around Sustainable Food System, Production And Supply
24 | Likhu 2, Nuwakot
25 | Nepal has 30 lakhs hectares of fertile land. 3.8 million families are engaged in agriculture. Still we rely on food imports. Nepal imported agricultural goods worth more than Rs.220 billion last fiscal year. With the breakdown in supply chain, and increasing reliance on import, prices of daily essentials have already begun to rise in the market. Nepal imported vegetables worth Rs.4 billion during the period of lockdown. Meanwhile food produced by farmers in other parts of Nepal is becoming waste. Tons of vegetables are being dumped. Disruption in the supply of farming inputs like fertilizers, seeds etc. are certain to impact food production.
26 | Private control on market system of agricultural products might be the one of the reason behind the import of tons of vegetables from foreign countries and dumping of local products. Those people who work to collect vegetables from farmers and supply it to consumers, so called vegetable suppliers get more profit by buying vegetables from foreign countries than by buying from local level. Due to expensive farm inputs, cost of productions is higher in Nepal. As a result price of vegetables farmers seek is higher. But for the same goods suppliers get it in lower price if they buy from foreign countries. So suppliers prefer import to local products. Its quite hard to find a person who think about public welfare than own benefits. Therefore private control over the supply of vegetables might be the root reason behind this scenario .
27 | Establishment of governmental market of vegetables will ultimately reduce the current situation and local vegetables will get better market. But for the sustainable food system, productions and supply, this governmental market will not be enough. Better and effective strategies for the development of agriculture sector is foremost. Government should take part in two way task supplying necessary inputs to farmers in affordable cost and collecting their products in reasonable price.
28 | In addition to this establishment of cold store or store house for vegetables is essential for better management of collected products. Storing of vegetables during surplus condition in cold store will helps to reduce the vegetables dumping due to lower demand and each production made by farmer will get reasonable price. This will attract more number of people in the sector of agriculture. And ultimately it directly aid to make national economy strong.
29 | Furthermore concept of green house farming, organic farming , hydroponics ,urban farming, etc., introduction of modern machinery, tools equipment, perform effective management practices such as mulching, drip irrigation, staking, etc. are needed to build up by government of Nepal.
30 | According to forest researcher Dr Sven Wunder, forest environmental services and conservation areas are generally divided into four categories carbon sequestration and storage, biodiversity protection, watershed protection, and landscape beauty.
31 | In terms of its landscape beauty, the Kehje Sewen Ecosystem Restoration Forest in East Kalimantan is way up there. It is one of our release forests, and throughout it, we have established several transects to use as orangutan patrol routes.
32 | Our teams hike along these transects almost every day to conduct orangutan patrols and phenology surveys and carry out security patrols to protect the forest from the threat of fire, encroachment, and poaching.
33 | Usually, our technicians and vets explore the forest on foot. Not all of these transects are accessible by fourwheeldrive vehicles, although we have occasionally used them to reach several points not too far from camp. As mentioned frequently in previous stories, the Kehje Sewen terrain comprises many hills and valleys, which makes it very challenging to explore. However, we also utilize the river as a means of transportation to reach certain forest areas.
34 | There are several transects which, due to their difficult terrain, are rarely used. One of them is Transect 39, which runs 1.6 kilometres, with a 525meter elevation difference between its lowest and highest points. Along the transect, our team members must work hard to climb a very steep incline continuously.
35 | The last time our team visited this transect was in February 2019. However, recently, a team made up of Veterinarian Patrick Flagellata and monitoring technicians Yunus and Kris returned to the transect.
36 | Due to infrequent traffic, the transect trail was overgrown with vegetation, forcing our team to stop and slash the wild plants and vines to pass through. Along the transect, they spotted three used orangutan nests and traces of food scraps. These findings indicated that orangutans had recently visited the transect and perhaps frequently saw orangutans passing through.
37 | After hours of walking, with three breaks, the trio finally reached the summit of Transect 39, at an altitude of 775 meters above sea level. However, their fatigue subsided once they set eyes on the breathtaking view from the top of the transect.
38 | Not wanting to get too caught up in the scenery, Patrick, Yunus, and Kris hurried back to Camp Nles Mamse, finally reaching it just before dark. They used boats to cover most of the distance to and from Transect 39 (12 kilometres from camp), which helped reduce travel time. Had they walked from camp, they would not have returned until long after dark.
39 | For those with an adventurous spirit, we hope our stories from the forest might inspire you or spark an interest in our work! So, watch out for more of our upcoming stories!
40 | Florence's Lingering Threat Mold
41 | THURSDAY, Sept. 20, 2018 (HealthDay News) In the aftermath of Hurricane Florence, residents of the Carolinas are facing a new health threat mold.
42 | Moldrelated illnesses are a serious concern following severe flooding in North and South Carolina, say experts from the University of Connecticut School of Medicine.
43 | "Where there's dampness and water, there's mold," said Paula Schenck, of the division of occupational and environmental medicine.
44 | "Mold is an indicator of a whole soup of biological material. Unhealthy exposure to these bioaerosols is very possible after a flood from a hurricane and especially during cleanup efforts 24 to 48 hours after the storm," she said in a university news release.
45 | Exposure to mold primarily affects the lungs and the skin, Schenck said. How you react to mold depends on the severity of your exposure. Some people may be more susceptible to moldrelated illnesses than others, including children and those with a weakened immune system, asthma or another chronic illness.
46 | Warning signs of moldrelated health issues include
47 | Nasal congestion and sneezing.
48 | Hoarse voice and throat irritation.
49 | Cough, wheezing, shortness of breath or chest tightness.
50 | Flareup of asthma symptoms.
51 | Respiratory symptoms.
52 | Extreme tiredness.
53 | These symptoms may not develop right away, Schenck noted. She advised doctors to be extra vigilant about educating their patients about mold risk following a storm or natural disaster.
54 | During a poststorm cleanup, the UConn experts advised the following
55 | Assume any areas exposed to water or flooding for more than 24 hours have mold even if it's not apparent.
56 | While cleaning mold, use an "N95" respirator that has bands to hold the mask close to the face. Dust and surgical masks will not protect against mold and mold spores. People at high risk for moldrelated illnesses should not attempt to personally clean up following a flood. If water damage covers more than 100squarefeet, seek professional help with the cleanup.
57 | Wear protective clothing. Cover the skin on the arms, hands, legs and feet while cleaning mold. Use long rubber gloves that extend to the middle of the forearm.
58 | Wear unvented goggles during mold cleanup to protect the eyes.
59 | Clean hard surfaces with soapy water. Avoid using bleach or other "fungicides" unless there is contamination from other flooded materials such as sewage. These harsh chemicals aren't more effective than soapy water and could cause or worsen lung irritation.
60 | Don't attempt to clean soft materials and porous surfaces like fabrics and wall board. Throw away these items.
61 | The U.S. Environmental Protection Agency offers more on hurricane safety and preparedness.
62 | The news stories provided in Health News and our HealthE News Newsletter are a service of the nationally syndicated HealthDay news and information company. Stories refer to national trends and breaking health news, and are not necessarily indicative of or always supported by our facility and providers. This information is provided for informational and educational purposes only, and is not intended to be a substitute for medical advice, diagnosis, or treatment.
63 | A high index of suspicion is required for patients who show signs and symptoms of drug abuse or dependency. A complete evaluation of the patient is necessary, including physical examination and laboratory investigations. The clinical diagnosis of the patient is facilitated by the presence of specific signs for example, nasal ulceration in cocaine abuse. Nevertheless, it is common for patients to have nonspecific complaints related to drug withdrawal. A wide range of signs and symptoms has been attributed to drug abuse, including constricted or dilated pupils, coarse voice, abnormal heart rate, enlarged liver, and collapsed veins.
64 | Diagnosis of drug abuse is largely dependent upon the identification of important clues from patient history. For example, these may include frequent road traffic accidents, workplace absences, episodes of domestic violence, chronic pain with no underlying cause, and a recent onset of seizures. The CAGE questionnaire is helpful in the diagnosis of alcohol dependence, and ideally, should be used to ensure the documentation of important information regarding alcohol dependency in a patient. It is also used as a screening tool to identify alcohol abuse and dependency. In terms of drug abuse, the Conjoint screening test is the tool of choice.
65 | Substance abuse, in general, can lead to neuromuscular symptoms such as tremors, seizures, and rigidity. Psychological symptoms include nervousness, anxiety, confusion, slurred speech, irritability, a staggering gait, and hallucinations. Psychological problems always arise with CNSacting drug abuse and confuse the clinical picture. The inspection of the body and clothes of patients can provide additional evidence regarding drug abuse, for example, an alcoholic odor in the persons breath, needle marks on their arms, residual cocaine around the names, and clothes that are stained with alcohol.
66 | Laboratory investigations should be suggested if a clinical suspicion arises. Laboratory tests do not have diagnostic accuracy in detecting drug abuse. A few tests can help in identifying patients with drug abuse and they can also give information about chronic intake of specific drugs. They are also of value for the detection of organ damage from chronic drug abuse. Blood samples can be taken to run drug toxicology screens and measure Mean Corpuscular Volume (MCV). The toxicology screens identify the pharmacological class of drugs.
67 | Drug metabolites are accurately detected in saliva and urine, therefore urine samples are useful in measuring hourly drug clearance. Positive findings in toxicology screens emphasize the need for confirmatory tests. Enzymemediated Immunoassay Technique (EMIT) is also used to confirm the presence of drugs in the bloodstream. In most cases, only metabolites of a particular drug are detected in significant quantities traces of parent drug or complete absence thereof can make interpretation difficult, as metabolites of two or more different drugs can be similar. False negatives are common and can be brought about by additional drugs taken for the sole purpose of elimination. These drugs act as a mask for the original drug being tested. Other tests, such as gammaglutamyl transpeptidase and carbohydratedeficient transferrin (CDT), have a role in identifying alcohol abuse.
68 | How to Propagate Snake Plant?
69 | Snake Plant, also known as Motherinlaw tongue, Snakes tongue, Devils tongue or Bowstring Hemp Plant is native to subtropical and tropical zones, but it also enjoys dry environments with less humidity.
70 | You can easily find this plant all across the world both indoors and outdoors, planted in pots or in the ground of gardens.
71 | Snake plants are not just easytogrow houseplants, they are also very easy to propagate. So in case you are a huge fan of this spikey plant, dont worry about buying more. Instead, learn how to propagate it properly.
72 | In this article, I am going to cover 3 propagation methods you can try. Also, I will take a closer look at the growing and fertilization needs of the Snake Plant.
73 | Rooting in Water
74 | One of the most convenient ways to propagate your Snake plant is by rooting in water. Heres the list of what you will need
75 | Scissors or knife
76 | Jar or a glass
77 | Rooting hormone (not a must)
78 | Now lets see the steps you should follow
79 | Use a sharp knife or scissors to cut off a leaf. Try to snip off the leaf as close to the soil as you can. In case you choose a larger leaf, you can cut it into sections and use each one to propagate your plant.
80 | At this point, you can use some rooting hormone to help the propagating process, but this step is optional.
81 | After you cut the leaf you want to propagate, place it in a glass or jar filled with water. Make sure that the water covers 25 of the leaf.
82 | Keep in mind that the Snake plant is highly polar. This means that it will grow roots only if the edge of the leaf that was close to the soil is placed in the water.
83 | Find a warm place for the jar with indirect sunlight and dont forget to change the water in the jar once a week.
84 | Propagating your Snake plant by rooting in water takes about two months or longer. After you noticed that the roots have developed, you can plant the cutting in soil.
85 | Another, actually faster way to propagate your Snake plant is by cuttings. Heres what you will need
86 | Knife or scissors
87 | Potting mixture, preferably succulent soil
88 | Optional rooting hormone
89 | Steps to follow
90 | Similarly, to the previous method, cut off a leaf near the soil with a sharp knife or scissors. You can cut the leaf into little pieces and use them separately to propagate your plant.
91 | In order to prevent bacteria from the soil getting into the freshly cut leaf, let the leaves out for a few days until they begin to callous over.
92 | Keep in mind that the Snake plant is polar, so make sure you place the leaves correctly into the soil.
93 | Before digging the cuttings in the soil, you can use some root hormone, but this step is optional.
94 | Place the part of the cuttings that was closest to the bottom of the original plant into succulent soil or any welldrained mixture.
95 | It takes about a month until the cuttings develop roots and another one until they sprout new growth.
96 | In case you dont want to wait months to have more Snake plants in your garden or house, you can also try propagating your plant by division.
97 | All you will need is the following
98 | A sharp knife of a handsaw
99 | Potting mixture
100 | Now lets see the steps of propagating your Snake plant by division
101 | Gently take your plant out of its pot.
102 | Once it is out, find the rhizomes, this is where you will cut the plant. In case your plant is small, dont aim for too many pieces, try to separate it in half instead. If your plant is larger, you can divide it into more pieces.
103 | Cut your plant with a sharp knife or handsaw. Make sure each section has at least 3 rhizomes, a few roots and one healthy leaf.
104 | Fill the pots with goodquality, welldrained potting mixture and repot each plant.
105 | Water the freshly divided plants, then wait until the soil dries out before you water it again.
106 | With this propagation method, it does not take a lot of time for you to be able to enjoy the beauty of your Snake plant. You can immediately place it in your house or garden where it gets a lot of warm, indirect sunlight.
107 | How Long Does it Take New Snake Plants to Grow?
108 | As you could see, depending on the method you choose, it can take a lot of time for your plant to develop after propagation.
109 | Snake plants are considered slow growing plants, sometimes they even need months to show growth.
110 | Usually it takes 68 weeks for Snake plants to grow roots. Depending on the environment they are placed in, it might take another 23 months to grow stronger, solid roots.
111 | My advice is to be patient and dont be discouraged by the lack of results during this time.
112 | Should I Fertilize Snake Plant Cuttings?
113 | Snake plants dont require fertilization, but you can use some fertilizer to help them grow faster. Use a basic houseplant fertilizer in the spring or summer and make sure to give a good soaking every 2 weeks and let the soil dry out between.
114 | How to Make Your Snake Plants Grow Faster?
115 | Undoubtedly, Snake plants grow slowly, but usually that doesnt mean that there is anything wrong with your plant you should worry about.
116 | However, sometimes you can try to do some things to boost the growing process and make your Snake plant grow faster.
117 | Here are some tricks and tips you should consider
118 | To help the rooting process, you can dig the leaves into root hormones before placing them into water or soil.
119 | You can change the environment of the plant. If your plant is not growing fast enough, it could be because of lack of light or low temperature.
120 | You can also change the soil to give growth a boost.
121 | Make sure you water your plant correctly. Underwatering can slow down the growing process.
122 | As mentioned above, you can use fertilization to help your plant grow faster.
123 | The realm of semiconductor testing, the selection of the right tools is paramount for achieving accurate and reliable results. One such crucial tool is the probe card holder, an essential component in semiconductor testing setups. The various applications of Probe Card Holders delve into the key features that one must consider when selecting the right holder for specific testing applications.
124 | What is a Probe Card Holder?
125 | A probe card holder is a device designed to securely hold and interface with a probe card during semiconductor testing. The probe card itself is a critical component in testing semiconductor wafers, as it contains a set of probes or needles that make electrical contact with the pads on the semiconductor device under test (DUT).
126 | The probe card holder serves as a bridge between the probe card and the testing equipment, ensuring stability and precise alignment. It plays a pivotal role in maintaining the integrity of the testing process and safeguarding the delicate probes.
127 | Applications of Probe Card Holders
128 | Probe cardholders find applications across various industries, contributing to the reliability and efficiency of semiconductor testing. Lets explore some key applications
129 | 1. Semiconductor Wafer Testing
130 | The primary application of probe card holders is in semiconductor wafer testing. During this process, a probe card holder secures the probe card in place while it makes contact with the semiconductor wafer. This is a critical step in identifying defects, ensuring the functionality of the semiconductor devices, and adhering to quality control standards.
131 | 2. IC Package Testing
132 | In the testing of integrated circuit (IC) packages, probe card holders facilitate precise contact between the probe card and the IC package. This is crucial for verifying the functionality and performance of the packaged ICs before they are integrated into electronic devices.
133 | 3. MEMS Testing
134 | Microelectromechanical systems (MEMS) require specialized testing due to their unique characteristics and applications. Probe card holders are used in MEMS testing setups to establish reliable electrical contact with these miniature devices, ensuring accurate performance assessments.
135 | 4. RF and Microwave Testing
136 | For semiconductor devices operating in radio frequency (RF) and microwave ranges, precision in testing is paramount. Probe card holders designed for RF and microwave testing applications enable accurate measurements, ensuring that the devices meet the required specifications for frequency, power, and signal integrity.
137 | 5. Power Device Testing
138 | Power semiconductor devices, such as MOSFETs and IGBTs, demand specialized testing setups. Probe card holders in power device testing applications provide the necessary stability and electrical contact for evaluating the performance and reliability of these highpower components.
139 | Key Features To Consider
140 | Selecting the right probe card holder for specific testing applications requires careful consideration of various features. Here are the key features to keep in mind
141 | Material and Construction
142 | The material of the probe card holder significantly influences its durability and performance. Highquality materials, such as stainless steel or ceramic, are preferred for their resistance to corrosion and wear. The construction should also provide stability and precision in holding the probe card during testing.
143 | Thermal Stability
144 | In testing applications where temperature variations are common, thermal stability becomes a critical factor. A probe card holder with excellent thermal stability ensures that the alignment and contact between the probe card and the DUT remain consistent, even in varying temperature conditions.
145 | Different testing applications may require specific probe card configurations. Its essential to choose a probe card holder that is compatible with the probe card design and size relevant to your testing needs. This includes considerations for the number of probes, pitch, and overall dimensions.
146 | Precision Alignment
147 | Achieving precise alignment between the probe card and the semiconductor device under test is crucial for accurate testing results. Look for Probe Card Holders that offer finetuning capabilities for alignment, ensuring that the probes make accurate and reliable contact with the test points.
148 | Electrical Performance
149 | The electrical performance of the probe card holder directly impacts the quality of the test measurements. Lowcontact resistance, high signal integrity, and minimal signal loss are essential characteristics to consider. A welldesigned probe card holder will provide consistent and reliable electrical contact throughout the testing process.
150 | Easy Maintenance and Replacement
151 | As with any testing equipment, maintenance, and occasional replacement are inevitable. Opt for a probe card holder that facilitates easy maintenance, allowing for quick disassembly and reassembly. This feature ensures minimal downtime during testing processes.
152 | Customization Options
153 | Every testing setup is unique, and customization may be necessary to meet specific requirements. Choose a probe card holder that offers customization options, such as interchangeable components or adjustable features, to adapt to the specific needs of your testing applications.
154 | The dynamic landscape of semiconductor testing, the role of a probe card holder cannot be overstated. The right choice of a Probe Cardholder is crucial for achieving precision, reliability, and efficiency in various testing applications, from semiconductor wafer testing to RF and microwave testing. By understanding the applications and key features discussed in this guide, you can make an informed decision when selecting a probe card holder for your specific testing needs. Whether you are working with MEMS, power devices, or IC packages, the right probe card holders will contribute to the success of your testing processes, ensuring the quality and functionality of semiconductor devices in diverse applications.
155 | Pottery has been a popular art form for thousands of years, and it is still widely practiced today. There are two main techniques used to create pottery hand building and throwing on a wheel. Both methods have their advantages and disadvantages, and whether it is better to hand build pottery or use the throwing wheel depends on the individual artist's preferences and goals.
156 | Hand building is the oldest technique of creating pottery, and it involves shaping clay by hand. This method is popular among artists who prefer to work slowly and methodically, creating each piece with care and precision. Hand building allows for a wide range of shapes and designs, and it is wellsuited for creating complex and intricate patterns.
157 | One of the advantages of hand building is that it does not require any specialized equipment or tools. All that is needed is clay, water, and a few basic tools, such as a rolling pin, a knife, and a paddle. This makes hand building a more accessible technique for artists who do not have access to a throwing wheel or who prefer to work with minimal equipment.
158 | Another advantage of hand building is that it allows the artist to create a unique and distinctive style. Because each piece is made by hand, no two pieces are exactly alike. This can be a selling point for artists who specialize in handmade, oneofakind pieces.
159 | However, hand building also has its disadvantages. One of the biggest drawbacks is that it is a timeconsuming process. It can take several hours or even days to create a single piece by hand, depending on the size and complexity of the design. This can make it difficult for artists who need to produce large quantities of pottery quickly.
160 | Throwing on a wheel, on the other hand, is a faster and more efficient method of creating pottery. This technique involves spinning a lump of clay on a rotating wheel while shaping it with the hands and various tools. Throwing allows for a more uniform shape and size, which can be important for artists who need to produce consistent pieces for sale or display.
161 | Another advantage of throwing on a wheel is that it allows the artist to create more intricate and delicate designs. The centrifugal force of the spinning wheel helps to shape the clay, allowing for finer details and smoother surfaces.
162 | However, throwing on a wheel also has its disadvantages. It requires specialized equipment, such as a throwing wheel and various tools, which can be expensive and take up a lot of space. It also requires more skill and practice than hand building, which can be daunting for beginners.
163 | In conclusion, whether it is better to hand build pottery or use the throwing wheel depends on the individual artist's preferences and goals. Hand building is a slower but more accessible technique that allows for a wider range of shapes and designs. Throwing on a wheel is a faster and more efficient technique that allows for more uniform shapes and intricate designs but requires more skill and specialized equipment. Ultimately, the choice of technique should be based on the artist's artistic vision, personal preferences, and resources available.
164 | Accuracy vs Precision Unveiling the Key Distinctions in Quality Management
165 | While evaluating the results after taking data measurements, you need to bear in mind two significant concepts that are accuracy and precision. Your data set might be close to an accepted value or it might be completely different from an anticipated result. So how can you point out if the measurements are close to the target or not? The main difference between accuracy and precision is that accuracy indicates how your measurement is close to a specific value, while precision shows how measurements are close to each other in a cluster. Here we will discuss the topic of accuracy vs precision with examples to show you how to use both concepts in project quality management.
166 | Table of Contents
167 | Accuracy and Precision
168 | Before to start, lets take a glance at the image below.
169 | Assume that you played dart with your friends. You and your friend hit the target shown in the images above. The image on the above left demonstrates a high degree of accuracy, but low precision. On the other hand, the image on the above right demonstrates high precision, but low accuracy.
170 | For better understanding, lets analyze the image below
171 | Your measurements are close to each other but they are far from the target value. This shows high precision but low accuracy.
172 | Your measurements are close to each other and they are on the target value. This shows high precision and high accuracy.
173 | Your measurements are far from each other and they are far from the target value. This shows low precision and low accuracy.
174 | Your measurements are far from each other but they are close to the target value. This shows low precision but high accuracy.
175 | What is Accuracy?
176 | The below figure shows that the closeness of a measurement to the true value is Accuracy while the closeness of agreement among a set of results shows precision.
177 | Accuracy means the values gathered from repeated measurements are close to the target. If all the measurements are accurate, this means that they are close to the target and they may be or may not be close to each other.
178 | For instance, you are working as a technician in a laboratory. You measured the weight of a given substance which was 4 kg. However, the known or actual weight of it must be 20 kg. You can easily say that your measurement is not accurate because is not close to the known value.
179 | What is Precision?
180 | Precision means the values gathered from repeated measurements are close to each other in a cluster. They have little scatter.
181 | If all the measurements very precise, it means that the measurements are close to each other and they may be or may not be close to the target. When the scatter is less, measurements have high precision.
182 | Considering the same example above, you measured the weight of a given substance three times and you listed the results
183 | Measurement 1 3.9 kg
184 | Measurement 2 4.4 kg
185 | Measurement 3 5 kg
186 | You can easily say that your measurement is very precise. However, it is not accurate. Precision is not dependent on accuracy. You can be precise but not accurate vice versa you can be accurate but not precise.
187 | Accuracy and Precision Example
188 | Assume that you are a quality manager of a pipeline construction project. The warehouse received 1000 pipes from the supplier. According to the technical specifications, the thickness of each pipe must be 30 millimeters. In order to make an inspection, you randomly take the thickness measurements of five pipes.
189 | First pipe 30.50 mm
190 | Second pipe 30.55 mm
191 | Third pipe 30.58 mm
192 | Fourth pipe 30.45 mm
193 | Fifth pipe 30.47 mm
194 | The inspection result shows that the measured values are precise but not accurate. Because all the measurements are close to each other but they are not close to the desired value of 30 millimeters.
195 | Below is another measurement for the same batch. You randomly take the thickness measurements of five pipes.
196 | First pipe 29.90 mm
197 | Second pipe 29.85 mm
198 | Third pipe 30.10 mm
199 | Fourth pipe 30.15 mm
200 | Fifth pipe 29.87 mm
201 | This simple example shows that the measured values are accurate but not precise. Because all the measurements are close to the desired value of 30 millimeters but they are not close to each other.
202 | What is the Difference Between Accuracy and Precision?
203 | Accurate measurements must be close to the target value. However precise measurements must be close to each other. They dont have to be close to the target value.
204 | Accuracy is desired for quality purposes.
205 | Precision is not dependent on accuracy. Therefore they may not be close to the target.
206 | Many measurements are required to decide precision. However, you need fewer measurements to decide accuracy. In most cases, accuracy can be determined by one measurement.
207 | Precision can be conceivable as the degree of reproducibility between repeated measurements.
208 | Accuracy and Precision are two different terms in project quality management and both of them refer to quality measurements. They are widely used in math, science, engineering, and project management to analyze data sets. Precision states that the measurements are consistent with very little variation and Accuracy states that the measurements are close to the desired value and they are correct. A Precise measurement does not mean accurate and an accurate measurement does not mean precise.
209 | In this article, we discuss the concept of accuracy vs precision in quality management and show how to calculate them with examples. We hope that all the points are clear and it will be useful to understand their importance for quality management purposes. If you would like to share your knowledge or add something, you can do so through the comments section below.
210 | Please note that these terms are also very important from a PMP Certification Exam point of view therefore, you must know the definition of these concepts and understand the difference between them.
211 | Since 2004 I work for ICT Management which provides worldwide quality management service. Passionate about new technologies, i have the privilege to implement many new systems and applications for different departements of my company. I have Six Sigma Green Belt.
212 | This Battle, a set piece attack by the Eight Army, ended with the rout of the GermanItalian forces and was the turning point of the war in North Africa.
213 | The Honour is borne on the Guidon of the 3rd Hussars.
214 | In the first phase of El Alamein, the 3rd Hussars helped break through Rommels defences but in the second phase, it was given the crucial task of forcing a gap through the remaining defences to enable the armoured reserves to breakthrough.
215 | At the time of the Battle of El Alamein, the main threat to tanks was the antitank gun.
216 | There is no better illustration of the struggle between the tank and an antitank gun than the attack of the 3rd Hussars on the Afrika Korps 88mm gun line at the Battle of El Alamein.
217 | Silhouetted against the rising sun the 3rd Hussars had many tanks hit but gradually the surviving tanks, using their high explosive 75mm shells and their machine guns got the upper hand over the unprotected German antitank guns.
218 | The courage and discipline of the Hussars in the face of horrendous odds were outstanding. On hearing the plan for the attack, their Commanding Officer, Sir Peter Farquhar Bt. exclaimed,
219 | This is just suicide for my Regiment! Montgomery replied, Its got to be done and, if necessary, I am prepared to accept 100 casualties in both personnel and tanks.
220 | After this Sir Peter remarked, There was, of course, no more to be said.
221 | In the event the Regiment fulfilled their task of breaking through but, in the whole battle, had 47 of their 51 tanks destroyed.
222 | Their casualties were horrific with 21 Officers and 90 Other Ranks killed, wounded or missing over 80 of the tank crews.
223 | So devastated was the Regiment that it was unable to join the pursuit. General Freyburg granted The 3rd Hussars the honour of wearing the Fern Leaf on their vehicles because of their participation with the New Zealand Division during the battle.
224 | Leak testing plays an important role in todays manufacturing environment by ensuring the quality and performance of a product. A critical portion of the leak testing process is sealing the part for pressure or vacuum testing however, this step is given little attention. And all too often, this is the Achilles heel of a poorly conceived leak test process.
225 | Historically, manufacturers relied on wrenching and sealants or the use of juryrigged clamping fixtures to seal a thread, a tube or a cavity. This is an inefficient, timeconsuming process that may damage the product. While this damage may not be immediately evident, it could stress the part that may cause leaks down the road when it is put into customers use. Additionally, there are ergonomic concerns with wrenching or other manual clamping associated with this process.
226 | While there are many sealing misconceptions, this article will focus on three common misconceptions or methods that result with a poor sealing practice, identify the issues associated with the practice, and recommend a better method of sealing.
227 | Misconception 1 Sealing a threaded port or fitting. Ill just use pipe dope.
228 | For taper threads, commonly known as NPT or BSPT, using a thread sealant is the proper method to make the connection when installing the product for final use. These threads are common in the appliance, plumbing, compressed air and lowpressure hydraulics. The misconception is that using a common taper fitting and thread sealant (they call it pipe dope for a reason) is a good method (practice) to seal the port for a leak or pressure test. On the positive side, this is how these threads are designed to mate and create a leak tight connection. On the negative side, this creates three issues
229 | To make the seal, the mating threads must be torqued tight, thus crushing the threads against one another. This condition deforms the thread, causing the thread to gauge differently than when it was newly machined. This creates a used part!
230 | Thread sealant must be used as a lubricant to reduce galling and as a sealing agent to eliminate spiral leakage. Sealant removal and cleaning the threads is messy and time consuming.
231 | Ergonomic concerns. Wrenching and torqueing a fitting tight in a production environment can cause severe operator stress leading to worker compensation.
232 | Alternatively, a better method is to apply one of several manual sealing devices on the market that are easily twisted or instantly connected to a threaded port or fitting with no wrench tightening or thread sealants. These products greatly improve the testing process, significantly reduce ergonomic issues associated with wrench tightening a fitting and leave the product in new condition. The features that make these products function include
233 | The connectors are not torqued tight into the port, thus there is no thread damage.
234 | The fittings use a feature called pressure assisted sealing, eliminating the need for messy thread sealants.
235 | Since the connection requires no torqueing, it greatly reduces any ergonomic concerns.
236 | Misconception 2 Sealing a port. A pad seal will be just fine.
237 | Cast and plastic components can be a challenging sealing issue. Many times a pad style seal seems to be the best option. This method is simple and seemingly low cost to implement, and it generally can be done quickly. However, this option does create two main issues
238 | Sizing the clamp fixture? Pad seals are a face seal, which require a high compressive force to be effective. This compressive force is a calculated guess, roughly based on sealing diameter, test pressure and an X factor tossed in to be extra safe. To ensure the guess is not wrong, manufacturers that use this method generally oversize the clamping fixture that holds the pad seal and tested component from separating during the test. This practice of oversizing fixture components adds size, weight and cost to the test fixture. Oversizing the clamp fixture also increases the wearing of the pad seal, thus requiring frequent maintenance.
239 | High clamp force can deform or stress the component beyond its design criteria. It may mask leaks by forcing the defect closed.
240 | A better method is to utilize a sealing device that either compresses a dynamic seal to the OD or ID, but not the face. The key feature to these sealing devices is that they are pneumatically operated, which compresses the seal to a specific location independent of the clamping fixture. By sealing specifically to the ID or OD, this eliminates oversizing the clamping fixture. The fixture is sized to resist the separation force of the test.
241 | Misconception 3 The test medium (helium) really doesnt matter when selecting seal materials and sealing methods.
242 | Knowledge of seal materials and sealing methods is critical to obtain the expected results, which include passing good parts and identifying defective parts in a production environment. A common misconception is the notion that a specific material, like fluorocarbon, and high durometer, such as a 70 or 80 durometer, is best when using helium as a tracer leak gas. This may be trueusing this materialas a gasket and clamping flanges together to limit helium saturating the seal, but with typical production testing the sealing action is created and released many hundreds or thousands of times. The seal material needs to be flexible and conforming to achieve these cycle requirements.
243 | Testing time is rarely long enough to achieve saturation (for instance with 40 durometer neoprene). A critical concern is migration of helium around the seal material and the part being tested. Helium molecules are three times smaller than air or nitrogen, so it is important to reduce the migration of helium to an acceptable level by filling surface imperfections using a flexible seal and high compressive force onto the seal material. As a general statement, neoprene fills the bill very well however, critics will point out that neoprene is too porous.
244 | For example, neoprene can be compared to a sponge. Sponges are porous and effective at drawing in water, unless it is compressed (squeezed). A compressed sponge soaks up very little water. This is also true with sealing materials. Compressing neoprene reduces its ability to draw in helium, but it still has the flexibility to seal surface imperfections. If a part is cast, it may require a thicker 40 or 50 durometer neoprene. If a part is smooth tubing, it may only need a 60 or 70 durometer oring style seal. It is a better option to select sealing devices that are helium rated, as these devices are designed to apply a high compressive force. Like squeezing a sponge!
245 | Closing thoughts Selecting the Best Sealing Solution
246 | When selecting connection tooling and sealing methods, it is important to consider
247 | Select connection tools that do not deform or damage the part.
248 | Select connection tooling and methods that do not add undue compressive force to the part. Avoid the practice of sandwiching parts between two clamps.
249 | Select connection tooling and methods in which the part is sealed in the same or similar manner as if it would when installed.
250 | Select connection tooling that is durable, reliable and repeatable.
251 | Select connection tooling that is easily maintained, and meets the production requirements.
252 | Using strong passwords is a critical part of keeping your network protected. For years we have been preaching the need to use complex passwords, along with the need to use different passwords for different accounts. As the technology of crackers (not the salted kind) improves, the need to be diligent about password security intensifies.
253 | To help you understand why strong passwords are so important, we want to showcase how hackers are gaining a technological edge. One common misconception is that hackers are sitting in a dark room with a laptop entering passwords one at a time. While this might be how we attempt to hack a friends Facebook account, real hackers have developed much more efficient ways of getting the job done.
254 | Hackers have special programs designed to use several passwords at once. Several passwords is actually an understatement, using their special hacking software the amount of words a hacker can try out is only limited by the amount of processing power running on their computer. Thanks to the everincreasing demands of graphic processors, the passwordcracking programs can run thousands of times faster than they were able to just a decade ago.
255 | Using a single graphics processor like a high performance AMD Radeon HD7970, along with an advanced passwordcracking algorithm, a hacker can try 8.2 billion password combinations per second. That is billion with a B, and second with an S. Keep in mind this is just one computer with one processor, the more resources a hacker has available, the more damage they can do. In fact, take a PC and equip it with two or more GPUs at just a few hundred dollars apiece, and the hacking speeds will increase by two to three times (which would be 16.424.6 billion passwords combinations per second for those of you at home keeping score).
256 | Hackers have also taken advantage of social networking tools and have formed their own online hacking communities. Using forums, hackers like to pool their knowledge and resources. One resource hackers like to share is lists of passwords successfully ripped off from data breaches. By sharing these lists, hackers gain an insight into what are the actual passwords that people use and then adjust their algorithms accordingly.
257 | The more that hackers network and collaborate, the more organized they become and the more damage they can do. With hackers, there is power in numbers it has been estimated that it only takes a few hackers working together to crack a list of 100,000 accounts with nominalaverage security in just a couple of hours.
258 | The technological and networking advancements of hackers sound like bad news for people of the Internet. Fortunately for you, hackers still primarily target accounts with weak security. Implementing best network security practices along with security solutions is still a great way to stay one step ahead of the hackers.
259 | As far as hackers have come over the past decade, we at Quikteks have also grown in our capabilities with our security solutions. Our best defense against hackers is our Unified Threat Management (UTM) tool that covers all of your network security bases, but even with a UTM, you will still want to educate yourself and your employees on best practices like how to make a complicated password that will ward off hackers. To learn more about UTM and best practices with password security, call Quikteks at PHONENUMBER.
260 | Following the announcement of the postponement of the 12th board exams and the cancellation of the 10th board exams, the CBSE board has decided to put more emphasis on competencybased education (CBE).
261 | The board is introducing changes in the 9th to 12th class examination and assessment practices for the session 202122. While overall marks and exam duration will remain the same, more competencybased questions that assess the application of concepts in reallife situations will be part of the examination.
262 | Last year, the board decided to implement a competencybased education system for the development of practical and life skills among students rather than just depending upon textbookbased education. The board informed about this on 14 May via a circular.
263 | What is CBE (CompetencyBased Education)?
264 | Competencybased learning (CBL) or Competencybased education (CBE) is an outcomebased approach to education to ensure proficiency in learning by students through demonstration of the knowledge, skills, values, and attitudes required for dealing with reallife situations at the age and gradeappropriate level.
265 | Changes for Class 11 and 12
266 | According to the revised pattern for Class 11 and 12, there will be 20 percent competencybased questions and 20 percent objectivetype questions. Competencybased questions can be in the form of MCQs (multiplechoice questions), casebased questions, sourcebased integrated questions, or any other form.
267 | As per the current scheme, 70 percent of the questions are of short long answer type, but now it will be reduced to 60 percent.
268 |
--------------------------------------------------------------------------------
/mixtex_data_gen/formular.tex:
--------------------------------------------------------------------------------
1 | \begin{align*}{\equiv} = \bigcap_{U \in \mathcal{U}}U.\end{align*}
2 | \begin{align*}\eta(x) = \bigcap_{U \in \mathcal{U}} U(x).\end{align*}
3 | \begin{align*}U_x = \smashoperator[r]{\bigcap_{\substack{U \\ x \in U}}} \enspace U = \smashoperator[r]{\bigcap_{U \in \mathcal N(x)}} \enspace U,\end{align*}
4 | \begin{align*}\bigcap_{\substack{U \in \tau \\ x \in U}} \eta^\rightarrow(U) = \smashoperator[r]{\bigcap_{\substack{V \in \tau_{\equiv} \\ \eta(x) \in V}}} \enspace V = U_{\eta(x)}.\end{align*}
5 | \begin{align*}\eta^\rightarrow(U_x) = \eta^\rightarrow\left(\bigcap_{\substack{U \in \tau \\ x \in U}} U\right) \subseteq \bigcap_{\substack{U \in \tau \\ x \in U}} \eta^\rightarrow(U) = U_{\eta(x)}.\end{align*}
6 | \begin{align*} U_{\pi(x)} = U_x.\end{align*}
7 | \begin{align*}F(x,t) =\begin{cases}x& 0 \leq t < 1, \\\pi(x) & t = 1.\end{cases}\end{align*}
8 | \begin{align*} V = V_1 \oplus \ldots \oplus V_k\end{align*}
9 | \begin{align*} \mathfrak h^\perp = \mathfrak p_u \oplus (\mathfrak d^\perp \cap \mathfrak c) \oplus (\mathfrak h^\perp \cap \mathfrak p^+_u).\end{align*}
10 | \begin{align*}\widetilde{a}_{\mu, \nu}=\sum_{\mu^{\prime}, \nu^{\prime}}a_{\mu^{\prime}, \nu^{\prime}} R(\mu^{\prime}- \mu, \nu^{\prime}- \nu). \end{align*}
11 | \begin{align*} \mathfrak u = \bigoplus\limits_{\Omega \in \widetilde \Psi} \mathfrak u(\Omega)\end{align*}
12 | \begin{align*} \mathfrak h^\perp = \mathfrak p_u \oplus (\mathfrak d^\perp \cap \mathfrak c) \oplus \bigoplus\limits_{\Omega \in \widetilde \Psi} \mathfrak u(\Omega).\end{align*}
13 | \begin{align*} \mathfrak h_\infty^\perp = \mathfrak p_u \oplus (\mathfrak d^\perp \cap \mathfrak c) \oplus \bigoplus\limits_{\Omega \in \widetilde \Psi} \mathfrak u_\infty(\Omega)\end{align*}
14 | \begin{align*} \mathfrak h^\perp = \mathfrak p_u \oplus \bigoplus \limits_{\mu \in \Psi} \mathfrak g(\mu).\end{align*}
15 | \begin{align*} \mathfrak g = (h_\delta^\perp \cap \mathfrak t) \oplus \bigoplus \limits_{\alpha \in Y(\delta)} V(\alpha).\end{align*}
16 | \begin{align*} \mathfrak h^\perp = \bigoplus \limits_{\alpha \in Y(\delta)} (\mathfrak h^\perp \cap V(\alpha)).\end{align*}
17 | \begin{align*} \Psi = \Psi_1 \cup \ldots \cup \Psi_p\end{align*}
18 | \begin{align*} \sum \limits_{\mu \in \Psi_i} a_\mu \widehat \mu_* + \rho_i = \sigma = \sum \limits_{\nu \in \Psi_j} b_\nu \widehat \nu_* + \rho_j\end{align*}
19 | \begin{gather*}\Psi_i^+ = \lbrace \mu \in \Psi_i \mid a_\mu > 0 \rbrace, \Psi_i^- = \lbrace \mu \in \Psi_i \mid a_\mu < 0 \rbrace, \\\Psi_j^+ = \lbrace \nu \in \Psi_j \mid b_\nu > 0 \rbrace, \Psi_j^- = \lbrace \nu \in \Psi_j \mid b_\nu < 0 \rbrace\end{gather*}
20 | \begin{align*} \Sigma_G(G/N_1) = \lbrace \alpha_2, \alpha_3 \rbrace \ \ \Sigma_G(G/N_2) = \lbrace \alpha_1, \alpha_2 \rbrace.\end{align*}
21 | \begin{align*}R(\alpha, \beta) = \begin{cases}1 & \;\; (\alpha, \beta)=(0,0)\\0 & \;\; (\alpha, \beta)\neq (0,0). \end{cases}\end{align*}
22 | \begin{align*}\bigcup_{\{j:1\leq j\leq m,\,j\ne i\}}D(B_i,B_j)=\lambda_i \boxtimes (G\backslash \{0\}),\end{align*}
23 | \begin{align*}\bigcup_{\{i\,:\,|B_i|=w_t\}}\bigcup_{\{j:1\leq j\leq m,\,j\ne i\}}D(B_i,B_j)=\lambda_t \boxtimes (G\backslash \{0\}),\end{align*}
24 | \begin{align*}\left|\bigcup\limits_{1\leq i\ne j\leq m}D(B_i,\widetilde{B}_j)\right|=\sum\limits_{1\leq i\leq m}\sum\limits_{1\leq j\leq m\atop j\ne i}\sum_{b\in B_i}|D(\{b\},\widetilde{B}_j)|=\sum\limits_{1\leq i\leq m}\sum\limits_{1\leq j\leq m\atop j\ne i}\sum_{b\in B_i}\widetilde{k}=\widetilde{k}a(m-1).\end{align*}
25 | \begin{align*}\rho_{(n,m,a)}=\min_{K'}\left\{\frac{\lambda'}{\widetilde{k'}m}\,:\,\exists\, (n,m,K',a,\lambda')\, s.t.\, \sum_{1\leq i\leq m}k'_i=a\right\}.\end{align*}
26 | \begin{align*}D^{2}_i=\{\alpha^{i+2j}\,:\,0\leq j\leq 2k-1\},\,\,\,\,i=0,1\end{align*}
27 | \begin{align*}D^{4}_i=\{\alpha^{i+4j}\,:\,0\leq j\leq k-1\},\,\,\,\,0\leq i\leq 3.\end{align*}
28 | \begin{align*}\left[ \widehat{q}_1,\widehat{p}_1 \right]=\left[ \widehat{q}_2,\widehat{p}_2 \right]=i,\end{align*}
29 | \begin{align*}\left[ \widehat{q}_1,\widehat{p}_1 \right]=\left[ \widehat{q}_2,\widehat{p}_2 \right]=i, \left[ \widehat{q}_1,\widehat{q}_2 \right]= i \theta, \left[ \widehat{p}_1,\widehat{p}_2 \right]= i \eta,\end{align*}
30 | \begin{align*}\left(\widehat{p}_1^2-\widehat{p}_2^2 -48 e^{-2 \sqrt{3}\widehat{q}_2}\right) \psi=0.\end{align*}
31 | \begin{align*}\widehat{q}_1=x_1, \widehat{q}_2=x_2 , \widehat{p}_1= -i \frac{\partial}{\partial x_1} , \widehat{p}_2= -i \frac{\partial}{\partial x_2},\end{align*}
32 | \begin{align*}\widetilde{\phi} (x) = \phi (x) + \phi (x-1). \end{align*}
33 | \begin{align*}\left(\frac{\partial^2}{\partial x_2^2} - \frac{\partial^2}{\partial x_1^2} -48 e^{-2 \sqrt{3} x_2} \right) \psi(x_1,x_2)=0,\end{align*}
34 | \begin{align*}\psi(x_1,x_2) =\psi_{\nu}^{\pm} (x_1,x_2)=e^{\pm i \nu \sqrt{3}x_1}K_{i \nu}\left(4e^{- \sqrt{3}x_2}\right),\end{align*}
35 | \begin{align*}\begin{array}{c}\left\{ \left(i \mu \frac{\partial}{\partial x_1} + \frac{\eta x_2}{2 \mu} \right)^2 -\left(i \mu \frac{\partial}{\partial x_2} - \frac{\eta x_1}{2 \mu} \right)^2\right.\\ \\ \left. -48 \exp \left[ -2 \sqrt{3} \left(\lambda x_2 + \frac{i \theta}{2 \lambda}\frac{\partial}{\partial x_1} \right) \right]\right\} \psi(x_1,x_2)=0\end{array}\end{align*}
36 | \begin{align*} \psi_a(x_1,x_2)= \mathcal{R}_a (x_2)\exp \left[ \frac{i x_1}{\mu} \left(a-\frac{\eta}{2 \mu} x_2 \right) \right],\end{align*}
37 | \begin{align*}\begin{array}{c}V(x)=-(\eta x-a)^2-F^2\mu^4x^4-2 F \mu^2 (\eta x-a)x^2+\\\\+48 \exp \left(-2 \sqrt{3} x-2 \sqrt{3} \mu^2Ex^2+ \frac{\sqrt{3} \theta a}{\mu \lambda} \right),\end{array}\end{align*}
38 | \begin{align*}\widetilde{f} (\xi) := (2 \pi )^{- d/2} \int_{\mathbb{R}^d} f(x) e^{- i x \cdot \xi} dx.\end{align*}
39 | \begin{align*}\mathcal{F} f( \omega) := \int_{\mathbb{R}^d} f(t) e^{-2 \pi i t \cdot \omega} dt\end{align*}
40 | \begin{align*}E(\mu)=-\int_{\mathbb{R}} \mu(x) \log \left(\mu(x) \right) dx,\end{align*}
41 | \begin{align*}(\widehat{A} -a \widehat{I}) f = i c (\widehat{B} -b \widehat{I}) f\end{align*}
42 | \begin{align*}\begin{array}{l}\Delta_x (f,a)= \|(\widehat{x} -a \widehat{I}) f \|_{L^2 (\mathbb{R})} = \left(\int_{\mathbb{R}} (x-a)^2 | f (x)|^2 dx \right)^{\frac{1}{2}}\\\\\Delta_{\xi} (f,b)= \|(\widehat{\xi} -b \widehat{I}) f \|_{L^2 (\mathbb{R})} = \left(\int_{\mathbb{R}} (\xi-b)^2 | \widetilde{f} (\xi)|^2 d \xi . \right)^{\frac{1}{2}}\end{array}\end{align*}
43 | \begin{align*}\begin{aligned} = \!{\sigma Loc}_\sigma &\simeq \!{QPol} := , \\ = \!{\sigma BorLoc}_\sigma &\simeq \!{SBor} := .\end{aligned}\end{align*}
44 | \begin{align*}\begin{array}{l}_f= \langle \widehat{x}f, f \rangle_{L^2 (\mathbb{R})}= \int_{\mathbb{R}} x | f (x)|^2 dx \\\\<\xi>_f= \langle \widehat{\xi}f, f \rangle_{L^2 (\mathbb{R})}= \int_{\mathbb{R}} \xi | \widetilde{f} (\xi)|^2 d \xi .\end{array}\end{align*}
45 | \begin{align*}D_s f (x) = \frac{1}{\sqrt{|s|}} f \left( \frac{x}{s} \right)\end{align*}
46 | \begin{align*}\widetilde{D_s f} (\xi) = D_{\frac{1}{s}} \widetilde{f} (\xi)\end{align*}
47 | \begin{align*}\Delta_A (f_1,0) \Delta_B (f_1,0) = C_1\end{align*}
48 | \begin{align*}\begin{array}{c}\Delta_A (f_s,0)= \left(\int_{\mathbb{R}} x^{2n} | f_s (x)|^2 dx\right)^{\frac{1}{2}} = |s|^{-1/2} \left(\int_{\mathbb{R}} x^{2n} | f_1 \left( s^{-1} x\right)|^2 dx \right)^{\frac{1}{2}}=\\\\=|s|^{-1/2} \left(\int_{\mathbb{R}} (sy)^{2n} | f_1 \left(y\right)|^2 |s|dy \right)^{\frac{1}{2}}= |s|^n \Delta_A (f_1,0)\end{array}\end{align*}
49 | \begin{align*}\Delta_B (f_s,0) = |s|^{-m} \Delta_B (f_1,0)\end{align*}
50 | \begin{align*}\Delta_A (f_s,0) \Delta_B (f_s,0) = |s|^{n-m} C_1\end{align*}
51 | \begin{align*}|s|^{n-m} C_1=\Delta_A (f_s,0) \Delta_B (f_s,0) \geq \Delta_A (f_s,_{f_s}) \Delta_B (f_s,_{f_s}) \to 0,\end{align*}
52 | \begin{align*}\langle \left[(\widehat x)^{2k}, (\widehat \xi)^{2k} \right] f , f \rangle_{L^2 (\mathbb{R})} = (-i )^{2k} \sqrt{\frac{2a}{\pi}} \int_{\mathbb{R}} e^{-a x^2} \left( x^{2k} \frac{d^{2k}}{dx^{2k}} - \frac{d^{2k}}{dx^{2k}} x^{2k} \right) e^{-a x^2} dx\end{align*}
53 | \begin{align*}\| ~(x-a)^2 f \|_{L^2 (\mathbb{R})}= \left(\int_{\mathbb{R}} (x-a)^4 |f(x)|^2 dx \right)^{1/2},\end{align*}
54 | \begin{align*}a \wedge \bigvee_i b_i = \bigvee_i (a \wedge b_i)\end{align*}
55 | \begin{align*}\Delta_A (f,a^2) =\| ~(x^2-a^2) f \|_{L^2 (\mathbb{R})} = \left(\int_{\mathbb{R}} (x^2-a^2)^2 |f(x)|^2 dx \right)^{1/2}.\end{align*}
56 | \begin{align*}\|\widehat{A} f \|_{L^2 (\mathbb{R})} = \|\widehat{B} f\|_{L^2 (\mathbb{R})}\end{align*}
57 | \begin{align*} \widehat{R} = \epsilon \left( \widehat{q}_1 + \frac{\theta}{1+ \sqrt{1- \xi}} \widehat{p}_2 \right)\end{align*}
58 | \begin{align*}\left[A, B \right]_{\rho} =\left[A, B \right]_0+ \sum_{k=1}^{\infty} B_k (A,B) \rho^k,\end{align*}
59 | \begin{align*}\mathcal{B}^{\alpha} (\mathbb{R}^2) := \left\{f \in \mathcal{S}^{\prime} (\mathbb{R}^2): ~ \|f \|_{\alpha} < + \infty \right\}\end{align*}
60 | \begin{align*}\|f \|_{\alpha}^2 := 2 \|f \|_{L^2 (\mathbb{R}^2)} + \|\widehat{u} f\|_{L^2 (\mathbb{R}^2)}^2 + \|\widehat{v} f\|_{L^2 (\mathbb{R}^2)}^2\end{align*}
61 | \begin{align*}\mathcal{B} (\mathbb{R}^2) := \left\{f \in \mathcal{S}^{\prime} (\mathbb{R}^2): ~ \|f \|_{\mathcal{B}} < + \infty \right\}\end{align*}
62 | \begin{align*}\langle f,g \rangle_{\alpha} : = 2 \langle f,g \rangle_{L^2 (\mathbb{R}^2)} + \langle \widehat{u}f,\widehat{u}g \rangle_{L^2 (\mathbb{R}^2)} + \langle \widehat{v}f,\widehat{v}g \rangle_{L^2 (\mathbb{R}^2)}\end{align*}
63 | \begin{align*}\|f_n-f_m\|_{\alpha} = \left( 2\|f_n-f_m\|_{L^2 (\mathbb{R}^2)}^2 + \|\widehat{q_1}(f_n-f_m)\|_{L^2 (\mathbb{R}^2)}^2 + \|\widehat{q_2}(f_n-f_m)\|_{L^2 (\mathbb{R}^2)}^2 \right)^{1/2} < \epsilon\end{align*}
64 | \begin{align*}\|\widehat{q_2}f\|_{L^2 (\mathbb{R}^2)}^2 = \lambda^2 \|x_2 f\|_{L^2 (\mathbb{R}^2)}^2 + \frac{\theta^2}{4 \lambda^2} \| \xi_1 \widetilde{f}\|_{L^2 (\mathbb{R}^2)}^2.\end{align*}
65 | \begin{align*}B_\kappa := \{b \in B \mid b \}.\end{align*}
66 | \begin{align*}\|\widehat{u} f \|_{L^2 (\mathbb{R}^2)} \leq \left( 2 \| f \|_{L^2 (\mathbb{R}^2)}^2 + \|\widehat{u} f \|_{L^2 (\mathbb{R}^2)}^2 + \|\widehat{v} f\|_{L^2 (\mathbb{R}^2)}^2\right)^{\frac{1}{2}} = \| f \|_{\alpha}\end{align*}
67 | \begin{align*}S:= \left\{f \in \mathcal{B}^{\alpha} (\mathbb{R}^2): ~ \| f \|_{L^2 (\mathbb{R}^2)} =1 \right\}.\end{align*}
68 | \begin{align*}\overline{B}_R^{(\alpha)}:= \left\{f \in \mathcal{B}^{\alpha} (\mathbb{R}^2): ~\| f\|_{\alpha} \leq R \right\}.\end{align*}
69 | \begin{align*}U_R^{(\alpha)}= \left\{ f \in \overline{B}_R^{(\alpha)}: ~ \|f \|_{L^2(\mathbb{R}^2)} =1 \right\}\end{align*}
70 | \begin{align*}\langle u,v\rangle_{L^2 (\mathbb{R}^2)}=\langle\widehat{A} u,v\rangle_{\alpha},\end{align*}
71 | \begin{align*}\langle h_l-g,u\rangle_{L^2 (\mathbb{R}^2)}=\langle\widehat{A} ( h_l-g), u\rangle_{\alpha}.\end{align*}
72 | \begin{align*}f \in S:= \left\{f \in \mathcal{B}^{\alpha} (\mathbb{R}^2): ~ \|f\|_{L^2 (\mathbb{R}^2)} =1 \right\}.\end{align*}
73 | \begin{align*}F^{(\alpha)} \left[f \right]= \| f \|_{\alpha}^2 -2 \|f \|_{L^2 (\mathbb{R}^2)}^2 =\| f \|_{\alpha}^2 -2 ,\end{align*}
74 | \begin{align*}\|f \|_{L^2 (\mathbb{R}^2)} = 1.\end{align*}
75 | \begin{align*}\mathfrak{L}^{(\alpha)} \left[f , \gamma \right] = F^{(\alpha)} \left[f \right] + \gamma \left( 1- \|f \|_{L^2 (\mathbb{R}^2)}^2 \right),\end{align*}
76 | \begin{align*}A_\top := A \sqcup \{\top\}\end{align*}
77 | \begin{align*}\langle f, g \rangle_{L^2 (\mathbb{R}^2)}= \langle \widehat{A}f,g \rangle_{\alpha},\end{align*}
78 | \begin{align*}\langle \widehat{A}f, g \rangle_{\alpha} = \langle f, g \rangle_{L^2 (\mathbb{R}^2)} = \overline{\langle g,f \rangle}_{L^2 (\mathbb{R}^2)} = \overline{\langle \widehat{A}g,f \rangle }_{\alpha} = \langle f,\widehat{A}g \rangle_{\alpha} .\end{align*}
79 | \begin{align*}\langle \widehat{A} f,f \rangle_{\alpha} = \|f \|_{L^2 (\mathbb{R}^2)}^2 >0,\end{align*}
80 | \begin{align*}0= \langle \widehat{A}g,f \rangle_{\alpha} = \langle g,f \rangle_{L^2 (\mathbb{R}^2)},\end{align*}
81 | \begin{align*} F^{(\alpha)} [f_0] = _{f \in S} F^{(\alpha)} \left[f \right].\end{align*}
82 | \begin{align*}\langle \widehat{u}g, \widehat{u}f_0 \rangle_{L^2 (\mathbb{R}^2)} + \langle \widehat{v}g, \widehat{v}f_0 \rangle_{L^2 (\mathbb{R}^2)} = F^{(\alpha)}[f_0] \langle g,f_0 \rangle_{L^2 (\mathbb{R}^2)},\end{align*}
83 | \begin{align*}\langle \widehat{u}g, \widehat{u}f_0 \rangle_{L^2 (\mathbb{R}^2)} + \langle \widehat{v}g, \widehat{v}f_0 \rangle_{L^2 (\mathbb{R}^2)} = \gamma \langle g,f_0 \rangle_{L^2 (\mathbb{R}^2)},\end{align*}
84 | \begin{align*}\left(\widehat{u}^2 + \widehat{v}^2 \right) f_0= \gamma f_0.\end{align*}
85 | \begin{align*}\widehat{H}^{(\alpha)} f_{\nu} = \nu f_{\nu}\end{align*}
86 | \begin{align*}\|\widehat{u} f_{\nu} \|_{L^2 (\mathbb{R}^2)}^2 + \|\widehat{v} f_{\nu} \|_{L^2 (\mathbb{R}^2)}^2 = \nu \| f_{\nu} \|_{L^2 (\mathbb{R}^2)}^2\end{align*}
87 | \begin{align*} \begin{cases} \lim_{t\to 0}\mathbf{F}(t,t)=1, &\\ \lim_{t\to 0}\mathbf{F}(s,t)=0, & \end{cases} \\ \mathbf{F}(\cdot,t)\ \text{is decreasing, for every fixed $t>0$;}\\ \ \mathbf{F}(s,t)\ \text{is uniformly continuous on $s\geq t\geq \tau$.}\end{align*}
88 | \begin{align*}a \wedge \neg a = \bot, &&a \vee \neg a = \top\end{align*}
89 | \begin{align*}\nu = F^{(\alpha)} \left[ f_{\nu} \right]\end{align*}
90 | \begin{align*}\nu = F^{(\alpha)} \left[ f_{\nu} \right] \geq F^{(\alpha)} \left[f_0 \right]\end{align*}
91 | \begin{align*}\langle g,f_0 \rangle_{\alpha} = (\gamma+2) \langle g, f_0 \rangle_{L^2 (\mathbb{R}^2)}.\end{align*}
92 | \begin{align*}\langle g,f_0 \rangle_{\alpha} = (\gamma +2) \langle \widehat{A} g, f_0 \rangle_{ \alpha} \Leftrightarrow \langle g,f_0 \rangle_{\alpha} = (\gamma+2) \langle g, \widehat{A} f_0 \rangle_{ \alpha},\end{align*}
93 | \begin{align*}f_0 =(\gamma +2) \widehat{A} f_0 \Leftrightarrow \left(\widehat{A}^{-1} - 2 \widehat{I} \right)f_0= \gamma f_0.\end{align*}
94 | \begin{align*}f (x_1, x_2) = \left(\frac{4}{\pi^2 ab} \right)^{\frac{1}{4}} \exp \left[ - \frac{1}{a} (x_1 -x_1^{(0)})^2 - \frac{1}{b} (x_2 - x_2^{(0)})^2 \right]\end{align*}
95 | \begin{align*}x_1^{(0)} = - \frac{\lambda}{2E},\end{align*}
96 | \begin{align*}\begin{array}{c}\langle \widehat{q}_1f, f \rangle_{L^2 (\mathbb{R}^2)}= \int_{\mathbb{R}^2} \left[\left(\lambda x_1 + \frac{i \theta}{2 \lambda} \frac{\partial}{\partial x_2} + E x_1^2 \right)f (x_1, x_2) \right] \overline{f (x_1, x_2)} dx_1 dx_2 =\\\\= \lambda x_1^{(0)} + E \left((x_1^{(0)})^2 + \frac{a}{4} \right)\end{array}\end{align*}
97 | \begin{align*}\begin{array}{c}\langle \widehat{q}_1^2 f,f \rangle_{L^2 (\mathbb{R}^2)}=E^2 (x_1^{(0)})^4 + 2 \lambda E (x_1^{(0)})^3 + \left(\lambda^2 + \frac{3}{2} a E^2 \right) (x_1^{(0)})^2 + \frac{3}{2} \lambda a E x_1^{(0)} + \\\\+\frac{\lambda^2 a}{4} + \frac{\theta^2}{4 \lambda^2 b} + \frac{3 a^2 E^2}{16}\end{array}\end{align*}
98 | \begin{align*}\Delta_{q_1} (f, _f) = \left[ a \left( E x_1^{(0)} + \frac{\lambda}{2} \right)^2 + \frac{\theta^2}{4 \lambda^2 b} + \frac{a^2 E^2}{8} \right]^{\frac{1}{2}}\end{align*}
99 | \begin{align*}a \wedge \neg a = \bot, &&a \vee \neg a = \top_{A_i}\end{align*}
100 | \begin{align*}\Delta_{q_1} (f, _f) =\left( \frac{\theta^2}{4 \lambda^2 b} + \frac{a^2 E^2}{8} \right)^{\frac{1}{2}}\end{align*}
101 | \begin{align*}\langle \widehat{p}_1 f ,f \rangle_{L^2 (\mathbb{R}^2)}= \int_{\mathbb{R}^2} \left[\left(-i \mu \frac{\partial}{\partial x_1} + \frac{\eta}{2 \mu} x_2 \right)f (x_1, x_2) \right] \overline{f (x_1, x_2)} dx_1 dx_2 = \frac{\eta}{2 \mu} x_2^{(0)}\end{align*}
102 | \begin{align*}\langle \widehat{p}_1^2 f ,f \rangle_{L^2 (\mathbb{R}^2)}= \frac{\mu^2}{a} + \left(\frac{\eta}{2 \mu} \right)^2 \left((x_2^{(0)})^2 + \frac{b}{4} \right)\end{align*}
103 | \begin{align*}\Delta_{p_1} (f, _f) = \frac{\mu}{\sqrt{a}} \left[1 + \left(\frac{\eta}{4 \mu^2} \right)^2 ab \right]^{\frac{1}{2}}\end{align*}
104 | \begin{align*}\Delta_{q_1} (f, _f) \Delta_{p_1} (f, _f) = \frac{1}{2} \left( \frac{1}{2} \mu^2 E^2 a + \frac{\mu^2 \theta^2}{\lambda^2 ab} + \frac{\eta^2 E^2 a^2 b}{32 \mu^2} + \frac{\theta^2 \eta^2}{16 \mu^2 \lambda^2} \right)^{\frac{1}{2}}\end{align*}
105 | \begin{align*}\Delta_{q_1} (f, _f) \Delta_{p_1} (f, _f) \to \frac{\theta \eta}{8 \mu \lambda} = \frac{\xi}{4 (1 + \sqrt{1- \xi})} \leq \frac{\xi}{4} < \frac{1}{2}\end{align*}
106 | \begin{align*} V_gf(x,\omega)=\langle f,\pi(x,\omega)g \rangle_{L^2 (\mathbb{R}^d)}=\int_{\mathbb{R}^d} f(t)\overline{g(t-x)}e^{-2\pi it \cdot \omega}dt.\end{align*}
107 | \begin{align*}V_gf(x,\omega)=\langle f,\pi(x,\omega) \overline{g} \rangle.\end{align*}
108 | \begin{align*}\|F\|_{L_{x,\omega}^{r,s} (\mathbb{R}^{2d})}=\left(\int_{\mathbb{R}^d} \left(\int_{\mathbb{R}^d} |F(x, \omega)|^r d x\right)^{\frac{s}{r}} d \omega\right)^{\frac{1}{s}},\end{align*}
109 | \begin{align*}\|f\|_{M_m^{r,s} (\mathbb{R}^d)}= \|m V_gf\|_{L_{x,\omega}^{r,s} (\mathbb{R}^{2d})} = \left(\int_{\mathbb{R}^d} \left(\int_{\mathbb{R}^d} |V_g f(x, \omega) m (x, \omega) |^r d x\right)^{\frac{s}{r}} d \omega\right)^{\frac{1}{s}} < \infty.\end{align*}
110 | \begin{align*}\top_{A_i} \wedge \top_{A_j} = \bot \quad.\end{align*}
111 | \begin{align*}\langle V_{g_1} f_1, V_{g_2} f_2 \rangle_{L^2 (\mathbb{R}^{2d})} = \langle f_1,f_2 \rangle_{L^2 (\mathbb{R}^d)} \overline{\langle g_1,g_2 \rangle}_{L^2 (\mathbb{R}^d)},\end{align*}
112 | \begin{align*}\lim_{R \to \infty} \left( \mbox{ess~sup}_{|z| \ge R} |f(z)| \right)=0 ,\end{align*}
113 | \begin{align*}m(x,\omega)= \sqrt{| \psi(x)|^2 + |\phi (\omega)|^2}.\end{align*}
114 | \begin{align*}\mathcal{B} (\mathbb{R}^2)=M_m^2 (\mathbb{R}^2).\end{align*}
--------------------------------------------------------------------------------
/mixtex_data_gen/gen.py:
--------------------------------------------------------------------------------
1 | import re
2 | import random
3 | import string
4 | from tqdm import tqdm
5 | import jieba
6 | import os
7 |
8 | # Function to remove non-English characters from a text file
9 | # Input:
10 | # input_file_path (str): Path to the input text file
11 | # output_file_path (str): Path to save the cleaned text file
12 | # Output:
13 | # None (writes the cleaned content to output_file_path)
14 | def remove_non_english_characters(input_file_path, output_file_path):
15 | english_regex = re.compile(r'[^a-zA-Z0-9\s.,?!\'"()]+')
16 | with open(input_file_path, 'r', encoding='utf-8') as file:
17 | content = file.read()
18 | cleaned_content = english_regex.sub('', content)
19 | with open(output_file_path, 'w', encoding='utf-8') as file:
20 | file.write(cleaned_content)
21 |
22 | # Function to extract LaTeX formulas from a .tex file
23 | # Input:
24 | # tex_file_path (str): Path to the LaTeX (.tex) file
25 | # Output:
26 | # formula_list (list): List of extracted LaTeX formulas
27 | def extract_latex_formulas(tex_file_path):
28 | with open(tex_file_path, 'r', encoding='utf-8') as f:
29 | tex_content = f.read()
30 | pattern = r'\\\[(.+?)\\\]|\\begin{align\*}(.+?)\\end{align\*}'
31 | formulas = re.findall(pattern, tex_content)
32 | formula_list = [re.sub(r'\\eqref\{(.*?)\}', r'', group) for tuples in formulas for group in tuples if group]
33 | return formula_list
34 |
35 | # Function to process text by inserting LaTeX formulas randomly
36 | # Input:
37 | # input_file (str): Path to the input text file
38 | # output_file (str): Path to save the processed text file
39 | # formulas (list): List of LaTeX formulas to insert
40 | # Output:
41 | # None (writes the processed content to output_file)
42 | def process_text(input_file, output_file, formulas):
43 | with open(input_file, 'r', encoding='utf-8') as f:
44 | text = f.read()
45 | text = text.replace('\n', '')
46 | sentences = re.split(r'[.,]', text)
47 | output = ''
48 |
49 | with open(output_file, 'w', encoding='utf-8') as f:
50 | for sentence in sentences:
51 | for char in sentence:
52 | output += char
53 | if random.random() < 0.02:
54 | formula = random.sample(formulas, 1)[0]
55 | if len(formula) < 50:
56 | try:
57 | output += ' \\(' + re.sub(r'\\tag\{.*?\}', '', formula) + '\\) '
58 | except:
59 | print(formula)
60 | if 30 < len(output) < 300:
61 | f.write(output + '.\n')
62 | output = ''
63 | if len(output) > 300:
64 | output = ''
65 |
66 | # Function to remove unwanted symbols from text
67 | # Input:
68 | # text (str): The input text string
69 | # Output:
70 | # cleaned_text (str): The text after removing unwanted symbols
71 | def remove_symbols(text):
72 | pattern = re.compile(r'[^\u4e00-\u9fa5a-zA-Z,。!?、: ;“”‘’\'\"\(\)\[\]\{\}\<\>\.\,\?\!\:\;\-]')
73 | cleaned_text = re.sub(pattern, '', text)
74 | return cleaned_text
75 |
76 | # Function to format words with LaTeX commands and randomly insert formulas and numbers
77 | # Input:
78 | # words (list): List of words to format
79 | # formulas (list): List of LaTeX formulas to insert
80 | # lines (list): List of lines from the original text for random insertion
81 | # Output:
82 | # output (str): The formatted LaTeX string
83 | def format_text_with_latex(words, formulas, lines):
84 | output = ''
85 | count = 0
86 | for char in tqdm(words):
87 | count += 1
88 | if len(char) >= 2 and random.random() < 0.01:
89 | if random.random() < 0.5:
90 | output += ' \\textbf{' + char + '} '
91 | else:
92 | output += ' \\textit{' + char + '} '
93 | else:
94 | output += char
95 | if count % 100 == 0:
96 | output += '\n \\newpage \n'
97 | if random.random() < 0.5:
98 | if random.random() < 0.03:
99 | formula = random.sample(formulas, 1)[0]
100 | if random.random() < 0.03:
101 | formula += '\\tag{' + str(random.randint(0, 20)) + '.' + str(random.randint(0, 20)) + '}'
102 | if len(formula) > 30:
103 | output += '\n \\begin{align*} \n' + formula + '\n \\end{align*} \n'
104 | else:
105 | formula = random.sample(formulas, 1)[0]
106 | if len(formula) < 30:
107 | output += ' \\( ' + re.sub(r'\\tag\{.*?\}', '', formula) + ' \\) '
108 | elif random.random() < 0.007:
109 | output += ' \\(' + str(random.randint(-1000, 1000)) + '\\) '
110 | elif random.random() < 0.007:
111 | rand_num = random.randint(-99, 99) / random.randint(1, 99)
112 | rand_float = str(round(rand_num, random.randint(1, 4)))
113 | output += ' \\(' + rand_float + '\\) '
114 | elif random.random() < 0.007:
115 | rand_str = ''.join(random.choices(string.ascii_letters, k=random.randint(1, 3)))
116 | output += ' \\(' + rand_str + '\\) '
117 | if random.random() < 0.001:
118 | output += ' \\([' + str(random.randint(1, 100)) + ']\\) '
119 | if random.random() < 0.0005:
120 | char = random.sample(lines, 1)[0].replace('\n', '')
121 | if random.random() < 0.5:
122 | output += ' \\textbf{' + char + '} '
123 | else:
124 | output += ' \\textit{' + char + '} '
125 | return output
126 |
127 | # Function to write LaTeX formatted strings into separate .tex files
128 | # Input:
129 | # strings (str): The LaTeX formatted string to write
130 | # group_size (int, optional): Number of characters per file.
131 | # folder_name (str, optional): Name of the folder to save .tex files.
132 | # Output:
133 | # None (writes multiple .tex files into the specified folder)
134 | def write_strings_to_files(strings, group_size, folder_name):
135 | os.makedirs(folder_name, exist_ok=True)
136 | num_files = (len(strings) + group_size - 1) // group_size
137 |
138 | for i in range(num_files):
139 | file_name = f"{folder_name}/{i + 1}.tex"
140 | start_index = i * group_size
141 | end_index = start_index + group_size
142 | current_group = strings[start_index:end_index]
143 | width = random.randint(12, 15)
144 | margin = random.randint(3, 4)
145 | line = random.randint(4, 20) / 10
146 | bg = f'\\documentclass{{ctexart}}\n\\usepackage[paperwidth={width}in, paperheight=36in, margin={margin}in]{{geometry}}\n'
147 | bg += '\\usepackage{amssymb}\n\\usepackage{amsmath}\n\\usepackage{stmaryrd}\n\\usepackage{color}\n'
148 | bg += '\\nonstopmode\n\\pagestyle{empty}\n\\renewcommand{\\baselinestretch}{' + str(line) + '}\n\n\\begin{document}\n \\newpage'
149 | ed = '\\end{document}'
150 | with open(file_name, 'w', encoding='utf-8') as file:
151 | file.write(bg)
152 | file.write(''.join(current_group))
153 | file.write(ed)
154 |
155 | # Main function to connect all steps
156 | # Input:
157 | # input_text_file (str): Path to the input text file
158 | # input_tex_file (str): Path to the input LaTeX (.tex) file containing formulas
159 | # output_folder (str): Folder name to save the output .tex files
160 | # Output:
161 | # None (executes the entire processing pipeline and writes output files)
162 | def main(input_text_file, input_tex_file, output_folder):
163 | # Step 1: Clean the input text file by removing non-English characters
164 | cleaned_text_file = 'en_only.txt'
165 | remove_non_english_characters(input_text_file, cleaned_text_file)
166 |
167 | # Step 2: Extract LaTeX formulas from the input LaTeX file
168 | formulas = extract_latex_formulas(input_tex_file)
169 |
170 | # Step 3: Process the cleaned text and insert LaTeX formulas randomly
171 | processed_text_file = 'en_line.txt'
172 | process_text(cleaned_text_file, processed_text_file, formulas)
173 |
174 | # Step 4: Read in the processed text and further format it with LaTeX commands
175 | with open(processed_text_file, 'r', encoding='utf-8') as f:
176 | txt_content = f.read()
177 | with open(cleaned_text_file, 'r', encoding='utf-8') as f:
178 | lines = f.readlines()
179 | txt_content = remove_symbols(txt_content)
180 | words = jieba.lcut(txt_content)
181 | latex_content = format_text_with_latex(words, formulas, lines)
182 |
183 | # Step 5: Write the formatted LaTeX strings into .tex files in the specified folder
184 | write_strings_to_files(latex_content, folder_name=output_folder)
185 |
186 | # Example usage
187 | if __name__ == "__main__":
188 | main('endata1.txt', 'formular.tex', 'en')
189 |
--------------------------------------------------------------------------------
/mixtexgui/User Manual&Terms of Service.md:
--------------------------------------------------------------------------------
1 | ## 使用说明
2 |
3 | 1. **剪切板开启**:使用前请按 `Win + V` 打开剪切板功能。
4 | 2. **无需安装**:直接运行 `exe` 文件,无需安装。
5 | 3. **离线推理**:该程序无需联网,无需 GPU,模型可在 CPU 上进行推理。
6 | 4. **系统兼容性**:目前仅支持 Windows 10 和 11 系统。
7 | - 对于其他操作系统用户,可访问在线网页版: [mineai.top](http://mineai.top)
8 |
9 | ## 使用注意事项
10 |
11 | - **截图尺寸**:请确保截图尺寸不超过 448×448,超出部分将会被等比压缩处理。
12 | - **支持内容**:目前仅支持中英文混合手写公式和简单表格的识别。
13 | - **右键菜单功能**:右键点击图标,可选择关闭、最小化、数据标注、文内公式转义等功能。
14 | - **开源免费**:本程序完全开源免费,我们欢迎大家提供真实使用反馈,以帮助优化模型。
15 |
16 | ## 常见错误
17 |
18 | 1. ONNX 文件与 `exe` 文件未放置在同一目录下。
19 | 2. 未按 `Win + V` 打开剪切板功能。
20 | 3. 若出现 `tk` 错误,请下载无图形界面的版本。
21 |
22 | ## 用户协议
23 |
24 | - 本程序遵循 AGPL-3.0 许可证。
25 | - 基于该模型的任何衍生品均不得用于商业用途。
26 | - 使用者需自行承担因非法使用本软件所产生的一切后果。
27 |
28 | # User Guide
29 |
30 | 1. **Clipboard Activation**: Before using the program, press `Win + V` to enable the clipboard feature.
31 | 2. **No Installation Required**: Simply run the `exe` file; no installation is necessary.
32 | 3. **Offline Inference**: The program operates without an internet connection and does not require a GPU. The model runs inference on the CPU.
33 | 4. **System Compatibility**: Currently, only Windows 10 & 11 systems are supported.
34 | - For users on other operating systems, please use the online version: [mineai.top](http://mineai.top)
35 |
36 | ## Usage Notes
37 |
38 | - **Screenshot Size**: Ensure that the screenshot size does not exceed 448×448 pixels. Larger dimensions will be proportionally compressed.
39 | - **Supported Content**: The program currently supports mixed Chinese and English handwritten formulas and tables.
40 | - **Right-Click Menu**: Right-click on the icon to access features such as close, minimize, data annotation, and in-text formula escaping.
41 | - **Open Source & Free**: This program is fully open source and free. We encourage users to provide real-world feedback to help optimize the model.
42 |
43 | ## Common Errors
44 |
45 | 1. The ONNX file and the `exe` file are not placed in the same directory.
46 | 2. The clipboard feature is not activated with `Win + V`.
47 | 3. If a `tk` error occurs, download the version without a graphical interface.
48 |
49 | ## User Agreement
50 |
51 | - The program is licensed under AGPL-3.0.
52 | - Derivatives of this model are not allowed for commercial use.
53 | - Users are fully responsible for any consequences arising from the illegal use of this software.
54 |
--------------------------------------------------------------------------------
/mixtexgui/conda create -nmixtex python=3.14:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/mixtexgui/donate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RQLuo/MixTeX-Latex-OCR/845d0d75b5f55185ee088cf68dc57d5eb3d0f10b/mixtexgui/donate.png
--------------------------------------------------------------------------------
/mixtexgui/examples/example.py:
--------------------------------------------------------------------------------
1 | from mixtex_core import (
2 | load_model,
3 | pad_image,
4 | stream_inference,
5 | # convert_align_to_equations,
6 | )
7 | from PIL import Image
8 |
9 | if __name__ == "__main__":
10 | model = load_model("onnx")
11 | img = Image.open("test.png").convert("RGB")
12 | img_padded = pad_image(img)
13 | partial_result = []
14 | for piece in stream_inference(img_padded, model):
15 | print(piece, end="", flush=True) # 流式输出
16 | partial_result.append(piece)
17 |
18 | # result_text = convert_align_to_equations("".join(partial_result))
19 | # print("\n最终结果:\n", result_text)
20 |
--------------------------------------------------------------------------------
/mixtexgui/examples/example_streamlit.py:
--------------------------------------------------------------------------------
1 | from mixtex_core import (
2 | load_model,
3 | pad_image,
4 | stream_inference,
5 | # convert_align_to_equations,
6 | )
7 | from PIL import Image
8 |
9 | import streamlit as st
10 | from PIL import ImageGrab
11 |
12 |
13 | def main():
14 | st.set_page_config(page_title="MixTeX LaTeX OCR", page_icon="../icon.ico")
15 | st.title("MixTeX LaTeX OCR")
16 | model = load_model("onnx")
17 |
18 | uploaded_file = st.file_uploader("选择图片文件", type=["png", "jpg", "jpeg"])
19 |
20 | if st.button("从剪贴板粘贴图片"):
21 | try:
22 | img = ImageGrab.grabclipboard()
23 | if img:
24 | st.image(img, caption="剪贴板图片预览")
25 | run_inference(model, img)
26 | else:
27 | st.warning("剪贴板没有可用图片")
28 | except Exception as e:
29 | st.error(str(e))
30 |
31 | if uploaded_file:
32 | img = Image.open(uploaded_file).convert("RGB")
33 | st.image(img, caption="上传图片预览")
34 | run_inference(model, img)
35 |
36 |
37 | def run_inference(model, img):
38 | img_padded = pad_image(img)
39 | partial_result = ""
40 | output_area = st.empty()
41 | for piece in stream_inference(img_padded, model):
42 | partial_result += piece
43 | output_area.code(partial_result, language="latex")
44 |
45 |
46 | if __name__ == "__main__":
47 | main()
48 |
--------------------------------------------------------------------------------
/mixtexgui/examples/mixtex_core.py:
--------------------------------------------------------------------------------
1 | import onnxruntime as ort
2 | import numpy as np
3 | from PIL import Image
4 | import re
5 | from transformers import AutoTokenizer, AutoImageProcessor
6 |
7 |
8 | def load_model(model_dir):
9 | tokenizer = AutoTokenizer.from_pretrained(model_dir)
10 | feature_extractor = AutoImageProcessor.from_pretrained(model_dir)
11 | encoder_sess = ort.InferenceSession(f"{model_dir}/encoder_model.onnx")
12 | decoder_sess = ort.InferenceSession(f"{model_dir}/decoder_model_merged.onnx")
13 | return tokenizer, feature_extractor, encoder_sess, decoder_sess
14 |
15 |
16 | def pad_image(img, out_size=(448, 448)):
17 | x_img, y_img = out_size
18 | bg = Image.new("RGB", (x_img, y_img), (255, 255, 255))
19 | w, h = img.size
20 | if w < x_img and h < y_img:
21 | x = (x_img - w) // 2
22 | y = (y_img - h) // 2
23 | bg.paste(img, (x, y))
24 | else:
25 | scale = min(x_img / w, y_img / h)
26 | nw, nh = int(w * scale), int(h * scale)
27 | img_resized = img.resize((nw, nh), Image.LANCZOS)
28 | x = (x_img - nw) // 2
29 | y = (y_img - nh) // 2
30 | bg.paste(img_resized, (x, y))
31 | return bg
32 |
33 |
34 | def check_repetition(s, repeats=12):
35 | for pattern_length in range(1, len(s) // repeats + 1):
36 | for start in range(len(s) - repeats * pattern_length + 1):
37 | pattern = s[start : start + pattern_length]
38 | if s[start : start + repeats * pattern_length] == pattern * repeats:
39 | return True
40 | return False
41 |
42 |
43 | def convert_align_to_equations(text):
44 | text = re.sub(r"\\begin\{align\*\}|\\end\{align\*\}", "", text).replace("&", "")
45 | eqs = text.strip().split("\\\\")
46 | return "\n".join(f"$$ {eq.strip()} $$" for eq in eqs if eq.strip())
47 |
48 |
49 | def stream_inference(
50 | image, model, max_length=512, num_layers=3, hidden_size=768, heads=12, batch_size=1
51 | ):
52 | tokenizer, feature_extractor, enc_session, dec_session = model
53 | head_size = hidden_size // heads
54 | inputs = feature_extractor(image, return_tensors="np").pixel_values
55 | enc_out = enc_session.run(None, {"pixel_values": inputs})[0]
56 | dec_in = {
57 | "input_ids": tokenizer("", return_tensors="np").input_ids.astype(np.int64),
58 | "encoder_hidden_states": enc_out,
59 | "use_cache_branch": np.array([True], dtype=bool),
60 | **{
61 | f"past_key_values.{i}.{t}": np.zeros(
62 | (batch_size, heads, 0, head_size), dtype=np.float32
63 | )
64 | for i in range(num_layers)
65 | for t in ["key", "value"]
66 | },
67 | }
68 | generated = ""
69 | for _ in range(max_length):
70 | outs = dec_session.run(None, dec_in)
71 | next_id = np.argmax(outs[0][:, -1, :], axis=-1)
72 | token_text = tokenizer.decode(next_id, skip_special_tokens=True)
73 | yield token_text # 流式输出
74 | generated += token_text
75 | if check_repetition(generated, 21) or next_id == tokenizer.eos_token_id:
76 | break
77 | dec_in.update(
78 | {
79 | "input_ids": next_id[:, None],
80 | **{
81 | f"past_key_values.{i}.{t}": outs[i * 2 + 1 + j]
82 | for i in range(num_layers)
83 | for j, t in enumerate(["key", "value"])
84 | },
85 | }
86 | )
87 |
--------------------------------------------------------------------------------
/mixtexgui/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RQLuo/MixTeX-Latex-OCR/845d0d75b5f55185ee088cf68dc57d5eb3d0f10b/mixtexgui/icon.ico
--------------------------------------------------------------------------------
/mixtexgui/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RQLuo/MixTeX-Latex-OCR/845d0d75b5f55185ee088cf68dc57d5eb3d0f10b/mixtexgui/icon.png
--------------------------------------------------------------------------------
/mixtexgui/icon_gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RQLuo/MixTeX-Latex-OCR/845d0d75b5f55185ee088cf68dc57d5eb3d0f10b/mixtexgui/icon_gray.png
--------------------------------------------------------------------------------
/mixtexgui/mixtex_ui.py:
--------------------------------------------------------------------------------
1 | # Renqing Luo
2 | # Commercial use prohibited
3 | import tkinter as tk
4 | from PIL import Image, ImageTk
5 | import pystray
6 | from pystray import MenuItem as item
7 | import threading
8 | from transformers import RobertaTokenizer, ViTImageProcessor
9 | import onnxruntime as ort
10 | import numpy as np
11 | from PIL import ImageGrab
12 | import pyperclip
13 | import time
14 | import sys
15 | import os
16 | import csv
17 | import re
18 | import ctypes
19 |
20 | if hasattr(sys, '_MEIPASS'):
21 | base_path = sys._MEIPASS
22 | else:
23 | base_path = os.path.abspath(".")
24 |
25 | class MixTeXApp:
26 | def __init__(self, root):
27 | self.root = root
28 |
29 | # 添加 DPI 感知支持 (解决高分屏模糊问题)
30 | try:
31 | ctypes.windll.shcore.SetProcessDpiAwareness(1) # 启用 DPI 感知
32 | self.dpi_scale = ctypes.windll.shcore.GetScaleFactorForDevice(0) / 100
33 | self.root.tk.call('tk', 'scaling', self.dpi_scale)
34 | except Exception as e:
35 | print(f"DPI 设置失败: {e}")
36 | self.dpi_scale = 1.0
37 |
38 | self.root.title('MixTeX')
39 | self.root.resizable(False, False)
40 | self.root.overrideredirect(True)
41 | self.root.wm_attributes('-topmost', 1)
42 | self.root.attributes('-alpha', 0.85)
43 | self.TRANSCOLOUR = '#a9abc6'
44 | self.is_only_parse_when_show = False
45 | self.icon = self.load_scaled_image(os.path.join(base_path, "icon.png"))
46 | self.icon_tk = ImageTk.PhotoImage(self.icon)
47 |
48 | self.main_frame = tk.Frame(self.root, bg=self.TRANSCOLOUR)
49 | self.main_frame.pack(fill=tk.BOTH, expand=True)
50 |
51 | self.icon_label = tk.Label(self.main_frame, image=self.icon_tk, bg=self.TRANSCOLOUR)
52 | self.icon_label.pack(pady=self.scale_size(10))
53 |
54 | self.text_frame = tk.Frame(self.main_frame, bg='white', bd=1, relief=tk.SOLID)
55 | self.text_frame.pack(padx=self.scale_size(5), pady=self.scale_size(5), fill=tk.BOTH, expand=True)
56 |
57 | # 使用缩放后的字体大小
58 | font_size = self.scale_size(9)
59 | self.text_box = tk.Text(self.text_frame, wrap=tk.WORD, bg='white', fg='black',
60 | height=6, width=30, font=('Arial', font_size))
61 | self.text_box.pack(padx=self.scale_size(2), pady=self.scale_size(2), fill=tk.BOTH, expand=True)
62 |
63 | self.icon_label.bind('', self.start_move)
64 | self.icon_label.bind('', self.do_move)
65 | self.icon_label.bind('', self.show_menu)
66 | self.data_folder = "data"
67 | self.metadata_file = os.path.join(self.data_folder, "metadata.csv")
68 | self.use_dollars_for_inline_math = False
69 | self.convert_align_to_equations_enabled = False
70 | self.ocr_paused = False
71 | self.annotation_window = None
72 | self.current_image = None
73 | self.output = None
74 | if not os.path.exists(self.data_folder):
75 | os.makedirs(self.data_folder)
76 |
77 | if not os.path.exists(self.metadata_file):
78 | with open(self.metadata_file, 'w', newline='', encoding='utf-8') as f:
79 | writer = csv.writer(f)
80 | writer.writerow(['file_name', 'text', 'feedback'])
81 |
82 | # Create the menu
83 | self.menu = tk.Menu(self.root, tearoff=0)
84 | settings_menu = tk.Menu(self.menu, tearoff=0)
85 | settings_menu.add_checkbutton(label="$ 公式 $", onvalue=1, offvalue=0, command=self.toggle_latex_replacement, variable=tk.BooleanVar(value=self.use_dollars_for_inline_math))
86 | settings_menu.add_checkbutton(label="$$ 单行公式 $$", onvalue=1, offvalue=0, command=self.toggle_convert_align_to_equations, variable=tk.BooleanVar(value=self.convert_align_to_equations_enabled))
87 | self.menu.add_cascade(label="设置", menu=settings_menu)
88 | self.menu.add_command(label="反馈标注", command=self.show_feedback_options)
89 | self.menu.add_command(label="最小化", command=self.minimize)
90 | self.menu.add_command(label="关于", command=self.show_about)
91 | self.menu.add_command(label="打赏", command=self.show_donate)
92 | self.menu.add_command(label="退出", command=self.quit)
93 | if sys.platform == 'darwin': # macOS
94 | self.root.config(menu=self.menu)
95 | else: # Windows/Linux
96 | self.root.bind('', self.show_menu)
97 | self.root.wm_attributes("-transparentcolor", self.TRANSCOLOUR)
98 |
99 | self.create_tray_icon()
100 |
101 | self.model = self.load_model('onnx')
102 | if self.model is None:
103 | self.log("模型加载失败,部分功能将不可用")
104 | self.ocr_paused = True # 暂停OCR功能
105 | else:
106 | self.ocr_thread = threading.Thread(target=self.ocr_loop, daemon=True)
107 | self.ocr_thread.start()
108 |
109 | self.donate_window = None
110 |
111 | self.is_only_parse_when_show = False
112 |
113 | def scale_size(self, size):
114 | """根据DPI缩放尺寸"""
115 | return int(size * self.dpi_scale)
116 |
117 | def load_scaled_image(self, image_path, custom_scale=None):
118 | """按DPI比例加载图像"""
119 | # 使用自定义缩放因子或系统DPI缩放
120 | scale = custom_scale if custom_scale is not None else getattr(self, 'dpi_scale', 1.0)
121 |
122 | # 确保路径存在
123 | if not os.path.exists(image_path):
124 | # 尝试查找替代路径
125 | alt_path = os.path.join(os.path.dirname(sys.executable), os.path.basename(image_path))
126 | if os.path.exists(alt_path):
127 | image_path = alt_path
128 | else:
129 | print(f"找不到图像文件: {image_path}")
130 | # 创建一个空白图像替代
131 | return Image.new('RGB', (64, 64), (200, 200, 200))
132 |
133 | # 加载原始图像
134 | original = Image.open(image_path)
135 |
136 | # 如果需要缩放
137 | if scale > 1.0:
138 | # 计算新尺寸
139 | new_size = (int(original.width * scale), int(original.height * scale))
140 | # 使用高质量缩放
141 | return original.resize(new_size, Image.LANCZOS)
142 | return original
143 |
144 | def start_move(self, event):
145 | self.x = event.x
146 | self.y = event.y
147 |
148 | def do_move(self, event):
149 | deltax = event.x - self.x
150 | deltay = event.y - self.y
151 | x = self.root.winfo_x() + deltax
152 | y = self.root.winfo_y() + deltay
153 | self.root.geometry(f"+{x}+{y}")
154 |
155 | def show_menu(self, event):
156 | self.menu.tk_popup(event.x_root, event.y_root)
157 |
158 | def save_data(self, image, text, feedback):
159 | file_name = f"{int(time.time())}.png"
160 | file_path = os.path.join(self.data_folder, file_name)
161 | image.save(file_path, 'PNG')
162 |
163 | rows = []
164 | with open(self.metadata_file, 'r', newline='', encoding='utf-8') as f:
165 | reader = csv.reader(f)
166 | rows = list(reader)
167 |
168 | updated = False
169 | for row in rows[1:]:
170 | if row[1] == text:
171 | row[2] = feedback
172 | updated = True
173 | break
174 |
175 | if not updated:
176 | rows.append([file_name, text, feedback])
177 |
178 | with open(self.metadata_file, 'w', newline='', encoding='utf-8') as f:
179 | writer = csv.writer(f)
180 | writer.writerows(rows)
181 |
182 | def toggle_latex_replacement(self):
183 | self.use_dollars_for_inline_math = not self.use_dollars_for_inline_math
184 |
185 | def toggle_convert_align_to_equations(self):
186 | self.convert_align_to_equations_enabled = not self.convert_align_to_equations_enabled
187 |
188 | def minimize(self):
189 | self.root.withdraw()
190 | self.tray_icon.visible = True
191 |
192 | def show_about(self):
193 | about_text = "MixTeX\n版本: 3.2.4b \n作者: lrqlrqlrq \nQQ群:612725068 \nB站:bilibili.com/8922788 \nGithub:github.com/RQLuo"
194 | self.text_box.delete(1.0, tk.END)
195 | self.text_box.insert(tk.END, about_text)
196 |
197 | def show_donate(self):
198 | donate_text = "\n!!!感谢您的支持!!!\n"
199 | self.text_box.delete(1.0, tk.END)
200 | self.text_box.insert(tk.END, donate_text)
201 |
202 | donate_frame = tk.Frame(self.main_frame, bg='white')
203 | donate_frame.pack(padx=self.scale_size(5), pady=self.scale_size(5), fill=tk.BOTH, expand=True)
204 |
205 | # 加载并缩放打赏图像
206 | donate_size = self.scale_size(400)
207 | donate_image = self.load_scaled_image(os.path.join(base_path, "donate.png"))
208 | donate_image = donate_image.resize((donate_size, donate_size), Image.LANCZOS)
209 | donate_photo = ImageTk.PhotoImage(donate_image)
210 |
211 | image_label = tk.Label(donate_frame, image=donate_photo)
212 | image_label.image = donate_photo
213 | image_label.pack(expand=True, fill=tk.BOTH)
214 |
215 | close_button = tk.Button(donate_frame, text="☒",
216 | command=lambda: donate_frame.destroy())
217 | close_button.place(relx=1.0, rely=0.0,
218 | x=-self.scale_size(15),
219 | y=self.scale_size(5),
220 | width=self.scale_size(12),
221 | height=self.scale_size(12),
222 | anchor="ne")
223 |
224 | def quit(self):
225 | self.tray_icon.stop()
226 | self.root.quit()
227 |
228 | def only_parse_when_show(self):
229 | self.is_only_parse_when_show = not self.is_only_parse_when_show
230 |
231 | def create_tray_icon(self):
232 | menu = pystray.Menu(
233 | item('显示', self.show_window),
234 | item("开关只在最大化启用", self.only_parse_when_show),
235 | item('退出', self.quit)
236 | )
237 |
238 | self.tray_icon = pystray.Icon("MixTeX", self.icon, "MixTeX", menu)
239 | threading.Thread(target=self.tray_icon.run, daemon=True).start()
240 |
241 | def show_window(self):
242 | self.root.deiconify()
243 | self.tray_icon.visible = False
244 |
245 | def load_model(self, path):
246 | try:
247 | # 检查模型文件是否存在,优先查找外部onnx文件夹
248 | model_paths = [
249 | path, # 原始路径(相对路径)
250 | os.path.join(os.path.dirname(sys.executable), 'onnx'), # exe同目录下的onnx文件夹
251 | os.path.abspath("onnx") # 当前运行目录下的onnx文件夹
252 | ]
253 |
254 | # 寻找第一个有效的模型路径
255 | valid_path = None
256 | for model_path in model_paths:
257 | if os.path.exists(model_path):
258 | # 检查必要文件是否都存在
259 | required_files = [
260 | os.path.join(model_path, "encoder_model.onnx"),
261 | os.path.join(model_path, "decoder_model_merged.onnx"),
262 | os.path.join(model_path, "tokenizer.json"),
263 | os.path.join(model_path, "vocab.json")
264 | ]
265 |
266 | all_files_exist = all(os.path.exists(file_path) for file_path in required_files)
267 | if all_files_exist:
268 | valid_path = model_path
269 | self.log(f"使用模型路径: {valid_path}")
270 | break
271 |
272 | if valid_path is None:
273 | self.log("找不到有效的模型文件")
274 | # 显示错误对话框
275 | import ctypes
276 | ctypes.windll.user32.MessageBoxW(0,
277 | "找不到必要的模型文件\n请确保exe同目录下的onnx文件夹包含完整的模型文件。",
278 | "模型加载错误", 0)
279 | return None
280 |
281 | tokenizer = RobertaTokenizer.from_pretrained(valid_path)
282 | feature_extractor = ViTImageProcessor.from_pretrained(valid_path)
283 | encoder_session = ort.InferenceSession(f"{valid_path}/encoder_model.onnx")
284 | decoder_session = ort.InferenceSession(f"{valid_path}/decoder_model_merged.onnx")
285 | self.log('\n===成功加载模型===\n')
286 | return (tokenizer, feature_extractor, encoder_session, decoder_session)
287 | except Exception as e:
288 | self.log(f"模型加载失败: {e}")
289 | import ctypes
290 | ctypes.windll.user32.MessageBoxW(0,
291 | f"模型加载失败: {str(e)}\n请确保exe同目录下的onnx文件夹包含完整的模型文件。",
292 | "模型加载错误", 0)
293 | return None
294 |
295 | def show_feedback_options(self):
296 | feedback_menu = tk.Menu(self.menu, tearoff=0)
297 | feedback_menu.add_command(label="完美", command=lambda: self.handle_feedback("Perfect"))
298 | feedback_menu.add_command(label="普通", command=lambda: self.handle_feedback("Normal"))
299 | feedback_menu.add_command(label="失误", command=lambda: self.handle_feedback("Mistake"))
300 | feedback_menu.add_command(label="错误", command=lambda: self.handle_feedback("Error"))
301 | feedback_menu.add_command(label="标注", command=self.add_annotation)
302 | feedback_menu.tk_popup(self.root.winfo_pointerx(), self.root.winfo_pointery())
303 |
304 | def handle_feedback(self, feedback_type):
305 | image = self.current_image
306 | text = self.output
307 | if image and text:
308 | if self.check_repetition(text):
309 | self.log("反馈已记录: Repeat")
310 | else:
311 | self.save_data(image, text, feedback_type)
312 | self.log(f"反馈已记录: {feedback_type}")
313 | else:
314 | self.log("反馈无法记录: 缺少图片或者推理输出")
315 |
316 | def add_annotation(self):
317 | if self.annotation_window is not None:
318 | return # If there's already an annotation window, do nothing
319 |
320 | self.annotation_window = tk.Toplevel(self.root)
321 | self.annotation_window.wm_attributes("-alpha", 0.85)
322 | self.annotation_window.overrideredirect(True)
323 | self.annotation_window.wm_attributes('-topmost', 1)
324 |
325 | self.update_annotation_position()
326 |
327 | # 使用缩放后的字体
328 | font_size = self.scale_size(11)
329 | entry = tk.Entry(self.annotation_window, width=45, font=('Arial', font_size))
330 | entry.pack(padx=self.scale_size(10), pady=self.scale_size(10))
331 | entry.focus_set()
332 |
333 | confirm_button = tk.Button(self.annotation_window, text="确认",
334 | command=lambda: self.confirm_annotation(entry))
335 | confirm_button.pack(pady=(0, self.scale_size(10)))
336 |
337 | # Close the window on moving the main window
338 | self.root.bind('', lambda e: self.update_annotation_position())
339 |
340 | def confirm_annotation(self, entry):
341 | annotation = entry.get()
342 | image = self.current_image
343 | text = self.output
344 | if annotation and image and text:
345 | self.handle_feedback(f"Annotation: {annotation}")
346 | self.log(f"标注已添加: {annotation}")
347 | else:
348 | self.log("反馈无法记录: 缺少图片或推理输出或输入标注。")
349 | self.close_annotation()
350 |
351 | def update_annotation_position(self):
352 | if self.annotation_window:
353 | x = self.root.winfo_x() + self.scale_size(10)
354 | y = self.root.winfo_y() + self.root.winfo_height() + self.scale_size(10)
355 | self.annotation_window.geometry(f"+{x}+{y}")
356 |
357 | def close_annotation(self):
358 | if self.annotation_window:
359 | self.annotation_window.destroy()
360 | self.annotation_window = None
361 |
362 | def check_repetition(self, s, repeats=12):
363 | for pattern_length in range(1, len(s) // repeats + 1):
364 | for start in range(len(s) - repeats * pattern_length + 1):
365 | pattern = s[start:start + pattern_length]
366 | if s[start:start + repeats * pattern_length] == pattern * repeats:
367 | return True
368 | return False
369 |
370 | def mixtex_inference(self, max_length, num_layers, hidden_size, num_attention_heads, batch_size):
371 | tokenizer, feature_extractor, encoder_session, decoder_session = self.model
372 | try:
373 | generated_text = ""
374 | head_size = hidden_size // num_attention_heads
375 | inputs = feature_extractor(self.current_image, return_tensors="np").pixel_values
376 | encoder_outputs = encoder_session.run(None, {"pixel_values": inputs})[0]
377 |
378 |
379 | num_layers = 6 # 修改为6层而不是3层
380 |
381 | decoder_inputs = {
382 | "input_ids": tokenizer("", return_tensors="np").input_ids.astype(np.int64),
383 | "encoder_hidden_states": encoder_outputs,
384 | "use_cache_branch": np.array([True], dtype=bool),
385 | **{f"past_key_values.{i}.{t}": np.zeros((batch_size, num_attention_heads, 0, head_size), dtype=np.float32)
386 | for i in range(num_layers) for t in ["key", "value"]}
387 | }
388 | for _ in range(max_length):
389 | decoder_outputs = decoder_session.run(None, decoder_inputs)
390 | next_token_id = np.argmax(decoder_outputs[0][:, -1, :], axis=-1)
391 | generated_text += tokenizer.decode(next_token_id, skip_special_tokens=True)
392 | self.log(tokenizer.decode(next_token_id, skip_special_tokens=True), end="")
393 | if self.check_repetition(generated_text, 21):
394 | self.log('\n===?!重复重复重复!?===\n')
395 | self.save_data(self.current_image, generated_text, 'Repeat')
396 | break
397 | if next_token_id == tokenizer.eos_token_id:
398 | self.log('\n===成功复制到剪切板===\n')
399 | break
400 |
401 | decoder_inputs.update({
402 | "input_ids": next_token_id[:, None],
403 | **{f"past_key_values.{i}.{t}": decoder_outputs[i*2+1+j]
404 | for i in range(num_layers) for j, t in enumerate(["key", "value"])}
405 | })
406 | if self.convert_align_to_equations_enabled:
407 | generated_text = self.convert_align_to_equations(generated_text)
408 | return generated_text
409 | except Exception as e:
410 | self.log(f"Error during OCR: {e}")
411 | return ""
412 |
413 | def convert_align_to_equations(self, text):
414 | text = re.sub(r'\\begin\{align\*\}|\\end\{align\*\}', '', text).replace('&','')
415 | equations = text.strip().split('\\\\')
416 | converted = []
417 | for eq in equations:
418 | eq = eq.strip().replace('\\[','').replace('\\]','').replace('\n','')
419 | if eq:
420 | converted.append(f"$$ {eq} $$")
421 | return '\n'.join(converted)
422 |
423 | def pad_image(self, img, out_size):
424 | x_img, y_img = out_size
425 | background = Image.new('RGB', (x_img, y_img), (255, 255, 255))
426 | width, height = img.size
427 | if width < x_img and height < y_img:
428 | x = (x_img - width) // 2
429 | y = (y_img - height) // 2
430 | background.paste(img, (x, y))
431 | else:
432 | scale = min(x_img / width, y_img / height)
433 | new_width = int(width * scale)
434 | new_height = int(height * scale)
435 | img_resized = img.resize((new_width, new_height), Image.LANCZOS)
436 | x = (x_img - new_width) // 2
437 | y = (y_img - new_height) // 2
438 | background.paste(img_resized, (x, y))
439 | return background
440 |
441 | def ocr_loop(self):
442 | while True:
443 | if not self.ocr_paused and (self.tray_icon.visible or not self.is_only_parse_when_show):
444 | try:
445 | image = ImageGrab.grabclipboard()
446 | if image is not None and type(image) != list:
447 | self.current_image = self.pad_image(image.convert("RGB"), (448,448))
448 | result = self.mixtex_inference(512, 3, 768, 12, 1)
449 | result = result.replace('\\[', '\\begin{align*}').replace('\\]', '\\end{align*}').replace('%', '\\%')
450 | self.output = result
451 | if self.use_dollars_for_inline_math:
452 | result = result.replace('\\(', '$').replace('\\)', '$')
453 | pyperclip.copy(result)
454 | except Exception as e:
455 | self.log(f"Error: {e}")
456 | time.sleep(0.1)
457 |
458 | def toggle_ocr(self, event=None):
459 | self.ocr_paused = not self.ocr_paused
460 | self.root.after(0, self.update_icon)
461 |
462 | def update_icon(self):
463 | if self.ocr_paused:
464 | new_icon = self.load_scaled_image(os.path.join(base_path, "icon_gray.png"))
465 | else:
466 | new_icon = self.load_scaled_image(os.path.join(base_path, "icon.png"))
467 | self.icon = new_icon
468 | self.icon_tk = ImageTk.PhotoImage(self.icon)
469 | self.icon_label.config(image=self.icon_tk)
470 | self.tray_icon.icon = self.icon
471 |
472 | def log(self, message, end='\n'):
473 | self.text_box.insert(tk.END, message + end)
474 | self.text_box.see(tk.END)
475 |
476 | if __name__ == '__main__':
477 | try:
478 | root = tk.Tk()
479 | app = MixTeXApp(root)
480 | root.mainloop()
481 | except Exception as e:
482 | # 创建错误日志文件
483 | with open('error_log.txt', 'w') as f:
484 | import traceback
485 | f.write(str(e) + '\n')
486 | f.write(traceback.format_exc())
487 | # 显示错误窗口
488 | import ctypes
489 | ctypes.windll.user32.MessageBoxW(0, f"程序启动失败: {str(e)}\n详细信息已保存到error_log.txt", "错误", 0)
--------------------------------------------------------------------------------
/mixtexgui/mixtex_ui.spec:
--------------------------------------------------------------------------------
1 | # -*- mode: python ; coding: utf-8 -*-
2 | import os
3 |
4 | # 创建DPI感知的清单文件
5 | manifest = '''
6 |
7 |
8 |
9 |
10 |
12 |
13 |
14 |
15 |
16 | true/pm
17 | PerMonitorV2, PerMonitor
18 |
19 |
20 | '''
21 |
22 | # 写入临时清单文件
23 | manifest_path = 'app.manifest'
24 | with open(manifest_path, 'w') as f:
25 | f.write(manifest)
26 |
27 | # 修改 Analysis 配置部分
28 | a = Analysis(
29 | ['mixtex_ui.py'],
30 | pathex=[],
31 | binaries=[],
32 | datas=[
33 | ('donate.png', '.'),
34 | ('icon.png', '.'),
35 | ('icon_gray.png', '.'),
36 | ],
37 | excludes = [
38 | # 完全排除 PyTorch 相关库,因为使用ONNX运行时
39 | 'torch', 'torchvision', 'torchaudio',
40 |
41 | # 排除其他机器学习框架
42 | 'tensorflow',
43 | 'jax',
44 | 'flax',
45 | 'keras',
46 |
47 | # 排除训练相关模块
48 | 'transformers.trainer',
49 | 'transformers.training_args',
50 | ],
51 | hiddenimports=[
52 | # transformers 基础模块
53 | 'transformers',
54 | 'transformers.models',
55 | 'transformers.models.roberta',
56 | 'transformers.models.vit',
57 |
58 | # === RoBERTa 必要模块 ===
59 | 'transformers.models.roberta.tokenization_roberta',
60 | 'transformers.models.roberta.tokenization_roberta_fast',
61 |
62 | # === ViT 必要模块 ===
63 | 'transformers.models.vit.image_processing_vit',
64 |
65 | # === 通用工具类 ===
66 | 'transformers.tokenization_utils',
67 | 'transformers.tokenization_utils_base',
68 | 'transformers.image_processing_utils',
69 | 'transformers.image_utils',
70 | 'transformers.configuration_utils',
71 | 'transformers.utils',
72 | 'transformers.file_utils',
73 | 'transformers.modeling_utils',
74 |
75 | # === ONNX 运行时依赖 ===
76 | 'onnxruntime',
77 | 'onnxruntime.capi.onnxruntime_pybind11_state',
78 | 'PIL',
79 | 'pystray',
80 | 'numpy',
81 | ],
82 | hookspath=[],
83 | hooksconfig={},
84 | runtime_hooks=[],
85 | noarchive=False,
86 | optimize=0,
87 | )
88 | pyz = PYZ(a.pure)
89 |
90 | exe = EXE(
91 | pyz,
92 | a.scripts,
93 | a.binaries,
94 | a.datas,
95 | [],
96 | name='MixTeX',
97 | debug=False,
98 | bootloader_ignore_signals=False,
99 | strip=False,
100 | upx=True,
101 | upx_exclude=[],
102 | runtime_tmpdir=None,
103 | console=False,
104 | disable_windowed_traceback=False,
105 | argv_emulation=False,
106 | target_arch=None,
107 | codesign_identity=None,
108 | entitlements_file=None,
109 | icon=['icon.ico'],
110 | manifest=manifest_path, # 添加清单文件路径
111 | uac_admin=False,
112 | )
113 |
114 | # 清理临时清单文件
115 | if os.path.exists(manifest_path):
116 | try:
117 | os.remove(manifest_path)
118 | except:
119 | pass
--------------------------------------------------------------------------------
/mixtexgui/requirements.txt:
--------------------------------------------------------------------------------
1 | altgraph==0.17.4
2 | certifi==2024.7.4
3 | charset-normalizer==3.3.2
4 | colorama==0.4.6
5 | coloredlogs==15.0.1
6 | filelock==3.15.4
7 | flatbuffers==24.3.25
8 | fsspec==2024.6.1
9 | huggingface-hub==0.24.2
10 | humanfriendly==10.0
11 | idna==3.7
12 | mpmath==1.3.0
13 | numpy==1.26.4
14 | onnxruntime==1.18.1
15 | packaging==24.1
16 | pefile==2023.2.7
17 | pillow==10.4.0
18 | protobuf==5.27.2
19 | pyinstaller==6.9.0
20 | pyinstaller-hooks-contrib==2024.7
21 | pyperclip==1.9.0
22 | pyreadline3==3.4.1
23 | pystray==0.19.5
24 | pywin32-ctypes==0.2.2
25 | PyYAML==6.0.1
26 | regex==2024.7.24
27 | requests==2.32.3
28 | safetensors==0.4.3
29 | six==1.16.0
30 | sympy==1.13.1
31 | tokenizers==0.19.1
32 | tqdm==4.66.4
33 | transformers==4.43.2
34 | typing_extensions==4.12.2
35 | urllib3==2.2.2
36 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | altgraph==0.17.4
2 | certifi==2024.7.4
3 | charset-normalizer==3.3.2
4 | colorama==0.4.6
5 | coloredlogs==15.0.1
6 | filelock==3.15.4
7 | flatbuffers==24.3.25
8 | fsspec==2024.6.1
9 | huggingface-hub==0.24.2
10 | humanfriendly==10.0
11 | idna==3.7
12 | mpmath==1.3.0
13 | numpy==1.26.4
14 | onnxruntime==1.18.1
15 | packaging==24.1
16 | pefile==2023.2.7
17 | pillow==10.4.0
18 | protobuf==5.27.2
19 | pyinstaller==6.9.0
20 | pyinstaller-hooks-contrib==2024.7
21 | pyperclip==1.9.0
22 | pyreadline3==3.4.1
23 | pystray==0.19.5
24 | pywin32-ctypes==0.2.2
25 | PyYAML==6.0.1
26 | regex==2024.7.24
27 | requests==2.32.3
28 | safetensors==0.4.3
29 | six==1.16.0
30 | sympy==1.13.1
31 | tokenizers==0.19.1
32 | tqdm==4.66.4
33 | transformers==4.43.2
34 | typing_extensions==4.12.2
35 | urllib3==2.2.2
36 |
--------------------------------------------------------------------------------