forked from typst/packages
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
348 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,7 @@ | ||
# [v0.2.0](https://github.com/npikall/rubber-article/releases/tag/v0.1.0) | ||
Added some more funcitonality to the package. | ||
- Headers are now integrated, useing hydra. | ||
- List indentation are now set to 1.5em. | ||
|
||
# [v0.1.0](https://github.com/npikall/rubber-article/releases/tag/v0.1.0) | ||
Initial Release |
This file contains 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,24 @@ | ||
This is free and unencumbered software released into the public domain. | ||
|
||
Anyone is free to copy, modify, publish, use, compile, sell, or | ||
distribute this software, either in source code form or as a compiled | ||
binary, for any purpose, commercial or non-commercial, and by any | ||
means. | ||
|
||
In jurisdictions that recognize copyright laws, the author or authors | ||
of this software dedicate any and all copyright interest in the | ||
software to the public domain. We make this dedication for the benefit | ||
of the public at large and to the detriment of our heirs and | ||
successors. We intend this dedication to be an overt act of | ||
relinquishment in perpetuity of all present and future rights to this | ||
software under copyright law. | ||
|
||
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 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. | ||
|
||
For more information, please refer to <http://unlicense.org/> |
This file contains 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,39 @@ | ||
# The `rubber-article` Package | ||
<div align="center">Version 0.2.0</div> | ||
|
||
This template is a intended as a starting point for creating documents, which should have the classic LaTeX Article look. | ||
|
||
## Getting Started | ||
|
||
These instructions will get you a copy of the project up and running on the typst web app. Perhaps a short code example on importing the package and a very simple teaser usage. | ||
|
||
```typ | ||
#import "@preview/rubber-article:0.2.0": * | ||
#show: article.with() | ||
#maketitle( | ||
title: "The Title of the Paper", | ||
authors: ( | ||
"Authors Name", | ||
), | ||
date: "September 2024", | ||
) | ||
``` | ||
|
||
## Further Functionality | ||
The template provides a few more functions to customize the document. | ||
For an indepth look into the functionality checkout the [guide]. | ||
|
||
```typ | ||
#show article.with( | ||
lang:"de", | ||
eq-numbering:none, | ||
text-size:10pt, | ||
page-numbering: "1", | ||
page-numbering-align: center, | ||
heading-numbering: "1.1 ", | ||
) | ||
``` | ||
|
||
[guide]: https://github.com/npikall/rubber-article/tree/main/docs/docs.pdf |
This file contains 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,221 @@ | ||
#import "@preview/hydra:0.5.2": hydra | ||
|
||
|
||
/// A Template recreating the look of the classic Article Class. | ||
/// -> content | ||
#let article( | ||
/// Set the language of the document. | ||
/// -> str | ||
lang:"de", | ||
/// Set the equation numbering style. | ||
/// -> str | none | ||
eq-numbering:none, | ||
/// Set the text size. | ||
/// Headings are adjusted automatically. | ||
/// -> length | ||
text-size:10pt, | ||
/// Set the page numbering style. | ||
/// -> none | str | function | ||
page-numbering: "1", | ||
/// Set the page numbering alignment. | ||
/// -> alignment | ||
page-numbering-align: center, | ||
/// Set the heading numbering style. | ||
/// -> none | str | function | ||
heading-numbering: "1.1 ", | ||
/// Set the margins of the document. | ||
/// -> auto | relative | dictionary | ||
margins: (left: 25mm, right: 25mm, top: 30mm, bottom: 30mm), | ||
/// Set the Enum indentation. | ||
/// -> length | ||
enum-indent: 1.5em, | ||
/// Set the List indentation. | ||
/// -> length | ||
list-indent: 1.5em, | ||
/// Set if the default header should be used. | ||
/// -> bool | ||
show-header: false, | ||
/// Set if the default header should be alternating. | ||
/// -> bool | ||
alternating-header: true, | ||
/// Set the first page of the header. | ||
/// -> int | float | ||
first-page-header: 1, | ||
/// Set the Header Titel | ||
/// -> str | content | ||
header-titel: none, | ||
///-> content | ||
content) = { | ||
// Set the document's basic properties. | ||
set page( | ||
margin: margins, | ||
numbering: page-numbering, | ||
number-align: page-numbering-align, | ||
) | ||
set text(font: "New Computer Modern", lang:lang, size: text-size) | ||
show math.equation: set text(weight: 400) | ||
set math.equation(numbering: eq-numbering) | ||
set heading(numbering: heading-numbering) | ||
set enum(indent: enum-indent) | ||
set list(indent: list-indent) | ||
show link: it => text(fill:blue.darken(20%), it) | ||
set outline(indent: auto) | ||
show outline.entry.where( | ||
level: 1, | ||
): it => { | ||
v(15pt, weak: true) | ||
text(size:11pt ,[ | ||
#strong(it.body) | ||
#box(width: 1fr, repeat[]) | ||
#strong(it.page) | ||
])} | ||
|
||
// Referencing Figures | ||
show figure.where(kind: table): set figure(supplement:[Tab.], numbering: "1") if lang == "de" | ||
show figure.where(kind: image): set figure(supplement:[Abb.], numbering: "1",) if lang == "de" | ||
|
||
// Set Table style | ||
set table( | ||
stroke: none, | ||
gutter: auto, | ||
fill: none, | ||
inset: (right: 1.5em), | ||
) | ||
|
||
// Configure figures (tables) | ||
show figure.where(kind: table): it => { | ||
show: pad.with(x: 23pt) | ||
set align(center) | ||
v(12.5pt, weak: true) | ||
// Display the figure's caption. | ||
if it.has("caption") { | ||
v(if it.has("gap") { it.gap } else { 17pt }, weak: true) | ||
strong(it.supplement) | ||
if it.numbering != none { | ||
[ ] | ||
strong(it.counter.display(it.numbering)) | ||
} | ||
[*: *] | ||
it.caption.body | ||
|
||
// Display the figure's body. | ||
it.body | ||
} | ||
v(15pt, weak: true) | ||
} | ||
|
||
// Configure figures (images) | ||
show figure.where(kind: image): it => { | ||
show: pad.with(x: 23pt) | ||
set align(center) | ||
v(12.5pt, weak: true) | ||
// Display the figure's body. | ||
it.body | ||
// Display the figure's caption. | ||
if it.has("caption") { | ||
v(if it.has("gap") { it.gap } else { 17pt }, weak: true) | ||
strong(it.supplement) | ||
if it.numbering != none { | ||
[ ] | ||
strong(it.counter.display(it.numbering)) | ||
} | ||
[*: *] | ||
it.caption.body | ||
} | ||
v(15pt, weak: true) | ||
} | ||
|
||
// Configure the header. | ||
let header-oddPage = context { | ||
set text(10pt) | ||
set grid.hline(stroke: 0.9pt) | ||
grid( | ||
columns: (1fr, 1fr), | ||
align: (left, right), | ||
inset:4pt, | ||
smallcaps(header-titel), | ||
hydra(1), | ||
grid.hline(), | ||
) | ||
} | ||
|
||
let header-evenPage = context { | ||
set text(10pt) | ||
set grid.hline(stroke: 0.9pt) | ||
grid( | ||
columns: (1fr, 1fr), | ||
align: (left, right), | ||
inset:4pt, | ||
hydra(1), | ||
smallcaps(header-titel), | ||
grid.hline(), | ||
) | ||
} | ||
|
||
let header-content = context { | ||
let current = counter(page).get().first() | ||
|
||
if current > first-page-header and calc.rem(current,2) == 0{ | ||
return header-oddPage | ||
} else if current > first-page-header { | ||
if alternating-header { | ||
return header-evenPage | ||
} else { | ||
return header-oddPage | ||
} | ||
} | ||
} | ||
|
||
set page(header: header-content) if show-header | ||
|
||
// Main body. | ||
set par(justify: true) | ||
|
||
content | ||
} | ||
|
||
/// Make the title of the document. | ||
/// -> content | ||
#let maketitle( | ||
/// The title of the document. | ||
/// -> string | content | ||
title: "", | ||
/// The authors of the document. | ||
/// -> array | ||
authors: (), | ||
/// The date of the document. | ||
/// -> string | content | datetime | ||
date: none, | ||
/// Use titel and author information for | ||
/// the document metadata. | ||
/// -> bool | ||
metadata: true, | ||
) = { | ||
if metadata { | ||
set document(author: authors, title: title) | ||
} | ||
// Author information. | ||
let authors-text = { | ||
set text(size: 1.1em) | ||
pad( | ||
top: 0.5em, | ||
bottom: 0.5em, | ||
x: 2em, | ||
grid( | ||
columns: (1fr,) * calc.min(3, authors.len()), | ||
gutter: 1em, | ||
..authors.map(author => align(center, author)), | ||
), | ||
)} | ||
|
||
// Frontmatter | ||
align(center)[ | ||
#v(60pt) | ||
#block(text(weight: 400, 18pt, title)) | ||
#v(1em, weak: true) | ||
#authors-text | ||
#v(1em, weak: true) | ||
#block(text(weight: 400, 1.1em, date)) | ||
#v(20pt) | ||
] | ||
} |
This file contains 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,28 @@ | ||
#import "@preview/rubber-article:0.2.0": * | ||
|
||
#show: article.with() | ||
|
||
#maketitle( | ||
title: "The Title of the Paper", | ||
authors: ( | ||
"Authors Name", | ||
), | ||
date: datetime.today().display("[day padding:none]. [month repr:long] [year]"), | ||
) | ||
|
||
// Some example content has been added for you to see how the template looks like. | ||
= Introduction | ||
#lorem(60) | ||
|
||
== In this paper | ||
#lorem(20) | ||
$ | ||
x_(1,2) = (-b plus.minus sqrt(b^2 - 4 a c))/ (2 a) | ||
$ | ||
#lorem(20) | ||
|
||
=== Contributions | ||
#lorem(40) | ||
|
||
= Related Work | ||
#lorem(500) |
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 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,29 @@ | ||
# for a description of available keys, see https://github.com/typst/packages/?tab=readme-ov-file#package-format | ||
|
||
[package] | ||
name = "rubber-article" | ||
version = "0.2.0" | ||
entrypoint = "src/lib.typ" | ||
authors = ["Niko Pikall"] | ||
license = "Unlicense" | ||
description = "A simple template recreating the look of the classic LaTeX article." | ||
repository = "https://github.com/npikall/rubber-article.git" | ||
keywords = ["template", "article"] | ||
categories = ["paper", "report"] | ||
disciplines = ["biology", "chemistry", "engineering", "geography", "mathematics", "physics"] | ||
exclude = [ | ||
".github", | ||
"docs", | ||
"scripts", | ||
"tests", | ||
".typstignore", | ||
"Justfile", | ||
] | ||
|
||
[template] | ||
path = "template" | ||
entrypoint = "main.typ" | ||
thumbnail = "thumbnail.png" | ||
|
||
# [tool.mytool] | ||
# foo = "bar" |