aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.editorconfig12
-rw-r--r--README.md6
-rw-r--r--demo.typ9
-rw-r--r--lib.typ80
-rw-r--r--metalogo.typ11
-rw-r--r--typst.toml2
6 files changed, 104 insertions, 16 deletions
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..9c05f2b
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,12 @@
+root = true
+
+[*]
+indent_style = tab
+end_of_line = lf
+insert_final_newline = true
+max_line_length = 79
+
+[*.{md,typ}]
+indent_style = space
+indent_size = 2
+
diff --git a/README.md b/README.md
index a9004f8..31b58f6 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,12 @@
Typeset LaTeX compiler logos in [typst](https://github.com/typst/typst).
+## todo
+
+- document `metalogo()` command
+- write a manual
+- fix latex2e logo
+
## usage
From [./demo.typ](./demo.typ):
diff --git a/demo.typ b/demo.typ
index e8b7d16..244a23c 100644
--- a/demo.typ
+++ b/demo.typ
@@ -1,11 +1,10 @@
#set page(width: 35em, height: auto)
#set text(font: "New Computer Modern")
-#import "@preview/metalogo:1.1.0": TeX, LaTeX, XeLaTeX, XeTeX, LuaLaTeX
+#import "metalogo.typ": *
-#LaTeX is a typestting program based on #TeX. Some people use #XeLaTeX
-(sometimes #XeTeX), or #LuaLaTeX to typeset their documents.
+#LaTeX is a typesetting program based on #TeX. Some people use #XeLaTeX
+(sometimes #XeTeX) or #LuaLaTeX (sometimes #LuaTeX) to typeset their documents.
-People who are afraid of #LaTeX and its complex macro system may use typst
+People who are afraid of #LaTeX and its complex macro system may use Typst
instead.
-
diff --git a/lib.typ b/lib.typ
new file mode 100644
index 0000000..213c33d
--- /dev/null
+++ b/lib.typ
@@ -0,0 +1,80 @@
+// TODO: workaround until Typst gets a real ex unit.
+// See <https://github.com/typst/typst/issues/2405>
+#let ex = 0.47
+#let defaults = (
+ drop-tex: 0.5em*ex,
+ drop-xe: 0.5em*ex,
+
+ kern-te: -.1667em,
+ kern-ex: -.125em,
+ kern-la: -.36em,
+ kern-at: -.15em,
+ kern-xe: -.125em,
+ kern-et: -.1667em,
+ kern-el: -.125em,
+ kern-x2: 0.15em,
+)
+#let config = state("metalogo", defaults)
+#let metalogo(..opts) = context{
+ config.update(c => {
+ for (key, value) in opts.named() {
+ c.insert(key, value)
+ }
+ return c
+ })
+}
+
+#let drop(body, distance: 0pt) = box[#move(dy: distance)[#body]]
+#let mirror(body) = scale(x: -100%)[#body]
+
+#let TeX = context[#box[#{
+ let cfg = config.get()
+ [T]
+ h(cfg.kern-te)
+ drop(distance: cfg.drop-tex)[E]
+ h(cfg.kern-ex)
+ [X]
+}]]
+
+#let Xe = context[#box[#{
+ let cfg = config.get()
+ [X]
+ h(cfg.kern-xe)
+ drop(distance: cfg.drop-xe)[#mirror[E]]
+}]]
+
+#let LaTeX = context[#box[#{
+ let cfg = config.get()
+
+ [L]
+ h(cfg.kern-la)
+ drop(distance: -.2em)[#text(0.7em)[A]]
+ h(cfg.kern-at)
+ TeX
+}]]
+
+#let XeTeX = context[#box[#{
+ let cfg = config.get()
+
+ Xe
+ h(cfg.kern-et)
+ TeX
+}]]
+
+#let XeLaTeX = context[#box[#{
+ let cfg = config.get()
+
+ Xe
+ h(cfg.kern-el)
+ LaTeX
+}]]
+
+#let LuaLaTeX = box[Lua#LaTeX]
+#let LuaTeX = box[Lua#TeX]
+
+#let LaTeXe = context[#box[#{
+ LaTeX
+ [2]
+ sym.epsilon
+}]]
+
diff --git a/metalogo.typ b/metalogo.typ
index 28c3d8f..f9381f2 100644
--- a/metalogo.typ
+++ b/metalogo.typ
@@ -1,11 +1,2 @@
-// TODO: base should *actually* be lowered by 0.5ex, but Typst does not yet
-// have an ex unit, only em. See https://github.com/typst/typst/issues/2405
-#let baseline-drop = 0.22em
-
-#let TeX = [#box[T#h(-.1667em)#box[#move(dy: baseline-drop)[E]]#h(-.125em)X]]
-#let Xe = [#box[X#h(-.1667em)#box[#move(dy: baseline-drop)[#scale(x: -100%)[E]]]#h(-.125em)]]
-#let LaTeX = [#box[L#h(-.33em)#box[#move(dy: -0.2em)[#text(0.7em)[A]]]#h(-.15em)#TeX]]
-#let XeTeX = [#box[#Xe#TeX]]
-#let XeLaTeX = [#box[#Xe#LaTeX]]
-#let LuaLaTeX = [#box[Lua#LaTeX]]
+#import "lib.typ": metalogo, TeX, LaTeX, XeTeX, XeLaTeX, LuaLaTeX, LuaTeX, LaTeXe
diff --git a/typst.toml b/typst.toml
index 06808c7..702f8e5 100644
--- a/typst.toml
+++ b/typst.toml
@@ -1,6 +1,6 @@
[package]
name = "metalogo"
-version = "1.1.0"
+version = "1.2.0"
authors = ["Loek Le Blansch <loek@pipeframe.xyz>"]
license = "MIT"
description = "Typeset various LaTeX logos"