diff --git a/preview/swank-tex/0.1.0/.gitignore b/preview/swank-tex/0.1.0/.gitignore new file mode 100644 index 0000000..f1ca904 --- /dev/null +++ b/preview/swank-tex/0.1.0/.gitignore @@ -0,0 +1,2 @@ +tests/**/out/ +tests/**/diff/ diff --git a/preview/swank-tex/0.1.0/LICENSE b/preview/swank-tex/0.1.0/LICENSE new file mode 100644 index 0000000..35d39a7 --- /dev/null +++ b/preview/swank-tex/0.1.0/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Stephen Waits + +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. diff --git a/preview/swank-tex/0.1.0/README.md b/preview/swank-tex/0.1.0/README.md new file mode 100644 index 0000000..3ac2863 --- /dev/null +++ b/preview/swank-tex/0.1.0/README.md @@ -0,0 +1,66 @@ +# swank-tex + +Typographically correct TeX-family logos for Typst. This package provides +high-quality, properly kerned and positioned logos for TeX, LaTeX, XeTeX, and +related systems, based on the LaTeX metalogo package by Andrew Gilbert Moschou. + +## Installation + +Add this package to your Typst project: + +```typst +#import "@preview/swank-tex:0.1.0": * +``` + +## Usage + +The package provides the following logos as functions: + +- `TeX` +- `LaTeX` +- `LaTeX2E` +- `XeTeX` +- `XeLaTeX` +- `LuaTeX` +- `LuaLaTeX` +- `pdfTeX` + +Simply call these functions in your document: + +```typst +#import "@preview/swank-tex:0.1.0": * + +The #TeX typesetting system was created by Donald Knuth. +#LaTeX, created by Leslie Lamport, builds on top of #TeX. + +Modern engines like #XeTeX and #LuaTeX extend these capabilities. +``` + +## Features + +- Precise kerning between character pairs based on metalogo's output +- Proper vertical positioning of characters +- Correct scaling of special characters (e.g., the A in LaTeX) +- Uses New Computer Modern font for authentic appearance +- Pixel-matched to the well-established LaTeX metalogo package + +## License + +Licensed under the [MIT license](LICENSE). + +## Acknowledgments + +- Based on the LaTeX metalogo package by Andrew Gilbert Moschou +- Inspired by Donald Knuth's original TeX logo specifications +- Thanks to the Typst team for their excellent typesetting system + +## Contributing + +Contributions are welcome. Please feel free to submit a PR. + +## Version History + +- 0.1.0: Initial release + - Basic implementation of all TeX-family logos + - Proper kerning and positioning + - Documentation and examples (see tests) diff --git a/preview/swank-tex/0.1.0/lib.typ b/preview/swank-tex/0.1.0/lib.typ new file mode 100644 index 0000000..5a44ee8 --- /dev/null +++ b/preview/swank-tex/0.1.0/lib.typ @@ -0,0 +1,64 @@ +/// Provides typographically correct TeX-family logos for Typst. Based on the +/// LaTeX metalogo package by Andrew Gilbert Moschou. +/// +/// # Example +/// ```typ +/// #import "@preview/swank-tex:": * +/// The #TeX typesetting system, along with #LaTeX and #XeTeX. +/// ``` + +#let (TeX, LaTeX, LaTeX2E, XeTeX, XeLaTeX, LuaTeX, LuaLaTeX, pdfTeX) = { + // kerning values between pairs + let kern = ( + "Te": h(-0.165em), // Knuth says: -0.1667em + "eX": h(-0.122em), // Knuth says: -0.125em + "La": h(-0.361em), + "aT": h(-0.147em), + "X2": h( 0.150em), + "twoE": h( 0.133em), + "Xe": h(-0.122em), // mirrors "eX" + "eT": h(-0.165em), // mirrors "Te" + "eL": h(-0.124em), + "LuaT": h( 0.005em), // questionable, but matches metalogo output + "LuaL": h( 0.005em), // questionable, but matches metalogo output + ) + + // vertical translation for certain characters + let drop = ( + "E": 0.220em, + "A": -0.178em, + "e": -0.104em, + ) + + // resize certain characters + let sized = ( + "A": text(size: 0.7em, "A"), + "e": text(size: 1.66em, sym.epsilon), + ) + + // helper functions + let ncm(content) = text(font: "New Computer Modern", content) + + // components (used in logos below) + let E = box(move(dy: drop.E, "E")) + let A = box(move(dy: drop.A, sized.A)) + let e = box(move(dy: drop.e, rotate(12deg, sized.e))) + let Erev = box(scale(x: -100%, E)) + let Xe = box[X#kern.Xe#Erev] + + // logos which are also components + let TeX = ncm(box[T#kern.Te#E#kern.eX#[X]]) + let LaTeX = ncm(box[L#kern.La#A#kern.aT#TeX]) + + // return logos + ( + TeX, + LaTeX, + ncm(box[#LaTeX#kern.X2#[2]#sub[#kern.twoE#e]]), // LaTeX2E + ncm(box[#Xe#kern.eT#TeX]), // XeTeX + ncm(box[#Xe#kern.eL#LaTeX]), // XeLaTeX + ncm(box[Lua#kern.LuaT#TeX]), // LuaTeX + ncm(box[Lua#kern.LuaL#LaTeX]), // LuaLaTeX + ncm(box[pdf#TeX]), // pdfTeX + ) +} diff --git a/preview/swank-tex/0.1.0/tests/basic-output/ref/1.png b/preview/swank-tex/0.1.0/tests/basic-output/ref/1.png new file mode 100644 index 0000000..1bace78 Binary files /dev/null and b/preview/swank-tex/0.1.0/tests/basic-output/ref/1.png differ diff --git a/preview/swank-tex/0.1.0/tests/basic-output/test.typ b/preview/swank-tex/0.1.0/tests/basic-output/test.typ new file mode 100644 index 0000000..b56fd93 --- /dev/null +++ b/preview/swank-tex/0.1.0/tests/basic-output/test.typ @@ -0,0 +1,124 @@ +#import "/lib.typ": * + +#import "@preview/codly:1.0.0": * +#import "@preview/codly-languages:0.1.1": * +#show: codly-init +#codly(languages: codly-languages) + +#set page(paper: "us-letter", margin: 0.75in) +#set par(justify: true) +#set text(size: 11pt) + += A Brief History of #TeX and its Descendants + +#v(1.5em) + +#columns(2)[ + +== The core system + +#TeX (1978) forms the foundation - Donald Knuth's low-level typesetting engine +that handles the core mathematics of digital typography. Think of it as assembly +language for documents. Example: + +```tex +\hbox{\bf\tenpoint Introduction} +\vskip 12pt +``` + +== Introducing usability + +#LaTeX (1984) is Leslie Lamport's layer over #TeX that introduces logical +markup, making document creation more intuitive: + +```latex +\section{Introduction} +``` + +== Standardization and packages + +#LaTeX2E (1994) standardized #LaTeX, adding robust package management and fixing +incompatibilities between different #LaTeX styles. + +== PDF integration + +#pdfTeX (1996) added direct PDF output, with font embedding, microtypography + features like margin kerning and font expansion, and PDF-specific features + like hyperlinks and tables of contents. It became the default #TeX engine for + most #LaTeX installations: + +```tex +\pdfoutput=1 +\pdfcompresslevel=0 +\pdfobjcompresslevel=0 +\pdfmapline{ptmr8r Times-Roman 2 <8r.enc} +\font\tenrm=ptmr8r +\tenrm +Welcome to pdf\TeX! +\end +``` + +== Modern fonts and scripting + +Two modern branches evolved to handle Unicode and modern fonts: + +#XeTeX (2004): A #TeX engine supporting Unicode and modern fonts. +#XeLaTeX enables commands like: + +```latex +\usepackage{fontspec} +\setmainfont{Helvetica Neue} +``` + +#LuaTeX (2007): #TeX engine with embedded Lua scripting. +#LuaLaTeX allows direct programming: + +```latex +\directlua{ + local x = 1 + 1 + tex.print(x) +} +``` + +== Typical use + +Modern workflows typically use #XeLaTeX for straightforward Unicode documents + and #LuaLaTeX when document generation requires programming logic. Both are + vast improvements over the original #TeX: + +Original #TeX: + +```tex +\font\x="Times New Roman" at 12pt +\x Hello, 世界 +``` + +#XeLaTeX/#LuaLaTeX: + +```latex +\documentclass{article} +\usepackage{fontspec} +\setmainfont{Times New Roman} +\begin{document} +Hello, 世界 +\end{document} +``` + +== The Modern alternative: Typst + +Typst (2023) is a modern competitor to the #TeX family, designed from scratch +with a focus on speed and intuitive syntax: + +```typst += Fibonacci sequence +The Fibonacci sequence is defined by +$F_n = F_(n-1) + F_(n-2)$. + +#let fib(n) = ( + if n <= 2 { 1 } + else { fib(n - 1) + fib(n - 2) } +) + +The 8th Fibonacci number is #fib(8). +``` +] diff --git a/preview/swank-tex/0.1.0/tests/logo-overlay/logos.png b/preview/swank-tex/0.1.0/tests/logo-overlay/logos.png new file mode 100644 index 0000000..5313d26 Binary files /dev/null and b/preview/swank-tex/0.1.0/tests/logo-overlay/logos.png differ diff --git a/preview/swank-tex/0.1.0/tests/logo-overlay/ref/1.png b/preview/swank-tex/0.1.0/tests/logo-overlay/ref/1.png new file mode 100644 index 0000000..099da6d Binary files /dev/null and b/preview/swank-tex/0.1.0/tests/logo-overlay/ref/1.png differ diff --git a/preview/swank-tex/0.1.0/tests/logo-overlay/test.typ b/preview/swank-tex/0.1.0/tests/logo-overlay/test.typ new file mode 100644 index 0000000..8324f94 --- /dev/null +++ b/preview/swank-tex/0.1.0/tests/logo-overlay/test.typ @@ -0,0 +1,15 @@ +#import "/lib.typ": * + +#set page(height: auto) + +#image("logos.png") + +#set text(font: "New Computer Modern", size: 104pt, fill: rgb(255,0,0,64), stroke: 0.1pt+red) + +#move(dx: 0.094in, dy: -13.560in, TeX) +#move(dx: 0.095in, dy: -14.544in, LaTeX) +#move(dx: 0.095in, dy: -15.524in, LaTeX2E) +#move(dx: 0.095in, dy: -16.507in, XeTeX) +#move(dx: 0.095in, dy: -17.492in, XeLaTeX) +#move(dx: 0.095in, dy: -18.475in, LuaTeX) +#move(dx: 0.095in, dy: -19.457in, LuaLaTeX) diff --git a/preview/swank-tex/0.1.0/thumbnail.png b/preview/swank-tex/0.1.0/thumbnail.png new file mode 100644 index 0000000..1bace78 Binary files /dev/null and b/preview/swank-tex/0.1.0/thumbnail.png differ diff --git a/preview/swank-tex/0.1.0/typst.toml b/preview/swank-tex/0.1.0/typst.toml new file mode 100644 index 0000000..6907129 --- /dev/null +++ b/preview/swank-tex/0.1.0/typst.toml @@ -0,0 +1,11 @@ +[package] +name = "swank-tex" +version = "0.1.0" +entrypoint = "lib.typ" +authors = ["Stephen Waits "] +license = "MIT" +description = "Render those funky logos for TeX, LaTeX, and friends." +categories = ["utility"] +keywords = ["tex", "latex", "luatex", "xetex", "lualatex", "xelatex", "logo"] +repository = "https://github.com/swaits/typst-collection" +exclude = ["thumbnail.png", "tests"]