-
Notifications
You must be signed in to change notification settings - Fork 1.1k
bubble-sysu:0.1.0 #4882
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
Open
yuanlx27
wants to merge
1
commit into
typst:main
Choose a base branch
from
yuanlx27:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
bubble-sysu:0.1.0 #4882
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) 2026 Langxi Yuan <yuanlx27@mail2.sysu.edu.cn> | ||
|
|
||
| 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,67 @@ | ||
| # bubble-sysu | ||
|
|
||
| A Typst template for reports at Sun Yat-sen University. | ||
|
|
||
| ## Usage | ||
|
|
||
| Install required fonts from links below or from [release](https://github.com/yuanlx27/bubble-sysu/releases/tag/v0.1.0). | ||
|
|
||
| Create a new project from this template with the Typst CLI: | ||
|
|
||
| ```sh | ||
| typst init @preview/bubble-sysu:0.1.0 | ||
| ``` | ||
|
|
||
| Or import the template in an existing Typst document: | ||
|
|
||
| ```typst | ||
| #import "@preview/bubble-sysu:0.1.0": * | ||
|
|
||
| #show: report.with( | ||
| title: "实验一:词法分析", | ||
| subtitle: "编译原理实验报告", | ||
| student: (name: "张三", id: "23330101"), | ||
| school: "计算机学院", | ||
| major: "计算机科学与技术", | ||
| class: "计八班", | ||
| ) | ||
| ``` | ||
|
|
||
| ## Template Parameters | ||
|
|
||
| The `report` template accepts the following parameters: | ||
|
|
||
| | Parameter | Type | Default | Description | | ||
| | --- | --- | --- | --- | | ||
| | `title` | `str` | `"标题"` | Main title shown on the cover page. | | ||
| | `subtitle` | `str` | `"副标题"` | Subtitle shown below the main title. | | ||
| | `student` | `dictionary` | `(name: "姓名", id: "学号")` | Student information displayed on the cover page. | | ||
| | `school` | `str` | `"学院"` | School name. | | ||
| | `major` | `str` | `"专业"` | Major name. | | ||
| | `class` | `str` | `"班级"` | Class name. | | ||
| | `date` | `datetime` | `datetime.today()` | Date shown on the cover page. | | ||
| | `logo` | `bool` | `true` | Whether to display the university logo. | | ||
| | `accent-color` | `color` | `rgb(0, 86, 32)` | Main decorative color used on the cover page. | | ||
| | `alpha` | `ratio` | `60%` | Opacity used when mixing the secondary decorative color. | | ||
| | `body` | `content` | — | Report body content. | | ||
|
|
||
| ## Features | ||
|
|
||
| - Cover page tailored for Sun Yat-sen University reports | ||
| - Chinese heading numbering style for top-level headings | ||
| - Built-in styles for links, inline code, and code blocks | ||
| - Configurable accent color and optional university logo | ||
|
|
||
| ## Fonts | ||
|
|
||
| This template uses the following fonts: | ||
|
|
||
| - [`ChillKai`](https://github.com/Warren2060/Chillkai) | ||
| - [`Maple Mono NFMono`](https://github.com/johnsmith0x3f/maple-mono-custom) | ||
| - [`Noto Serif CJK SC`](https://github.com/notofonts/noto-cjk) | ||
|
|
||
| Make sure they are installed on your system for the intended appearance. | ||
|
|
||
| ## License | ||
|
|
||
| This project is licensed under the MIT License. | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ | ||
| #import "report.typ": report |
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,97 @@ | ||
| #let report( | ||
| title: "标题", | ||
| subtitle: "副标题", | ||
| student: (name: "姓名", id: "学号"), | ||
| school: "学院", | ||
| major: "专业", | ||
| class: "班级", | ||
| date: datetime.today(), | ||
| logo: true, | ||
| accent-color: rgb(0, 86, 32), | ||
| alpha: 60%, | ||
| body, | ||
| ) = { | ||
| set document( | ||
| author: student.name, | ||
| title: title, | ||
| ) | ||
|
|
||
| set heading(numbering: (..nums) => { | ||
| let nums = nums.pos() | ||
|
|
||
| if nums.len() == 1 { | ||
| numbering("一", ..nums) | ||
| } else { | ||
| numbering("1.1", ..nums) | ||
| } | ||
| }) | ||
|
|
||
| set par(justify: true) | ||
|
|
||
| set text( | ||
| font: "Noto Serif CJK SC", | ||
| lang: "zh", | ||
| size: 12pt, | ||
| ) | ||
|
|
||
| show link: set text(fill: blue) | ||
|
|
||
| show raw: set text( | ||
| font: "Maple Mono NFMono", | ||
| features: ("cv01", "cv02", "cv04"), | ||
| ) | ||
| show raw.where(block: true): it => block( | ||
| fill: luma(90%), | ||
| inset: 1em, | ||
| radius: 0.2em, | ||
| width: 100%, | ||
| it, | ||
| ) | ||
| show raw.where(block: false): it => box( | ||
| fill: luma(90%), | ||
| inset: (x: 0.2em), | ||
| outset: (y: 0.2em), | ||
| radius: 0.2em, | ||
| it, | ||
| ) | ||
|
|
||
| let primary-color = accent-color | ||
| let secondary-color = color.mix(color.rgb(100%, 100%, 100%, alpha), primary-color, space:rgb) | ||
|
|
||
| page({ | ||
| if logo == true { | ||
| place(top + right, image("../assets/images/logo.png", width: 40%)) | ||
| } | ||
| place(top + left, dx: -35%, dy: -28%, circle(radius: 150pt, fill: primary-color)) | ||
| place(top + left, dx: -10%, circle(radius: 75pt, fill: secondary-color)) | ||
| place(bottom + right, dx: 40%, dy: 30%, circle(radius: 150pt, fill: secondary-color)) | ||
|
|
||
| set align(center) | ||
|
|
||
| v(2fr) | ||
|
|
||
| text(size: 3em, weight: "bold", title) | ||
|
|
||
| v(0em) | ||
|
|
||
| text(size: 2em, weight: "bold", subtitle) | ||
|
|
||
| v(0em) | ||
|
|
||
| text(size: 1.2em, date.display()) | ||
|
|
||
| v(2fr) | ||
|
|
||
| text(font: "ChillKai", size: 1.5em, weight: "bold", student.name + " " + student.id) | ||
|
|
||
| v(0em) | ||
|
|
||
| text(font: "ChillKai", size: 1.2em, school + " " + major) | ||
|
|
||
| v(0em) | ||
|
|
||
| text(font: "ChillKai", size: 1.2em, class) | ||
| }) | ||
|
|
||
| body | ||
| } |
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,10 @@ | ||
| #import "@preview/bubble-sysu:0.1.0": * | ||
|
|
||
| #show: report.with( | ||
| title: "实验一:词法分析", | ||
| subtitle: "编译原理实验报告", | ||
| student: (name: "张三", id: "23330101"), | ||
| school: "计算机学院", | ||
| major: "计算机科学与技术", | ||
| class: "计八班", | ||
| ) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,14 @@ | ||
| [package] | ||
| name = "bubble-sysu" | ||
| version = "0.1.0" | ||
| entrypoint = "src/lib.typ" | ||
| authors = ["Langxi Yuan <yuanlx27@mail2.sysu.edu.cn>"] | ||
| license = "MIT" | ||
| description = "Reports at Sun Yat-Sen University." | ||
| keywords = ["sysu"] | ||
| categories = ["report"] | ||
|
|
||
| [template] | ||
| path = "template" | ||
| entrypoint = "main.typ" | ||
| thumbnail = "thumbnail.png" |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this also true for the logo you ship? If not, can you specify under which terms it is distributed and can be used, please? And in case you are not allowed by the university to re-distribute it as part of a template, can you replace it with placeholder content and add instructions on how to manually import the logo (which would require a new parameter to allow the user to pass arbitrary content as a logo).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the reminder, I'll check it now.