-
Notifications
You must be signed in to change notification settings - Fork 769
modern-hfut-report:0.1.0 #3491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
modern-hfut-report:0.1.0 #3491
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2025 HPCesia | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # 合肥工业大学课程现代设计报告模板 | ||
|
|
||
| A modern report template for HFUT (unofficial) | ||
|
|
||
| 这是合肥工业大学的现代课程设计报告模板(非官方) | ||
|
|
||
| ## 使用方法 | ||
|
|
||
| 开始使用模板时,请先完整阅读 `template/guide.typ`及其预览,了解如何从模板开始编写自己的报告 | ||
|
|
||
| ### 在线编辑 | ||
|
|
||
| [Typst Web App](https://typst.app/) 提供在线编辑和编译功能,适合不想在本地安装软件的用户 | ||
|
|
||
| 只需在 Web App 的 [Templates](https://typst.app/universe/search/?kind=templates) 中搜索「modern-hfut-report」,点击「Create project in app」即可在线创建模板 | ||
|
|
||
| ### 本地编辑 | ||
|
|
||
| 推荐使用 [VSCode](https://code.visualstudio.com/download) + [Tinymist](https://marketplace.visualstudio.com/items?itemName=myriad-dreamin.tinymist) 插件进行本地编辑 | ||
|
|
||
| #### 方法一:使用 typst init(推荐) | ||
|
|
||
| ```bash | ||
| typst init @preview/modern-hfut-report:0.1.0 | ||
| cd modern-hfut-report | ||
| ``` | ||
|
|
||
| #### 方法二:在 VSCode 中创建 | ||
|
|
||
| 按下「Ctrl + Shift + P」打开命令面板,输入「Typst: Show Available Typst Templates」,从列表中选择 modern-hfut-report,点击「+」号创建项目 | ||
|
|
||
| 最后用 VSCode 打开生成的目录,打开 `template/report.typ` 文件,等待插件激活后点击顶部预览按钮进行预览 | ||
|
|
||
| ### 本地开发 | ||
|
|
||
| 如果你想要开发本模板,请从 [GitHub 仓库](https://github.com/KercyDing/modern-hfut-report) 克隆代码到本地,将 `template/report.typ` 首行的导入路径更换为 `"../lib.typ"` | ||
|
|
||
| ## 致谢 | ||
| - [modern-xmu-thesis](https://typst.app/universe/package/modern-xmu-thesis) by HPCesia,本模板借鉴了该模板的部分思路 | ||
| - [i-figured](https://typst.app/universe/package/i-figured) by RubixDev,使用起来确实很方便,功能也很强大 | ||
| - [zh-format](https://typst.app/universe/package/zh-format) by me,自己为了这碗醋才包的这顿饺子(bushi | ||
|
|
||
| ## 环境要求 | ||
|
|
||
| - Typst 版本:0.13.1+ | ||
| - 首次使用需联网下载依赖库 | ||
|
|
||
| ## 许可证 | ||
|
|
||
| [MIT License](LICENSE) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,273 @@ | ||
| // =========================== | ||
| // HFUT 课程设计报告模板库 | ||
| // =========================== | ||
|
|
||
| // =========================== | ||
| // 第三方库导入 | ||
| // =========================== | ||
| // 导入i-figured库用于公式和图表编号管理 | ||
| #import "@preview/i-figured:0.2.4" | ||
| // 导入格式化工具库(包含中文加粗、斜体、下划线等功能) | ||
| #import "@preview/zh-format:0.1.0": * | ||
|
|
||
| // =========================== | ||
| // 主函数:报告模板配置 | ||
| // =========================== | ||
| #let hfut-report( | ||
| // 基本信息(默认为空) | ||
| title: "", | ||
| department: "", | ||
| major: "", | ||
| class: "", | ||
| author: "", | ||
| student-id: "", | ||
| supervisor: "", | ||
| date: "", | ||
| // 摘要和关键词 | ||
| abstract: [摘要内容...], | ||
| keywords: ("关键词1", "关键词2"), | ||
| // 摘要页开关(true:显示摘要页,false:不显示摘要页) | ||
| show-abstract: true, | ||
| // 目录页开关(true:显示目录页,false:不显示目录页) | ||
| show-contents: true, | ||
| // 页眉配置参数 | ||
| header-logo-height: 0.8cm, | ||
| header-title-size: 9pt, | ||
| header-line-stroke: 0.4pt, | ||
| // 段落首行缩进配置 | ||
| first-line-indent: 0em, | ||
| // equation 计数 | ||
| show-equation: i-figured.show-equation, | ||
| body, | ||
| ) = { | ||
| // =========================== | ||
| // 全局样式配置 | ||
| // =========================== | ||
|
|
||
| // 应用中文格式化(粗体、下划线、斜体) | ||
| show: zh-format | ||
|
|
||
| // 文档元数据 | ||
| set document(author: author, title: title) | ||
|
|
||
| // 页面设置 | ||
| set page( | ||
| paper: "a4", | ||
| margin: (top: 2.5cm, bottom: 2.5cm, left: 2.2cm, right: 2.2cm), | ||
| ) | ||
|
|
||
| // 正文字体设置:Times New Roman + 宋体 | ||
| set text( | ||
| font: ("Times New Roman", "SimSun"), | ||
| lang: "zh", | ||
| size: 12pt, | ||
| ) | ||
|
|
||
| // 段落格式设置:两端对齐 | ||
| set par( | ||
| justify: true, | ||
| leading: 0.65em, | ||
| first-line-indent: 0em, // 默认不缩进 | ||
| ) | ||
|
|
||
| // 标题间距设置 | ||
| show heading: set block(above: 1.4em, below: 1em) | ||
|
|
||
| // 代码块样式设置 | ||
| show raw.where(block: true): block.with( | ||
| fill: luma(240), | ||
| inset: 10pt, | ||
| radius: 4pt, | ||
| width: 100%, | ||
| stroke: 0.5pt + luma(200), | ||
| ) | ||
|
|
||
| // 行内代码样式 | ||
| show raw.where(block: false): box.with( | ||
| fill: luma(240), | ||
| inset: (x: 3pt, y: 0pt), | ||
| outset: (y: 3pt), | ||
| radius: 2pt, | ||
| ) | ||
|
|
||
| // 脚注格式设置:[1] [2] 格式的蓝色上标 | ||
| show footnote: set text(blue) | ||
| set footnote(numbering: "[1]") | ||
|
|
||
| // 每个标题时重置计数器 | ||
| show heading: i-figured.reset-counters | ||
|
|
||
| // 设置 equation 的编号(只对块级公式编号,<-> 标签取消编号) | ||
| show math.equation.where(block: true): show-equation.with( | ||
| only-labeled: false, | ||
| unnumbered-label: "-", | ||
| ) | ||
|
|
||
| // 图表标题样式 | ||
| show figure.caption: set text(font: ("Times New Roman", "SimHei"), size: 10pt) | ||
|
|
||
| // 表格样式 | ||
| show table: set text(size: 10pt) | ||
|
|
||
| // =========================== | ||
| // 封面页 | ||
| // =========================== | ||
| { | ||
| set align(center) | ||
| set page(header: none, footer: none, numbering: none) | ||
|
|
||
| v(0.5cm) | ||
| image("template/assets/HFUT_badge_zh&en_Vertical.svg", width: 7cm) | ||
| v(1cm) | ||
|
|
||
| text(22pt, font: ("Times New Roman", "SimSun"))[ | ||
| *#underline[#title] 课程设计报告* | ||
| ] | ||
|
|
||
| v(3cm) | ||
|
|
||
| grid( | ||
| columns: (auto, 14em), | ||
| rows: auto, | ||
| gutter: 1em, | ||
| row-gutter: 1.2em, | ||
| align: (right, center), | ||
|
|
||
| text(18pt, font: ("Times New Roman", "SimSun"))[*学 院:*], | ||
| u(width: 15em, offset: 0.35em)[#text(16pt)[#department]], | ||
|
|
||
| text(18pt, font: ("Times New Roman", "SimSun"))[*专 业:*], | ||
| u(width: 15em, offset: 0.35em)[#text(16pt)[#major]], | ||
|
|
||
| text(18pt, font: ("Times New Roman", "SimSun"))[*班 级:*], | ||
| u(width: 15em, offset: 0.35em)[#text(16pt)[#class]], | ||
|
|
||
| text(18pt, font: ("Times New Roman", "SimSun"))[*姓 名:*], | ||
| u(width: 15em, offset: 0.35em)[#text(16pt)[#author]], | ||
|
|
||
| text(18pt, font: ("Times New Roman", "SimSun"))[*学 号:*], | ||
| u(width: 15em, offset: 0.35em)[#text(16pt)[#student-id]], | ||
|
|
||
| text(18pt, font: ("Times New Roman", "SimSun"))[*指导教师:*], | ||
| u(width: 15em, offset: 0.35em)[#text(16pt)[#supervisor]], | ||
| ) | ||
|
|
||
| v(2cm) | ||
| text(16pt)[#if date == "today" { datetime.today().display("[year]年[month]月[day]日") } else { date }] | ||
|
|
||
| pagebreak() | ||
| } | ||
|
|
||
| // =========================== | ||
| // 摘要页 | ||
| // =========================== | ||
| if show-abstract { | ||
| set page(header: none, footer: none, numbering: none) | ||
| set align(center) | ||
|
|
||
| text(18pt, font: ("Times New Roman", "SimSun"))[*摘 要*] | ||
| v(1.5em) | ||
|
|
||
| set align(left) | ||
| set par(first-line-indent: 0em) | ||
|
|
||
| abstract | ||
| v(2em) | ||
|
|
||
| set par(first-line-indent: 0em) | ||
| text(font: ("Times New Roman", "SimSun"))[*关键词:*] + keywords.join(";") | ||
|
|
||
| pagebreak() | ||
| } | ||
|
|
||
| // =========================== | ||
| // 正文页眉页脚设置 | ||
| // =========================== | ||
| set page( | ||
| header: [ | ||
| #grid( | ||
| columns: (auto, 1fr), | ||
| align: (left + top, right + top), | ||
| gutter: 0.5em, | ||
| image("template/assets/HFUT_badge_zh_Horizontal.svg", height: header-logo-height), | ||
| [ | ||
| #v(0.8em) | ||
| #text(15pt, font: ("Times New Roman", "SimSun"))[*#title*] | ||
| ], | ||
| ) | ||
| #v(-1.0em) | ||
| #line(length: 100%, stroke: header-line-stroke) | ||
| ], | ||
| footer: context align(center)[ | ||
| #text(10pt)[合肥工业大学 - 第 #counter(page).display("1") 页] | ||
| ], | ||
| numbering: "1", | ||
| ) | ||
|
|
||
| counter(page).update(1) | ||
|
|
||
| // =========================== | ||
| // 目录页 | ||
| // =========================== | ||
| if show-contents { | ||
| // 居中显示目录标题 | ||
| align(center)[ | ||
| #text(18pt, font: ("Times New Roman", "SimSun"))[*目 录*] | ||
| ] | ||
|
|
||
| v(1.5em) | ||
|
|
||
| outline( | ||
| title: none, | ||
| depth: 3, | ||
| indent: auto, | ||
| ) | ||
|
|
||
| pagebreak() | ||
| } | ||
|
|
||
| // =========================== | ||
| // 标题样式配置 | ||
| // =========================== | ||
| // 设置标题自动编号 | ||
| set heading(numbering: "1.1.1") | ||
|
|
||
| show heading.where(level: 1): it => { | ||
| // 一级标题:黑体加粗,视觉突出 | ||
| set text(font: ("Times New Roman", "SimHei"), weight: "bold", size: 18pt) | ||
| set align(center) | ||
|
|
||
| v(0.5em) | ||
| if it.numbering != none { | ||
| block[#counter(heading).display() #it.body] | ||
| } else { | ||
| block[#it.body] | ||
| } | ||
| v(0.5em) | ||
| } | ||
|
|
||
| show heading.where(level: 2): it => { | ||
| // 二级标题:宋体加粗,避免与一级标题冲突 | ||
| set text(font: ("Times New Roman", "SimSun"), weight: "bold", size: 15pt) | ||
| if it.numbering != none { | ||
| block[#counter(heading).display() #it.body] | ||
| } else { | ||
| block[#it.body] | ||
| } | ||
| } | ||
|
|
||
| show heading.where(level: 3): it => { | ||
| // 三级标题:宋体加粗,保持层次一致性 | ||
| set text(font: ("Times New Roman", "SimSun"), weight: "bold", size: 13pt) | ||
| if it.numbering != none { | ||
| block[#counter(heading).display() #it.body] | ||
| } else { | ||
| block[#it.body] | ||
| } | ||
| } | ||
|
|
||
| // =========================== | ||
| // 正文内容 | ||
| // =========================== | ||
| body | ||
| } |
1 change: 1 addition & 0 deletions
1
packages/preview/modern-hfut-report/0.1.0/template/assets/HFUT_badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
...review/modern-hfut-report/0.1.0/template/assets/HFUT_badge_zh&en_Horizontal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
.../preview/modern-hfut-report/0.1.0/template/assets/HFUT_badge_zh&en_Vertical.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions
31
...s/preview/modern-hfut-report/0.1.0/template/assets/HFUT_badge_zh_Horizontal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions
19
...ges/preview/modern-hfut-report/0.1.0/template/assets/HFUT_badge_zh_Vertical.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
packages/preview/modern-hfut-report/0.1.0/template/assets/HFUT_zh&en.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
packages/preview/modern-hfut-report/0.1.0/template/assets/HFUT_zh.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.