diff --git a/packages/preview/mcm-scaffold/0.2.2/LICENSE b/packages/preview/mcm-scaffold/0.2.2/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/packages/preview/mcm-scaffold/0.2.2/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packages/preview/mcm-scaffold/0.2.2/README.md b/packages/preview/mcm-scaffold/0.2.2/README.md new file mode 100644 index 0000000000..12823ef702 --- /dev/null +++ b/packages/preview/mcm-scaffold/0.2.2/README.md @@ -0,0 +1,55 @@ +# mcm-scaffold +This is a Typst template for COMAP's Mathematical Contest in MCM/ICM. + +## Usage +You can use this template in the Typst web app by clicking "Start from template" +on the dashboard and searching for `mcm-scaffold`. + +Alternatively, you can use the CLI to kick this project off using the command +``` +typst init @preview/mcm-scaffold +``` + +Typst will create a new directory with all the files needed to get you started. + +## Configuration +This template exports the `mcm` function with the following named arguments: + +- `title`: The paper's title as content. +- `problem-chosen`: The problem your team have chosen. +- `team-control-number`: Your team control number. +- `year`: When did the competition took place. +- `summary`: The content of a brief summary of the paper. Appears at the top of the first column in boldface. +- `keywords`: Keywords of the paper. +- `magic-leading`: adjust the leading of the summary. + +The function also accepts a single, positional argument for the body of the +paper. + +The template will initialize your package with a sample call to the `mcm` +function in a show rule. If you want to change an existing project to use this +template, you can add a show rule like this at the top of your file: + +```typ +#import "@preview/mcm-scaffold:0.2.2": * + +#show: mcm.with( + title: "A Simple Example for MCM/ICM Typst Template", + problem-chosen: "ABCDEF", + team-control-number: "1111111", + year: "2025", + summary: [ + #lorem(100) + + #lorem(100) + + #lorem(100) + + #lorem(100) + ], + keywords: [MCM; ICM; Mathemetical; template], + magic-leading: 0.65em, +) + +// Your content goes below. +``` \ No newline at end of file diff --git a/packages/preview/mcm-scaffold/0.2.2/lib.typ b/packages/preview/mcm-scaffold/0.2.2/lib.typ new file mode 100644 index 0000000000..47e396e636 --- /dev/null +++ b/packages/preview/mcm-scaffold/0.2.2/lib.typ @@ -0,0 +1,282 @@ +#let text-font = ("Times New Roman", "TeX Gyre Termes") + +#let mcm( + title: "A Typst Template for MCM/ICM", + problem-chosen: "ABCDEF", + team-control-number: "1111111", + year: "2025", + summary: [], + keywords: [], + magic-leading: 0.65em, + body, +) = { + set document(title: team-control-number) + + set text( + font: text-font, + size: 12pt, + lang: "en" + ) + + //----------------------------summary-------------------------// + [ + #set page( + paper: "us-letter", + margin: (top: 1.02cm, bottom: 0cm, left: 2.54cm, right: 2.54cm) + ) + + #set par( + justify: true, + first-line-indent: 2em + ) + + #grid( + columns: (5.63cm,) * 3, + rows: (14pt,) * 3, + align: center + horizon, + + [*Problem Chosen*], [*#year*], [*Team Control Number*], + grid.cell(rowspan: 2, text(size: 20pt)[#problem-chosen]), + [*MCM/ICM*], + grid.cell(rowspan: 2, text(size: 20pt)[#team-control-number]), + [*Summary Sheet*] + ) + + #line(length: 100%, stroke: (thickness: 1.1pt, dash: "solid")) + + #align(center)[#text()[*#title*]] + + #align(center)[#text()[*Summary*]] + + #par(leading: magic-leading)[#summary] + + *Keywords:* #keywords + + #counter(page).update(0) + // #pagebreak() + ] + //-----------------------------------------------------------// + + + + set page( + paper: "us-letter", + margin: (top: 2.54cm, bottom: 2.54cm, left: 2.54cm, right: 2.54cm), + header: [ + Team \# #team-control-number + #h(1fr) + Page + #context counter(page).display( + "1 of 1", + both: true, + ) + #v(-0.8em) + #line(length: 100%, stroke: (thickness: 0.6pt, dash: "solid")) + ] + ) + + + +//--------------------------outline---------------------------// + + show outline.entry.where( + level: 1 + ): it => { + v(12pt, weak: true) + strong(it) + } + + show heading.where(outlined: false): set align(center) + + outline( + indent: auto, + ) + + pagebreak() + + +//--------------------------heading---------------------------// + let empty-par = par[#box()] + let fake-par = context empty-par + v(-measure(empty-par + empty-par).height) + + set heading( + numbering: "1.1 " + ) + + show heading: it => [#it #v(4pt)] + show heading.where(level: 1): it => [#it #v(4pt)] + show heading: it => it + fake-par + + + +//-------------------------paragraph--------------------------// + set par( + justify: true, + first-line-indent: 2em + ) + + + //-------------------------list-----------------------------// + set list(indent: 1em) + set enum(indent: 1em) + show enum: it => it + fake-par + +//--------------------------figure----------------------------// + set figure(gap: 1em) + show figure: it => it + fake-par + +//---------------------------image----------------------------// + set image(width: 70%) + + +//---------------------------table----------------------------// + show figure.where( + kind: table + ): set figure.caption(position: top) + + show table.cell.where(y: 0): strong + show table.cell.where(y: 0): set par(justify: false) + + +//---------------------------math-----------------------------// + set math.equation(numbering: "(1)") + show math.equation.where(block: true): it => it + fake-par + + +//-------------------------reference--------------------------// + + set bibliography(title: "References") + + +//---------------------------code-----------------------------// + show raw.where(block: false): it => box( + fill: luma(240), inset: (x: 2pt), outset: (y: 3pt), radius: 1pt + )[#text(size: 10pt)[#it]] + + show raw.where(block: true): it => block( + width: 100%, fill: luma(240), inset: 10pt, radius: 3pt, stroke: 0pt, breakable: true + )[#it] + fake-par + + +//------------------------------------------------------------// + body +} + + +//---------------------------enum-----------------------------// +#let enum-default = { set enum(numbering: "1.") } + +#let enum-paren(content) = { + set enum(numbering: "1)") + content + enum-default +} + + +//---------------------------image----------------------------// +#let img-single(img: image, caption: none, placement: none) = { + figure( + img, + caption: caption, + placement: placement + ) +} +// #let img-single(path: str, width: 70%, caption: none, placement: none) = { +// figure( +// image(path, width: width), +// caption: caption, +// placement: placement +// ) +// } + +#let img-grid(cols: 2, rows: 1, imgs: array, subcaps: (), caption: none, placement: none) = { + assert(cols * rows == imgs.len()) + + let col-width = () + let row-height = () + + let i = cols + while i > 0 { + col-width.push(90%/cols) + i -= 1 + } + + let i = rows + while i > 0 { + row-height.push(auto) + i -= 1 + } + + // subcap completion + let i = imgs.len() - subcaps.len() + while i > 0 { + subcaps.push(none) + i -= 1 + } + + // cells + let cells = () + let i = 0 + while i < rows { + let j = 0 + while j < cols { + cells.push( + // grid.cell(image(imgs.at(i * cols + j), width: 70%), align: bottom) + grid.cell(imgs.at(i * cols + j), align: bottom) + ) + j += 1 + } + let k = 0 + while k < cols { + cells.push( + grid.cell(subcaps.at(i * cols + k), align: top) + ) + k += 1 + } + i += 1 + } + + rows += 1 + figure( + grid( + columns: col-width, + rows: row-height, + column-gutter: 0.5em, + row-gutter: 0.5em, + align: bottom, + ..cells, + ), + caption: caption, + placement: placement + ) +} + +//---------------------------table----------------------------// +#let threee-line-table(columns: array, align: auto, headers: array, bodies: array, caption: content) = { + figure( + table( + columns: columns, + align: align, + stroke: (_, y) => ( + top: if y == 0 {1pt} else if y == 1 {0.6pt} else {0pt}, + bottom: 1pt, + ), + ..headers, + ..bodies, + ), + caption: caption + ) +} + +//---------------------------tools----------------------------// +#let no-indent = context h(-par.first-line-indent.amount) + +#let math-no-number(content) = { + set math.equation(numbering: none) + content +} + +#let place-here(it) = { + set figure(placement: auto) + it +} \ No newline at end of file diff --git a/packages/preview/mcm-scaffold/0.2.2/template/figures/image1.png b/packages/preview/mcm-scaffold/0.2.2/template/figures/image1.png new file mode 100644 index 0000000000..919c2806ee Binary files /dev/null and b/packages/preview/mcm-scaffold/0.2.2/template/figures/image1.png differ diff --git a/packages/preview/mcm-scaffold/0.2.2/template/main.typ b/packages/preview/mcm-scaffold/0.2.2/template/main.typ new file mode 100644 index 0000000000..d81e2e1e5b --- /dev/null +++ b/packages/preview/mcm-scaffold/0.2.2/template/main.typ @@ -0,0 +1,579 @@ +#import "@preview/mcm-scaffold:0.2.2": * +#import "@preview/mitex:0.2.5": * + +#show: mcm.with( + title: "A Simple Example for MCM/ICM Typst Template", + problem-chosen: "ABCDEF", + team-control-number: "1111111", + year: "2025", + summary: [ + #lorem(100) + + #lorem(100) + + #lorem(100) + + #lorem(100) + ], + keywords: [MCM; ICM; Mathemetical; template], + magic-leading: 0.65em, +) + +///////////////////////Body////////////////////////// + += Introduction + +Create a new file and start with following lines. + +```typst +#import "@preview/mcm-scaffold:0.2.2": * + +#show: mcm.with( + title: "A Simple Example for MCM/ICM Typst Template", + problem-chosen: "ABCDEF", + team-control-number: "1111111", + year: "2025", + summary: [ + ], + keywords: [MCM; ICM; Mathemetical; template], + magic-leading: 0.65em, +) + +///////////////////////Body////////////////////////// += Introduction +``` + += Images + +== Single Image + +```typst +#img-single(img: image, caption: none, placement: none) +``` + +=== An image with default width and no caption + +```typst +#img-single(img: image("figures/image1.png")) +``` + +// #img-single(path: "template/figures/image1.png") +#img-single(img: image("figures/image1.png")) + +=== An image with caption + +```typst +#img-single(img: image("figures/image1.png"), caption:[workflow]) +``` + +// #img-single(path: "template/figures/image1.png", caption:[workflow]) +#img-single(img: image("figures/image1.png"), caption:[workflow]) + +=== Adjust width + +```typst +#img-single( + img: image("figures/image1.png", width: 50%), + caption:[image of 50% width (default 70%).] +) +``` + +// #img-single( +// path: "template/figures/image1.png", +// width: 50%, +// caption:[image of 50% width (default 70%).] +// ) +#img-single( + img: image("figures/image1.png", width: 50%), + caption:[image of 50% width (default 70%).] +) + +=== Specify image placement + +```t +placement: none(default)/auto/top/buttom +``` + + +I put 3 images right below the code. + +```typst +#img-single( + img: image("figures/image1.png", width: 40%), + caption:[placement: top (default none).], + placement: top +) + +#img-single( + img: image("figures/image1.png", width: 40%), + caption:[placement: top (default none).], + placement: auto +) + +#img-single( + img: image("figures/image1.png", width: 40%), + caption:[placement: top (default none).], + placement: bottom +) +``` + +See where the images are gone: + +// #img-single( +// path: "template/figures/image1.png", +// width: 40%, +// caption:[placement: top (default none).], +// placement: top +// ) +#img-single( + img: image("figures/image1.png", width: 40%), + caption:[placement: top (default none).], + placement: top +) + +// #img-single( +// path: "template/figures/image1.png", +// width: 40%, +// caption:[placement: auto (default none).], +// placement: auto +// ) +#img-single( + img: image("figures/image1.png", width: 40%), + caption:[placement: top (default none).], + placement: auto +) + +// #img-single( +// path: "template/figures/image1.png", +// width: 40%, +// caption:[placement: bottom (default none).], +// placement: bottom +// ) +#img-single( + img: image("figures/image1.png", width: 40%), + caption:[placement: top (default none).], + placement: bottom +) + +#pagebreak() + +== Multiple Images + +If you want to show multiple images in one figure, try this. + +```typst +#img-grid( + cols: 2, + rows: 1, + imgs: array, + subcaps: (), + caption: none, + placement: none +) +``` + +=== Two images in default + +If not specified cloumns and rows, $1 times 2$ grid is in default. + +```typst +#img-grid( + imgs: (image("figures/image1.png", width:70%), image("figures/image1.png", width:70%)), +) +``` + +#img-grid( + imgs: (image("figures/image1.png", width:70%), image("figures/image1.png", width:70%)), +) + +=== Subcaptions + +```typst +#img-grid( + imgs: (image("figures/image1.png", width:70%), image("figures/image1.png", width:70%)), + subcaps: ([(a)], [(b)]), + caption: [Two images with subcaptions.] +) +``` + +#img-grid( + imgs: (image("figures/image1.png", width:70%), image("figures/image1.png", width:70%)), + subcaps: ([(a)], [(b)]), + caption: [Two images with subcaptions.] +) + +=== More images to show! + +You can specify the columns and rows to put more images as you like. + +```typst +#img-grid( + cols: 2, rows: 2, + imgs: (image("figures/image1.png", width:70%),) * 4, + subcaps: ([(a)], [(b)], [(c)], [(d)]), + caption: [Four images with subcaptions.] +) +``` + +#img-grid( + cols: 2, rows: 2, + imgs: (image("figures/image1.png", width:70%),) * 4, + subcaps: ([(a)], [(b)], [(c)], [(d)]), + caption: [Four images with subcaptions.] +) + +```typst +#img-grid( + cols: 3, rows: 2, + imgs: (image("figures/image1.png", width:70%),) * 6, + subcaps: ([(a)], [(b)], [(c)], [(d)], [(e)], [(f)]), + caption: [Six images with subcaptions.] +) +``` + +#img-grid( + cols: 3, rows: 2, + imgs: (image("figures/image1.png", width:70%),) * 6, + subcaps: ([(a)], [(b)], [(c)], [(d)], [(e)], [(f)]), + caption: [Six images with subcaptions.] +) + +```typst +#img-grid( + cols: 4, rows: 3, + imgs: (image("figures/image1.png", width:70%),) * 12, + subcaps: ( + [(a)], [(b)], [(c)], [(d)], [(e)], [(f)], + [(g)], [(h)], [(i)], [(j)], [(k)], [(l)], + ), + caption: [Twelve images with subcaptions.] +) +``` + +#img-grid( + cols: 4, rows: 3, + imgs: (image("figures/image1.png", width:70%),) * 12, + subcaps: ( + [(a)], [(b)], [(c)], [(d)], [(e)], [(f)], + [(g)], [(h)], [(i)], [(j)], [(k)], [(l)], + ), + caption: [Twelve images with subcaptions.] +) + += Table + +```typst +#threee-line-table( + columns: array, + align: auto, + headers: array, + bodies: array, + caption: content +) +``` + +== Simple three-line-table + +ex: Symbols and notations are listed in the @SymbolDescription + +```typst +Symbols and notations are listed in the @SymbolDescription + +#threee-line-table( + columns: (25%, 60%), // Set colum width(auto/10%/1ft/1pt) + headers: ([Symbol], [Explain]), + bodies: ( + [$S_t$], [state of submersible], + [$f_m$], [standard equation of motion], + [$P_k^(\(t\))$], [probability of appearance], + [$R$], [usability score], + [$T_S$], [search mission point set], + [$S_M$], [submersible set], + [$T_D$], [assigned but uncompleted search mission point set], + [$T_U$], [mission point set that violates the assignment] + ), + caption: "Symbol Description", +) //ref label +``` + +#threee-line-table( + columns: (25%, 60%), + headers: ([Symbol], [Explain]), + // align: (left, right), + bodies: ( + [$S_t$], [state of submersible], + [$f_m$], [standard equation of motion], + [$P_k^(\(t\))$], [probability of appearance], + [$R$], [usability score], + [$T_S$], [search mission point set], + [$S_M$], [submersible set], + [$T_D$], [assigned but uncompleted search mission point set], + [$T_U$], [mission point set that violates the assignment] + ), + caption: "Symbol Description", +) + +== Width and alignment + +```typst +Symbols and notations are listed in the @SymbolDescription + +#threee-line-table( + columns: (auto, 60%), + align: (right, center), // right/center/left + headers: ([Symbol], [Explain]), + bodies: ( + [$S_t$], [state of submersible], + [$f_m$], [standard equation of motion], + [$P_k^(\(t\))$], [probability of appearance], + [$R$], [usability score], + [$T_S$], [search mission point set], + [$S_M$], [submersible set], + [$T_D$], [assigned but uncompleted search mission point set], + [$T_U$], [mission point set that violates the assignment] + ), + caption: "Symbol Description", +) //ref label +``` + +#threee-line-table( + columns: (auto, 60%), + align: (right, center), + headers: ([Symbol], [Explain]), + bodies: ( + [$S_t$], [state of submersible], + [$f_m$], [standard equation of motion], + [$P_k^(\(t\))$], [probability of appearance], + [$R$], [usability score], + [$T_S$], [search mission point set], + [$S_M$], [submersible set], + [$T_D$], [assigned but uncompleted search mission point set], + [$T_U$], [mission point set that violates the assignment] + ), + caption: "Symbol Description", +) + += Enum + +```typst +#let enum-default = { set enum(numbering: "1.") } + +#let enum-paren(content) = { + set enum(numbering: "1)") + content + enum-default +} +``` + +== Tight and loose list + +A tight enum would like this: + +```typst ++ item1 ++ item2 ++ item3 +``` + ++ item1 ++ item2 ++ item3 + +To make it loose, add a blank line after the first line: + +```typst ++ #lorem(30) + ++ #lorem(30) + ++ #lorem(30) +``` + ++ #lorem(30) + ++ #lorem(30) + ++ #lorem(30) + +== Change numbering + +```typst +#enum-paren()[ + + #lorem(20) + + #lorem(20) + + #lorem(20) +] +``` + +#enum-paren()[ + + #lorem(20) + + + #lorem(20) + + + #lorem(20) +] + += References + +== bib + +Put ``` references.bib ``` in your project file. and use ``` @ ``` to ref them. @2017YOLO9000 + +```typst +For, emample. @2018YOLOv3 +``` + +For, emample. @2018YOLOv3 + +== plain text(by yml) + +If you want to use plaintext reference directory, there is a trick: Edit references.yml and replace publisher by reference text. + +```yml +ref1: + type: Article + publisher: "ZygOS: Achieving Low Tail Latency for Microse" + +ref2: + type: Article + publisher: "article title here" +``` + += Appendix + +```typ +#heading("Appendix A ", numbering: none, outlined: false) + +`` `py +import ... +`` ` + + +``` + += Handful tools + +== Paragraph with no indent + +Paragraphs after figure, table or maths will be automatically with indent. Sometimes we don't need the indent. + +```typst +#no-indent() +content below +``` + +For example, after a math block, + +$ y = x^2 $ + +The aragraph after the block is with indent. + +```typst +$ y = x^2 $ + +#no-indent +Paragraph with no indent. +``` + +$ y = x^2 $ + +#no-indent +Paragraph with no indent. + +== Math without numbering + +```typst +#math-no-number( +$ y = sqrt(x) $ +) +``` + +#math-no-number( +$ y = sqrt(x) $ +) + +== Figures fly away? Place here! + +Sometimes, images or tables will fly away and left a huge blank place. Use ``` #place-here() ``` to catch them back! + +```typst +#place-here()[ +#threee-line-table( + columns: 7 * (10%, ), + headers: ([a], [u], [v], [w], [p], [q], [r]), + bodies: ([30], [10], [-8], [-2], [0.01], [0.004], [0.001]), + caption: [A simpel table] +) +] +``` + +#place-here()[ +#threee-line-table( + columns: 7 * (10%, ), + headers: ([a], [u], [v], [w], [p], [q], [r]), + bodies: ([30], [10], [-8], [-2], [0.01], [0.004], [0.001]), + caption: [A simpel table] +) +] + +== Latex math eqaution + +Support Mitex, ```typst #mitext('')``` + +```typst +#mitext(` +\begin{equation} +SSIM(x,y)=\frac{\left(2\mu_x\mu_y+c1\right)\left(\sigma_{xy}+c2\right)} +{\left(\mu_x^2+\mu_y^2+c1\right)\left(\sigma_x^2+\sigma_y^2+c2\right)} +\end{equation} + +Where $\mu_x$ is the average of x, $\mu_y$ is the average of y, $\sigma_x^2$ is the variance of x, $\sigma_y^2$ is the variance of y, and $\sigma_{xy}$ is the covariance of x and y. C1=(k1L)2, C1=(k1L)2, is a constant used to maintain stability. L is the dynamic range of the pixel value. K1 = 0.01, k2 = 0.03. The structural similarity ranges from 0 to 1. When the two images are identical, the value of SSIM is equal to one. +`) +``` + +#mitext(` +\begin{equation} +SSIM(x,y)=\frac{\left(2\mu_x\mu_y+c1\right)\left(\sigma_{xy}+c2\right)} +{\left(\mu_x^2+\mu_y^2+c1\right)\left(\sigma_x^2+\sigma_y^2+c2\right)} +\end{equation} + +Where $\mu_x$ is the average of x, $\mu_y$ is the average of y, $\sigma_x^2$ is the variance of x, $\sigma_y^2$ is the variance of y, and $\sigma_{xy}$ is the covariance of x and y. C1=(k1L)2, C1=(k1L)2, is a constant used to maintain stability. L is the dynamic range of the pixel value. K1 = 0.01, k2 = 0.03. The structural similarity ranges from 0 to 1. When the two images are identical, the value of SSIM is equal to one. +`) + +#bibliography("references.bib") + +#pagebreak() + +#heading("Appendix A ", numbering: none, outlined: false) + +```py +import cv2 +import numpy as np +import matplotlib.pyplot as plt +from skimage import exposure +from skimage.exposure import match_histograms + + +def plot(img): + plt.subplot(121) + plt.imshow(img, 'gray') + plt.subplot(122) + plt.hist(img.ravel(), 256, [0, 256]) + plt.show() + + +if __name__ == '__main__': + img = cv2.imread('img1.png', cv2.IMREAD_GRAYSCALE) + hist = cv2.calcHist([img], [0], None, [256], [0, 256]) + plot(img) + + equ = cv2.equalizeHist(img) + plot(equ) + + target = cv2.imread('mask.png', cv2.IMREAD_GRAYSCALE) + target_hist = cv2.calcHist([target], [0], None, [256], [0, 256]) + plot(target) + + matched = match_histograms(img, target) + plot(matched) +``` diff --git a/packages/preview/mcm-scaffold/0.2.2/template/references.bib b/packages/preview/mcm-scaffold/0.2.2/template/references.bib new file mode 100644 index 0000000000..ca75e249b6 --- /dev/null +++ b/packages/preview/mcm-scaffold/0.2.2/template/references.bib @@ -0,0 +1,14 @@ +@inproceedings{2017YOLO9000, + title={YOLO9000: Better, Faster, Stronger}, + author={ Redmon, J. and Farhadi, A. }, + booktitle={IEEE Conference on Computer Vision \& Pattern Recognition}, + pages={6517-6525}, + year={2017}, +} + +@article{2018YOLOv3, + title={YOLOv3: An Incremental Improvement}, + author={ Redmon, J. and Farhadi, A. }, + journal={arXiv e-prints}, + year={2018}, +} diff --git a/packages/preview/mcm-scaffold/0.2.2/template/references.yml b/packages/preview/mcm-scaffold/0.2.2/template/references.yml new file mode 100644 index 0000000000..fe8c0fe176 --- /dev/null +++ b/packages/preview/mcm-scaffold/0.2.2/template/references.yml @@ -0,0 +1,7 @@ +ref1: + type: Article + publisher: "ZygOS: Achieving Low Tail Latency for Microse" + +ref2: + type: Article + publisher: "article title here" \ No newline at end of file diff --git a/packages/preview/mcm-scaffold/0.2.2/thumbnail.png b/packages/preview/mcm-scaffold/0.2.2/thumbnail.png new file mode 100644 index 0000000000..5e5592b8ba Binary files /dev/null and b/packages/preview/mcm-scaffold/0.2.2/thumbnail.png differ diff --git a/packages/preview/mcm-scaffold/0.2.2/typst.toml b/packages/preview/mcm-scaffold/0.2.2/typst.toml new file mode 100644 index 0000000000..801e980219 --- /dev/null +++ b/packages/preview/mcm-scaffold/0.2.2/typst.toml @@ -0,0 +1,16 @@ +[package] +name = "mcm-scaffold" +version = "0.2.2" +entrypoint = "lib.typ" +repository = "https://github.com/sxdl/MCM-Typst-template" +authors = ["LuoQiu "] +license = "Apache-2.0" +description = "A Typst template for COMAP's Mathematical Contest in MCM/ICM" +keywords = ["MCM", "ICM"] +categories = ["thesis"] +disciplines = ["mathematics", "computer-science"] + +[template] +path = "template" +entrypoint = "main.typ" +thumbnail = "thumbnail.png" \ No newline at end of file