Compare commits

...

8 Commits

9 changed files with 707 additions and 285 deletions

View File

@@ -0,0 +1,39 @@
---
name: commit-messages
description: >-
Write short git commit messages, preferably under 20 words. Use when drafting
commits, writing commit messages, amending commits, or creating pull request
titles and summaries.
---
# Commit Messages
Keep commit messages **short**. Prefer **under 20 words** total.
## Rules
1. **One line** — subject only; no body unless the user asks for one.
2. **Imperative mood** — "Add table", not "Added table" or "Adds table".
3. **Say what changed** — lead with the action; drop filler ("this commit", "in order to").
4. **No lists** — one change per commit when possible; if many changes, summarize the main one.
5. **Count words** before committing; trim if over 20.
## Format
```
<verb> <what> [<optional context>]
```
Optional conventional prefix when it helps: `feat:`, `fix:`, `refactor:`, `docs:`.
## Examples
| Bad (too long) | Good |
|---|---|
| Add structured tables for test conditions and ink formula in product test template. | Add horizontal ink formula table |
| Refactor templates for consistency and clarity across travel and product test reports. | Align product test header with travel template |
| Update README to reflect new templates and usage examples for both report types. | Update README with template examples |
## PR titles
Apply the same limit to PR titles. PR body can be slightly longer but keep the summary to 1–3 short bullets.

View File

@@ -0,0 +1,49 @@
---
name: tinymist
description: >-
Compile and check Typst documents in this project with tinymist, not typst-cli.
Use when compiling .typ files, checking Typst errors, or validating report output.
---
# Use Tinymist for Typst
Always use **tinymist**, never `typst` CLI. Do not download or install typst.
## Binary
```bash
/home/diaco/.local/bin/tinymist
```
Fallback: `tinymist` if on PATH.
## Compile
From project root:
```bash
tinymist compile --font-path template_files main.typ main.pdf
```
Other entry points:
```bash
tinymist compile --font-path template_files main.travel-report-example.typ
tinymist compile --font-path template_files main.product-test-example.typ
```
Always pass `--font-path template_files` (fonts: `IRNazanin`, `IRZar`).
## Check errors
Use `tinymist compile` — errors print to stderr. For a quick pass/fail:
```bash
tinymist test main.typ
```
## Do not
- Run `typst compile`
- Download typst from GitHub releases
- Install typst via cargo unless the user explicitly asks

10
.zed/settings.json Normal file
View File

@@ -0,0 +1,10 @@
{
"lsp": {
"tinymist": {
"settings": {
"exportPdf": "onSave",
"outputPath": "$root/$dir/$name"
}
}
}
}

105
README.md
View File

@@ -1,42 +1,92 @@
# Typst Templates
A collection of Typst templates for creating professional documents.
A collection of Typst templates for creating professional Persian (RTL) reports for Kimia Razi.
## Templates
### Paper Template (`paper_template.typ`)
A professional document template with:
- Custom header and footer
- Persian and English font support
- Configurable page margins
- Title, author, and date formatting
- Support for sections and structured content
This repository contains three templates:
### Paper Template (`paper_template.typ`)
A general working-paper / report template (based on the SSRN paper layout). It exposes a `paper` function with:
- Persian (RTL) layout with custom fonts (`IRNazanin`, `IRZar`, `IRLotus`)
- A rotated sidebar background showing company, title, destinations, and page number
- A logo header that appears from the second page onward
- Configurable `title`, `subtitle`, `company`, `authors`, `destinations`, `purpose`, and `date`
- Numbered headings, equations, and footnotes
### Product Test Template (`product_test_template.typ`)
A template for raw-material / product test reports. It builds on the `paper` function and adds helper functions for tabular results:
- `general_info_table(...)` – general report information (dates, sample type, count, supplier)
- `received_samples_table(rows)` – structured table of received samples
- `sample_section(...)` / `sample_entry(...)` – per-sample heading and info blocks
- `test_result_table(cols)` / `pigment_result_block(name, rows)` – non-breakable result tables grouped per sample
### Travel Report Template (`travel-report-template.typ`)
A template for mission / travel reports. It exposes a `report` function and a `report-table` helper with:
- Persian (RTL) layout with fonts loaded from `template_files/`
- A title block with company, subtitle, and logo
- A general-info section (destination, purpose, team, date)
- A rotated sidebar background with destinations, authors, and page number
## Examples
- `main.product-test-example.typ` – a completed product test report (Esmaltes pigments) using `product_test_template.typ`
- `main.travel-report-example.typ` – a completed mission report using `travel-report-template.typ`
### Main Template (`main.typ`)
Extended template for comprehensive reports including:
- Multi-language support (Persian/English)
- Professional styling
- Tables and figures support
- Bibliography and citations
- Custom layout options
## Usage
### Basic Usage
### Product test report
```typst
#import "paper_template.typ": *
#import "product_test_template.typ": *
#show: project.with(
title: "Your Document Title",
author: "Your Name",
date: datetime.today().display()
#show: paper.with(
title: "گزارش تست مواد اولیه",
subtitle: "دپارتمان جوهر",
authors: ((name: "نام نویسنده"),),
date: "۱۴۰۵/۰۱/۲۴",
)
= Section Title
Your content here...
= اطلاعات کلی
#general_info_table("۱۴۰۵/۰۱/۱۷", "۱۴۰۵/۰۱/۲۴", "پیگمنت", "۹", "Esmaltes")
```
### Travel report
```typst
#import "travel-report-template.typ": report, report-table
#show: report.with(
title: "گزارش مأموریت",
destinations: ((name: "کاشی آسیا"),),
purpose: "تست آزمایشی جوهرها",
date: "۰۵/۰۲/۲۷",
)
= گزارش مأموریت
متن گزارش ...
```
### Installation
Clone this repository to use the templates:
@@ -45,9 +95,14 @@ Clone this repository to use the templates:
git clone ssh://git@git.faryad.top:2222/rhino/typst-templates.git
```
### Requirements
- [Typst](https://typst.app/) - Install from https://github.com/typst/typst
- [Typst](https://typst.app/) - Install from [https://github.com/typst/typst](https://github.com/typst/typst)
- Persian fonts (`IRNazanin`, `IRZar`, `IRLotus`). The travel report template loads fonts from `template_files/`; compile with `--font-path template_files`.
## Contributing
@@ -55,4 +110,4 @@ Feel free to submit issues and enhancement requests.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

View File

@@ -0,0 +1,124 @@
#import "product_test_template.typ": *
#set text(lang: "fa")
#show: paper.with(
authors: (
(
name: "دیاکو سلطانپور",
affiliation: "کیمیا رازی - واحد جوهر",
email: "diaco@kimiarazi.com",
note: "ink dept",
),
),
date: "۲۲ تا ۴/۶/۲۶",
destinations: (
(name: " نتايج تست پيگمنت‌های شرکت اسمالتس"),
),
purpose: "بازدید و بررسی وضعیت",
)
// Your main content goes here
\
= اطلاعات کلی
#general_info_table(
"۱۴۰۵/۰۱/۱۷",
"۱۴۰۵/۰۱/۲۴",
"پیگمنت",
"۹",
"Esmaltes",
)
\
== نمونه‌های دریافت شده
#received_samples_table((
("پیگمنت زرد", "CLCE-539/1", "PI-Y36", "2"),
("پیگمنت قهوه‌ای", "CLCE-539/2", "PI-DBR3", "3"),
("پیگمنت بژ", "CLCE-539/3", "PI-BG31", "4"),
("پیگمنت بژ", "CLCE-539/4", "PI-BG32", "5"),
("پیگمنت آبی", "CLCE-539/5", "PI-BL53", "6"),
("پیگمنت آبی", "CLCE-539/6", "PI-BL54", "7"),
("پیگمنت مشکی", "CLCE-539/7", "PI-BK38", "8"),
("پیگمنت مشکی", "CLCE-539/8", "PI-BK39", "9"),
("پیگمنت صورتی", "CLCE-539/9", "PI-P26", "10"),
))
\
#colbreak()
== تست‌های انجام شده
با استفاده از این پیگمنت‌ها نمونه جوهر ساخته و در کنار نمونه آزمایشگاهی ساخته شده با پیگمنت استاندارد کیمیا رازی با شرایط زیر تست شد.
- روش اعمال: قطره‌ای
- لعاب: سه لعاب مختلف (براق و مات)
- دمای پخت: ۱۰۳۰، ۱۱۵۰ و ۱۱۸۰ °C
- مرجع مقایسه: پیگمنت استاندارد کیمیا رازی
\
فرمول نمونه جوهر بر اساس درصد وزنی:
#ink_formula_table((
("پیگمنت", 30),
("حلال", 60),
("دیسپرسانت", 10),
))
\
تست‌ها شامل:
- بررسی کیفیت سطح
- شدت رنگ
- تم رنگ
// تست پایداری جوهر در مقابل رسوب‌گذاری و ته‌نشینی نیز انجام شده است.
#colbreak()
\
== نتایج تست‌ها
// وضعیت نمونه‌های پیگمنت تست شده در مقایسه با نمونه استاندارد کیمیا رازی:
#columns(2, gutter: 8pt)[
#pigment_result_block("پیگمنت زرد", (
([*معیار*], [*CLCE-539/1*]),
([کیفیت سطح], [خوب]),
([تم رنگ], [چرک]),
([شدت رنگ], [خوب]),
([نتیجه نهایی], [نامناسب (تم چرک)]),
))
#pigment_result_block("پیگمنت قهوه‌ای", (
([*معیار*], [*CLCE-539/2*]),
([کیفیت سطح], [خوب]),
([تم رنگ], [خوب]),
([شدت رنگ], [کمتر]),
([نتیجه نهایی], [نامناسب (شدت رنگ کمتر)]),
))
\
#pigment_result_block("پیگمنت بژ", (
([*معیار*], [*CLCE-539/3*], [*CLCE-539/4*]),
([کیفیت سطح], [خوب], [خوب]),
([تم رنگ], [خوب], [خوب]),
([شدت رنگ], [خوب], [خوب]),
([نتیجه نهایی], [متفاوت از رفرنس], [متفاوت از رفرنس]),
))
#pigment_result_block("پیگمنت آبی", (
([*معیار*], [*CLCE-539/5*], [*CLCE-539/6*]),
([کیفیت سطح], [خوب], [خوب]),
([تم رنگ], [خوب], [تم سایان]),
([شدت رنگ], [کمتر], [خوب]),
([نتیجه نهایی], [نامناسب (شدت رنگ کمتر)], [مناسب برای سایان]),
))
\
#pigment_result_block("پیگمنت مشکی", (
([*معیار*], [*CLCE-539/7*], [*CLCE-539/8*]),
([کیفیت سطح], [خوب], [خوب]),
([تم رنگ], [قهوه‌ای], [خوب]),
([شدت رنگ], [کمتر], [کمتر]),
([نتیجه نهایی], [نامناسب (شدت رنگ کمتر)], [نامناسب (شدت رنگ کمتر)]),
))
\
=== پیگمنت صورتی
به دلیل موجود کافی در انبار تست این پیگمنت به زمان دیگری موکول شد.
]
\
== جمع بندی نتايج
- بین پیگمنت‌های بژ، نمونه CLCE-539/3 مشابه پیگمنت OC860A و نمونه CLCE-539/4 زردتر از آن است.
- در پیگمنت‌های آبی، نمونه CLCE539/5 مشابه کد ICK12/K315 و نمونه CLCE539/6 دارای تم سایان است.
\
== پیشنهادات
هیچ کدام از پیگمنت‌ها برای انجام تست صنعتی در نظر گرفته نشد ولی در صورت بروز مشکل در تأمین پیگمنت‌های مصرفی کنونی، می‌توان این نمونه‌ها را به عنوان کاندید جایگزینی در نظر گرفت.
\
\
== نظر مدیر کارخانه

View File

@@ -18,7 +18,7 @@
// ===== CONTENT SECTIONS =====
= گزارش مأموریت
این شرکت دو کوره برای کاشی کف و یک کوره برای پرسلان و پولیشی دارد و تولید روزانه آن حدود ۱۲ هزار متر مربع است. چهار ماشین چاپ دیجیتال دارد. دستگاه Tecnoferrari با هدهای ۱۰۰۲ و Xaar ۱۰۰۳ و دو دستگاه NKT با هدهای Xaar ۲۰۰۲.
این شرکت دو کوره برای کاشی کف و یک کوره برای پرسلان و پولیشی دارد و تولید روزانه آن حدود ۱۲ هزار متر مربع است. چهار ماشین چاپ دیجیتال دارد. دستگاه Tecnoferrari با هدهای ۱۰۰۲ و Xaar ۱۰۰۳ و دو دستگاه NKT با هدهای Xaar ۲۰۰۲.
سه دستگاه خط ۱، ۲ و ۳ با جوهر کیمیا رازی کار می‌کند
- #box(width: 2.5cm)[آبی:] KRCY-1100T
@@ -51,10 +51,14 @@
#report-table(
columns: (1.3fr, 2.2fr),
[*کد نمونه*], [*نتیجه*],
[KRBR-1201T], [شدت رنگ بیشتر],
[KRBR-1202T], [شدت رنگ بیشتر],
[ICJ/408], [شدت رنگ بیشتر],
[*کد نمونه*],
[*نتیجه*],
[KRBR-1201T],
[شدت رنگ بیشتر],
[KRBR-1202T],
[شدت رنگ بیشتر],
[ICJ/408],
[شدت رنگ بیشتر],
)
بین نمونه‌های قهوه‌ای، ICJ/408 بیشترین شدت رنگ را دارد. کد KRBR-1202T به نمونه رفرنس نزدیک‌تر است.
@@ -63,12 +67,18 @@
#report-table(
columns: (1.3fr, 2.2fr),
[*کد نمونه*], [*نتیجه*],
[KRBG-1600T], [تم رنگ تیره‌تر],
[KRHN-1700T], [تم رنگ تیره‌تر],
[KRGY-1900T], [تم رنگ تیره‌تر],
[KRGY-1901T], [مشابه رفرنس (کمی تیره‌تر)],
[KRYL-1400T], [زردی بیشتر],
[*کد نمونه*],
[*نتیجه*],
[KRBG-1600T],
[تم رنگ تیره‌تر],
[KRHN-1700T],
[تم رنگ تیره‌تر],
[KRGY-1900T],
[تم رنگ تیره‌تر],
[KRGY-1901T],
[مشابه رفرنس (کمی تیره‌تر)],
[KRYL-1400T],
[زردی بیشتر],
)
#colbreak()
@@ -77,13 +87,20 @@
#report-table(
columns: (1.3fr, 2.2fr),
[*کد نمونه*], [*نتیجه*],
[ICJ/610], [تم سبز],
[ICJ/EH600], [تم قهوه‌ای],
[ICJ/EH630], [تم قهوه‌ای],
[ICJ/EH680], [کمترین شدت رنگ، تم قهوه‌ای],
[KRBL-1300T], [تم سبز],
[KRBL-1314T], [بیشترین شدت رنگ],
[*کد نمونه*],
[*نتیجه*],
[ICJ/610],
[تم سبز],
[ICJ/EH600],
[تم قهوه‌ای],
[ICJ/EH630],
[تم قهوه‌ای],
[ICJ/EH680],
[کمترین شدت رنگ، تم قهوه‌ای],
[KRBL-1300T],
[تم سبز],
[KRBL-1314T],
[بیشترین شدت رنگ],
)
]

View File

@@ -15,99 +15,107 @@
company: "کیمیا رازی",
title: "گزارش تست مواد اولیه",
subtitle: "دپارتمان جوهر",
destinations: (none),
destinations: none,
purpose: none,
authors: ("دیاکو سلطانپور"),
authors: "دیاکو سلطانپور",
date: "",
doc,
) = {
set math.equation(numbering: "(1)", supplement: auto)
set math.equation(numbering: "(1)", supplement: auto)
set par(leading: 1em)
// Set and show rules from before.
set par(leading: 1em)
// Set and show rules from before.
set text(
font: font,
size: fontsize
)
set page(
paper: "a4",
header:
context {if counter(page).get().first() > 1 [
#grid(
gutter: 5pt,
columns: (4.2%,25%,3%,20%),
grid.cell(align: right, stroke: 1pt, image(height: 19pt,"kimia razi logo bw.png")),
align: top+right,
title,
"|",
subtitle,
grid.hline(start: 0),)]},
background: place(
dx: -54%,
dy: 63.5%,
rotate(
-90deg,
text(13pt,font: "IRZar",
// TODO: do not use grid. use #text and fr if possible
grid(
columns: (15%,25%, 40% ,5%),
rows: 20pt,
align: top,
context[
#h(1fr) #company #h(2fr)|],
[#h(2fr) #title #h(4fr)|],
[#h(2fr)#destinations.map(destination => destination.name).join("\n") #h(2fr)],
grid.cell(fill: black,
align: center,
stroke: 1pt,
text(fill: white,
context(counter(page).display("۱/۱", both: true,)))),
grid.hline(start: 0),
)
)
)
)
)
set document(
title: title,
author: authors.map(author => author.name),
set text(
font: font,
size: fontsize,
)
set page(
paper: "a4",
header: context {
if counter(page).get().first() > 1 [
#grid(
gutter: 5pt,
columns: (4.2%, 25%, 3%, 20%),
grid.cell(align: right, stroke: 1pt, image(
height: 19pt,
"kimia razi logo bw.png",
)),
align: top + right,
title,
"|",
subtitle,
grid.hline(start: 0),
)]
},
background: place(
dx: -54%,
dy: 63.5%,
rotate(
-90deg,
text(
13pt,
font: "IRZar",
// TODO: do not use grid. use #text and fr if possible
grid(
columns: (15%, 25%, 40%, 5%),
rows: 20pt,
align: top,
context [
#h(1fr) #company #h(2fr)|],
[#h(2fr) #title #h(4fr)|],
[#h(2fr)#(
destinations.map(destination => destination.name).join("\n")
) #h(2fr)],
grid.cell(fill: black, align: center, stroke: 1pt, text(
fill: white,
context (counter(page).display("۱/۱", both: true)),
)),
grid.hline(start: 0),
),
),
),
),
)
set document(
title: title,
author: authors.map(author => author.name),
)
set align(right)
if subtitle != none {
text(align(center, { strong(company) }))
}
if subtitle != none {
text(align(center, { subtitle }))
}
text(18pt, align(center, { strong(title) }))
set text(13pt, font: "IRLotus")
align(center, line(length: 85%))
/*
pad(x: 40pt,
grid(
columns: (2fr, 3fr, 2fr, 3fr),
gutter: (2em,22pt),
[بازدید از:], grid.cell(align: left, strong(destinations.map(destination => destination.name).join("\n"))), [هدف بازدید:], grid.cell(align: left, strong(purpose)),
[تیم اعزامی:], grid.cell(align: left, strong(authors.map(author => author.name).join("\n"))), [تاریخ بازدید:], grid.cell(align(left, strong(date))),)
)
align(center, line(length: 85%))
set align(right)
if subtitle != none {
text(align(center,{strong(company)}))
}
if subtitle != none {
text(align(center,{subtitle}))
}
text(18pt, align(center,{strong(title)}))
set text(13pt, font: "IRLotus")
align(center, line(length: 85%))
/*
pad(x: 40pt,
grid(
columns: (2fr, 3fr, 2fr, 3fr),
gutter: (2em,22pt),
[بازدید از:], grid.cell(align: left, strong(destinations.map(destination => destination.name).join("\n"))), [هدف بازدید:], grid.cell(align: left, strong(purpose)),
[تیم اعزامی:], grid.cell(align: left, strong(authors.map(author => author.name).join("\n"))), [تاریخ بازدید:], grid.cell(align(left, strong(date))),)
)
align(center, line(length: 85%))
v(10pt)
*/
set heading(numbering: "۱.۱- ")
set math.equation(numbering: "(1)")
set footnote(numbering: "۱.")
set footnote.entry(separator: line(length: 100%, stroke: 0.5pt))
set footnote.entry(indent: 0em)
set align(right)
v(10pt)
*/
set heading(numbering: "۱.۱- ")
set math.equation(numbering: "(1)")
set footnote(numbering: "۱.")
set footnote.entry(separator: line(length: 100%, stroke: 0.5pt))
set footnote.entry(indent: 0em)
set align(right)
show heading: it => [
#set align(right)
#counter(heading).display(
it.numbering
) #it.body
it.numbering,
) #it.body
#v(10pt)
]
@@ -118,7 +126,7 @@
justify: true,
)
columns(1, doc)
columns(1, doc)
}

View File

@@ -9,93 +9,131 @@
// Email: dyaco8464@yahoo.com
///////////////////////////////
#let fonts = (
body: "IRNazanin",
sidebar: "IRZar",
)
#let paper(
font: "IRNazanin",
font: fonts.body,
fontsize: 13pt,
company: "کیمیا رازی",
title: "گزارش تست مواد اولیه",
subtitle: "دپارتمان جوهر",
destinations: (none),
purpose: none,
authors: ("دیاکو سلطانپور"),
destinations: (),
purpose: "",
authors: (
(
name: "دیاکو سلطانپور",
affiliation: "کیمیا رازی - واحد جوهر",
email: "diaco@kimiarazi.com",
note: "ink dept",
),
),
date: "",
doc,
) = {
set math.equation(numbering: "(1)", supplement: auto)
set math.equation(numbering: "(1)", supplement: auto)
set par(leading: 1em)
// Set and show rules from before.
set par(leading: 1em)
// Set and show rules from before.
set text(
font: font,
size: fontsize
)
set page(
paper: "a4",
header:
context {if counter(page).get().first() > 1 [
#grid(
gutter: 5pt,
columns: (4.2%,25%,3%,20%),
grid.cell(align: right, stroke: 1pt, image(height: 19pt,"kimia razi logo bw.png")),
align: top+right,
title,
"|",
subtitle,
grid.hline(start: 0),)]},
background: place(
dx: -54%,
dy: 63.5%,
rotate(
-90deg,
text(13pt,font: "IRZar",
// TODO: do not use grid. use #text and fr if possible
grid(
columns: (15%,25%, 40% ,5%),
rows: 20pt,
align: top,
context[
#h(1fr) #company #h(2fr)|],
[#h(2fr) #title #h(4fr)|],
[#h(2fr)#destinations.map(destination => destination.name).join("\n") #h(2fr)],
grid.cell(fill: black,
align: center,
stroke: 1pt,
text(fill: white,
context(counter(page).display("۱/۱", both: true,)))),
grid.hline(start: 0),
)
)
)
)
)
set document(
title: title,
author: authors.map(author => author.name),
)
set align(right)
if subtitle != none {
text(align(center,{strong(company)}))
set text(
font: font,
size: fontsize,
)
set page(
margin: (left: 2cm, right: 2cm, top: 2.5cm, bottom: 2.5cm),
paper: "a4",
header: context {
if counter(page).get().first() > 1 [
#grid(
gutter: 5pt,
columns: (auto, 1fr, auto, auto),
grid.cell(align: right, stroke: 1pt, image(
height: 19pt,
"template_files/kimia razi logo bw.png",
)),
align: top + right,
company,
"|",
subtitle,
grid.hline(start: 0),
)]
},
background: place(
dx: -64%,
dy: 73%,
rotate(
-90deg,
text(13pt, font: fonts.sidebar, grid(
columns: (30%, 30%, 5%),
rows: 20pt,
align: top,
[#h(1fr) #title #h(5fr)],
[#h(1fr) #(destinations.map(destination => destination.name).join(", ")) #h(5fr)],
grid.cell(fill: black, align: center, stroke: 1pt, text(
fill: white,
context (counter(page).display("۱/۱", both: true)),
)),
grid.hline(start: 0),
)),
),
),
numbering: "۱",
)
set document(
title: title,
author: authors.map(author => author.name),
)
// ===== TITLE SECTION =====
block(width: 100%)[
#grid(
columns: (auto, auto, 1fr),
align: top,
[
#align(right)[
#set par(leading: 0.9em, spacing: 0em)
#text(21pt, font: font, weight: "bold", strong(company))
#if subtitle != none and subtitle != "" {
text(14pt, " | " + subtitle)
}
text(18pt, align(center,{strong(title)}))
set text(13pt, font: "IRLotus")
if subtitle != none {
text(align(center,{subtitle}))
}
align(center, line(length: 100%))
// set heading(numbering: "۱.۱- ")
set math.equation(numbering: "(1)")
set footnote(numbering: "۱.")
set footnote.entry(separator: line(length: 100%, stroke: 0.5pt))
set footnote.entry(indent: 0em)
set align(right)
show heading: it => [
#set align(right)
#it.body
#v(10pt)
#linebreak()
#text(14pt, strong(title))
]
],
[],
[#align(left, image(
"template_files/kimia razi logo bw.png",
height: 1.8cm,
))],
)
]
// set heading(numbering: "۱.۱- ")
set math.equation(numbering: "(1)")
set footnote(numbering: "۱.")
set footnote.entry(separator: line(length: 100%, stroke: 0.5pt))
set footnote.entry(indent: 0em)
set align(right)
show heading: it => context {
let y = here().position().y
let body-top = if counter(page).get().first() > 1 {
page.margin.top + 28pt
} else {
page.margin.top
}
let not-at-top = y > body-top + 12pt
[
#if not-at-top and it.level <= 2 [
#line(length: 100%)
#v(8pt)
]
#set align(right)
#it.body
#v(10pt)
]
}
set text(spacing: 100%)
set par(
@@ -104,7 +142,7 @@
justify: true,
)
columns(1, doc)
columns(1, doc)
}
// Renders a centered, non-breakable result table.
@@ -118,15 +156,13 @@
#let test_result_table(cols) = {
block(
breakable: false,
align(center,
table(
columns: (auto,) * (cols.first().len()),
inset: 8pt,
stroke: 0.5pt,
fill: (x, y) => if y == 0 { luma(230) },
..cols.flatten(),
)
)
align(center, table(
columns: (auto,) * (cols.first().len()),
inset: 8pt,
stroke: 0.5pt,
fill: (x, y) => if y == 0 { luma(230) },
..cols.flatten(),
)),
)
}
@@ -179,15 +215,88 @@
// "۹",
// "Esmaltes",
// )
#let general_info_table(received_date, report_date, sample_type, sample_count, supplier) = {
grid(
columns: (auto, auto),
inset: 10pt,
[- تاریخ دریافت نمونه:], [#received_date],
[- تاریخ گزارش:], [#report_date],
[- نوع نمونه:], [#sample_type],
[- تعداد:], [#sample_count],
[- تأمین کننده:], [#supplier],
#let general_info_table(
received_date,
report_date,
sample_type,
sample_count,
supplier,
) = {
block(
breakable: false,
align(center, table(
columns: (auto, auto, auto, auto, auto),
align: right,
stroke: 0.5pt,
inset: 8pt,
fill: (x, y) => if y == 0 { luma(235) },
[*تاریخ دریافت نمونه*],
[*تاریخ گزارش*],
[*نوع نمونه*],
[*تعداد*],
[*تأمین کننده*],
[#received_date],
[#report_date],
[#sample_type],
[#sample_count],
[#supplier],
)),
)
}
// Renders the test conditions as a structured key/value table.
// Each row is a tuple of (label, value).
// Usage:
// #test_conditions_table((
// ([روش اعمال], [قطره‌ای]),
// ([دمای پخت], [۱۰۳۰، ۱۱۵۰، ۱۱۸۰ °C]),
// ))
#let test_conditions_table(rows) = {
block(
breakable: false,
align(center, table(
columns: (auto, auto),
align: right,
stroke: 0.5pt,
inset: 8pt,
fill: (x, y) => if y == 0 { luma(235) },
[*شرط آزمون*],
[*مقدار*],
..rows.flatten(),
)),
)
}
// Renders the ink formula as a horizontal component / weight-% table and
// appends an automatic total column. Component names are rendered LTR (English).
// Each row is a tuple of (component, weight).
// Usage:
// #ink_formula_table((
// ("Pigment", 30),
// ("Sol-1", 60),
// ("Super Disp.", 10),
// ))
#let ink_formula_table(rows) = {
let total = rows.fold(0, (acc, row) => acc + row.at(1))
let last-col = rows.len()
block(
breakable: false,
align(center, table(
columns: (auto,) * (rows.len() + 1),
align: center,
stroke: 0.5pt,
inset: 8pt,
fill: (x, y) => {
if x == last-col { luma(245) }
else if y == 0 { luma(235) }
},
..rows
.map(row => [*#text(dir: ltr, row.at(0))*])
.flatten(),
[*جمع*],
..rows.map(row => [#row.at(1)]).flatten(),
[*#total*],
)),
)
}
@@ -197,20 +306,18 @@
#let received_samples_table(rows) = {
block(
breakable: false,
align(center,
table(
columns: (auto, auto, auto, auto),
align: right,
stroke: 0.5pt,
inset: 7pt,
fill: (x, y) => if y == 0 { luma(235) },
[*نوع پیگمنت*],
[*کد تأمین کننده*],
[*کد داخلی*],
[*شماره سند*],
..rows.flatten(),
)
)
align(center, table(
columns: (auto, auto, auto, auto),
align: right,
stroke: 0.5pt,
inset: 7pt,
fill: (x, y) => if y == 0 { luma(235) },
[*نوع پیگمنت*],
[*کد تأمین کننده*],
[*کد داخلی*],
[*شماره سند*],
..rows.flatten(),
)),
)
}

View File

@@ -5,16 +5,16 @@
)
#let destination-names(destinations) = {
if destinations == none { "" }
else { destinations.map(d => d.name).join(" - ") }
if destinations == none { "" } else {
destinations.map(d => d.name).join(" - ")
}
}
#let report-meta-row(label-width, label, value) = grid(
columns: (label-width, 1fr),
gutter: (2em, 0pt),
align: right + top,
[#label],
[#strong(value)],
[#label], [#strong(value)],
)
#let report-meta-label-width = 8em
@@ -40,50 +40,52 @@
) = {
set page(
margin: (left: 2cm, right: 2cm, top: 2.5cm, bottom: 2.5cm),
paper: "a4",
header:
context {if counter(page).get().first() > 1 [
#grid(
gutter: 5pt,
columns: (auto, 1fr, auto, auto),
grid.cell(align: right, stroke: 1pt, image(height: 19pt,"template_files/kimia razi logo bw.png")),
align: top+right,
company,
"|",
subtitle,
grid.hline(start: 0),)]},
background: place(
dx: -64%,
dy: 73%,
rotate(
-90deg,
text(13pt, font: fonts.sidebar,
grid(
columns: (30%,30%,5%),
rows: 20pt,
align: top,
[#h(1fr) گزارش ماموریت #destination-names(destinations) #h(5fr)],
context[
#let side_authors = if authors.len() == 0 {
""
} else {
authors.map(author => author.name).join(" - ")
}
#let textwidth = measure(side_authors).width
#if authors.len() > 0 and textwidth > page.width * 0.28 {
side_authors = authors.first().name + " و ..."
}
#h(1fr) #side_authors #h(4fr)],
grid.cell(fill: black,
align: center,
stroke: 1pt,
text(fill: white,
context(counter(page).display("۱/۱", both: true,)))),
grid.hline(start: 0),
)
)
)
),
paper: "a4",
header: context {
if counter(page).get().first() > 1 [
#grid(
gutter: 5pt,
columns: (auto, 1fr, auto, auto),
grid.cell(align: right, stroke: 1pt, image(
height: 19pt,
"template_files/kimia razi logo bw.png",
)),
align: top + right,
company,
"|",
subtitle,
grid.hline(start: 0),
)]
},
background: place(
dx: -64%,
dy: 73%,
rotate(
-90deg,
text(13pt, font: fonts.sidebar, grid(
columns: (30%, 30%, 5%),
rows: 20pt,
align: top,
[#h(1fr) گزارش ماموریت #destination-names(destinations) #h(5fr)],
context [
#let side_authors = if authors.len() == 0 {
""
} else {
authors.map(author => author.name).join(" - ")
}
#let textwidth = measure(side_authors).width
#if authors.len() > 0 and textwidth > page.width * 0.28 {
side_authors = authors.first().name + " و ..."
}
#h(1fr) #side_authors #h(4fr)],
grid.cell(fill: black, align: center, stroke: 1pt, text(
fill: white,
context (counter(page).display("۱/۱", both: true)),
)),
grid.hline(start: 0),
)),
),
),
numbering: "۱",
)
set text(lang: "fa", dir: rtl, font: font, size: fontsize)
@@ -97,14 +99,17 @@
#set par(leading: 0.9em, spacing: 0em)
#text(21pt, font: fonts.body, weight: "bold", strong(company))
#if subtitle != none and subtitle != "" {
text(14pt, " | "+subtitle)
text(14pt, " | " + subtitle)
}
#linebreak()
#text(14pt, strong(title))
]
],
[],
[#align(left, image("template_files/kimia razi logo bw.png", height: 1.8cm))],
[#align(left, image(
"template_files/kimia razi logo bw.png",
height: 1.8cm,
))],
)
]
set align(right)
@@ -115,9 +120,17 @@
#set par(leading: 0.9em, spacing: 0em)
#stack(
spacing: 14pt,
report-meta-row(report-meta-label-width, [مقصد:], destination-names(destinations)),
report-meta-row(
report-meta-label-width,
[مقصد:],
destination-names(destinations),
),
report-meta-row(report-meta-label-width, [هدف مأموریت:], purpose),
report-meta-row(report-meta-label-width, [تیم اعزامی:], authors.map(author => author.name).join(" - ")),
report-meta-row(
report-meta-label-width,
[تیم اعزامی:],
authors.map(author => author.name).join(" - "),
),
report-meta-row(report-meta-label-width, [تاریخ:], date),
)
])