Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions packages/preview/ioppub/0.1.0/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Koyo MUNECHIKA

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.
48 changes: 48 additions & 0 deletions packages/preview/ioppub/0.1.0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# IOP Publishing article template

[![Generic badge](https://img.shields.io/badge/Version-0.1.0-cornflowerblue.svg)]()
[![MIT License](https://img.shields.io/badge/License-MIT-forestgreen)](https://github.com/munechika-koyo/ioppub/blob/main/LICENSE)
<!-- [![User Manual](https://img.shields.io/badge/doc-.pdf-mediumpurple)](https://github.com/munechika-koyo/ioppub/blob/main/docs/manual.pdf) -->

The `ioppub` package is designed to closely resemble the manuscript used by IOP Publishing for article formatting.
It is not intended for submission, but rather to help authors prepare articles that resemble the final published version.
It mainly serves as a proof of concept, demonstrating that Typst is a viable option for academic writing and scientific publishing.

## Basic usage

This section provides the minimal amount of information to get started with the template.

To use the `ioppub` template, you need to include the following line at the beginning of your `typ` file:

```typ
#import "@preview/ioppub:0.1.0": *
```

### Initializing the template

After importing `ioppub`, you have to initialize the template by a show rule with the `#ioppub()` command. This function takes an optional argument to specify the title of the document.

* `journal`: Dictionary containing the journal information (e.g. `psst`).
* `title`: Title of the paper.
* `abstract`: Abstract of the paper.
* `authors`: List of the authors of the paper.
* `institutions`: List of the institutions of the paper.
* `paper-info`: Dictionary containing the paper information (e.g. year, volume, ...).
* `keywords`: List of keywords of the paper.


## Additional features

The `ioppub` template provides additional features to help you format your document properly.

### Appendix

To activate the appendix environment, all you have to do is to place the following command in your document:
```typ
#show: appendix

// Appendix content here
```

## License
MIT licensed
215 changes: 215 additions & 0 deletions packages/preview/ioppub/0.1.0/src/iop-cover.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
#let make-precis(
keywords: (),
abstract: [],
) = {
v(1em)

// Abstract heading
align(horizon)[
#set text(font: "Carlito", size: 11pt, weight: "bold")
Abstract
]
if abstract.len() > 0 {
block(width: 76%)[
#set text(size: 10pt)
#set par(justify: false, leading: 0.65em)
#abstract
]
v(0.8em)
}

// Keywords
if keywords.len() > 0 {
set text(size: 10pt)
block(width: 76%)[Keywords: #keywords.join(", ")]
}

line(length: 100%, stroke: 0.5pt)
}

#let make-institution(key, value) = {
super[#key]
[#metadata("") #label("institution." + key)]
if key != "" {
sym.space.thin
}
text(value)
}

#let make-institutions(institutions) = par({
set text(size: 9pt)
for (key, value) in institutions {
make-institution(key, value)
linebreak()
}
})

#let make-author(author) = box({
author.name.join(" ")

let auth-institution = if author.institutions.at(0) == "" {
none
} else {
author.institutions.map(key => {
text(fill: rgb(0, 0, 102), link(label("institution." + key), key))
})
}

let auth-corres = {
if (author.at("corresponding", default: false) == true) {
(text(fill: rgb(0, 0, 245), sym.ast),)
}
}

let auth-orcid = {
if (author.at("orcid", default: none)) != none {
link("https://orcid.org/" + author.orcid, box(
image("resources/orcid.svg", height: 10pt),
height: 0.8em,
))
}
}

sym.space.thin
if auth-institution == none {
super({ auth-corres })
auth-orcid
} else {
super({ (auth-institution + auth-corres).join([,]) })
auth-orcid
}
})

#let make-authors(authors) = par({
set text(size: 11pt)
set block(width: 76%)
authors.map(make-author).join(", ")
})

#let make-corresponding-note(authors) = {
let corres-authors = authors.filter(author => {
author.at("corresponding", default: false) == true
})

if corres-authors.len() > 0 {
v(1.5em)
set text(size: 9pt)
[\*Author to whom any correspondence should be addressed.]
}
}

#let make-email(authors) = {
let corres-authors = authors.filter(author => {
author.at("corresponding", default: false) == true
})

if corres-authors.len() > 0 {
v(1.5em)
set text(size: 9pt)
let email = corres-authors.at(0).at("email", default: none)
[E-mail: ]
if email != none {
link("mailto:" + email, email)
} else {
"xxx@xxx.xx"
}
}
}

#let make-date(paper-info) = {
text(size: 9pt, [
Received
#if paper-info.received != none { paper-info.received } else { "xxxxxx" }\
Accepted for publication
#if paper-info.accept != none { paper-info.accept } else { "xxxxxx" }\
Published
#if paper-info.published != none { paper-info.published } else { "xxxxxx" }
])
}

#let make-title(
title: [Full length journal article adapted and reset according to the typesetting specifications for this model],
authors: (),
institutions: (),
paper-info: none,
) = {
show par: block.with(below: 0em)
v(0.75em)
par(leading: 1.5em, text(font: "Carlito", size: 24pt, weight: "bold", title))
v(1.8em)
make-authors(authors)
v(1.25em)
set block(width: 76%)
make-institutions(institutions)
make-corresponding-note(authors)
make-email(authors)
v(1.5em)
make-date(paper-info)
}

#let make-header(
authors,
journal,
paper-info,
) = {
let authors-header = if authors.len() > 2 {
let (first_name, last_name) = authors.first().name
first_name.at(0) + " " + last_name + emph(" et al")
} else if authors.len() == 2 {
let (first_name1, last_name1) = authors.at(0).name
let (first_name2, last_name2) = authors.at(1).name
first_name1.at(0) + " " + last_name1 + " and " + first_name2.at(0) + " " + last_name2
} else {
let (first_name, last_name) = authors.first().name
first_name.at(0) + " " + last_name
}

let doi = if paper-info.doi != none {
paper-info.doi
} else {
"https://doi.org/XXXX/XXXX"
}

let journal-header = [#journal.abbreviation *#paper-info.volume* (#paper-info.year) #paper-info.paper-id]

return context if counter(page).get().first() == 1 {
set text(size: 11pt, font: "Carlito")
[*IOP* Publishing]
h(1fr)
set text(size: 9pt)
[#journal.name]
v(-1em)
[#line(length: 100%, stroke: 0.5pt)]
v(-0.5em)
[#journal-header]
h(1fr)
[#link(doi)]
} else {
set text(size: 9pt, font: "Carlito")
grid(
columns: (1fr, 1fr),
align: (left, right),
[#journal-header], [#authors-header],
)
v(-0.8em)
[#line(length: 100%, stroke: 0.5pt)]
}
}

#let make-footer(
paper-info,
journal,
) = context if counter(page).get().first() == 1 {
set text(font: "Carlito")
grid(
columns: (1fr, 1fr, 1fr),
align: (left, center, right),
text(size: 8pt)[#if paper-info.issn != none {
"xxxx-xxxx/xx/xxxxxx"
}],
text(size: 7pt)[#counter(page).get().first()],
text(size: 8pt, journal.foot-info),
)
} else {
align(center)[#text(size: 7pt, font: "Carlito")[#counter(page).get().first()]]
}
27 changes: 27 additions & 0 deletions packages/preview/ioppub/0.1.0/src/iop-environment.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#import "iop-globals.typ": *

// Appendix
#let appendix(body) = {
set heading(numbering: "A.1.", supplement: [Appendix])
// Reset heading counter
counter(heading).update(0)

// Equation numbering
let numbering-eq = (..n) => {
let h1 = counter(heading).get().first()
numbering("(A.1a)", h1, ..n)
}
set math.equation(numbering: numbering-eq)

// Figure and Table numbering
let numbering-fig = n => {
let h1 = counter(heading).get().first()
numbering("A.1", h1, n)
}
show figure.where(kind: image): set figure(numbering: numbering-fig)
show figure.where(kind: table): set figure(numbering: numbering-fig)

isappendix.update(true)

body
}
20 changes: 20 additions & 0 deletions packages/preview/ioppub/0.1.0/src/iop-globals.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#let default-font = (
text: ("STIX Two Text", "Times New Roman", "Charis SIL", "New Computer Modern"),
header: ("Carlito", "Arial", "New Computer Modern"),
math: ("XITS Math", "STIX Two Math", "New Computer Modern Math"),
homepage: ("Roboto", "New Computer Modern"),
)

// Default paper information
#let paper-info-default = (
paper-id: [123456],
volume: "XXX",
year: datetime.today().year(),
issn: [0167-1234],
received: [xxxxxx],
accept: [xxxxxx],
published: [xxxxxx],
doi: "https://doi.org/XXXX/XXXX",
)

#let isappendix = state("isappendix", false)
29 changes: 29 additions & 0 deletions packages/preview/ioppub/0.1.0/src/iop-journal.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#import "iop-globals.typ": *

// Journal list
#let default-journal = (
name: "Journal Title",
abbreviation: "J. Title",
address: "",
font: default-font,
numcol: 2,
foot-info: [#sym.copyright #datetime.today().year() IOP Publishing Ltd.],
)

#let psst = (
name: "Plasma Sources Science and Technology",
abbreviation: "Plasma Sources Sci. Technol.",
address: "",
font: default-font,
numcol: 2,
foot-info: [#sym.copyright #datetime.today().year() IOP Publishing Ltd. All rights, including for text and data mining, AI traning, and similar technologies, reserved.],
)

#let ppcf = (
name: "Plasma Physics and Controlled Fusion",
abbreviation: "Plasma Phys. Control. Fusion",
address: "",
font: default-font,
numcol: 2,
foot-info: [#sym.copyright #datetime.today().year() The Author(s). Published by IOP Publishing Ltd],
)
Loading